You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vic Luo edited this page Jun 26, 2016
·
2 revisions
Lug is an extensible backend for software mirror. Generally speaking Lug consists of three packages: config, worker and manager. The way they work together is described below:
Create a config.Config instance and get its value by configInst.parse([]byte)
Create a manager.Manager instance by manager.NewManager(&configInst)
(Internal implementation: NewManager creates workers for each repo and forward related part of config(called repoConfig, map[string]string) to its constructor)
manager.Run(), which blocks current routine
(Internal implementation: manager stucks into a dead loop where manager polls each worker and dispatch works(if they are idle and now - lastSync > repoConfig.Interval) to workers. The interval between each loop is Interval)
Main routine can control manager's behavior by manager.Start(), manager.Stop(), manager.Exit(). All of these actions block until according signals are received by manager, therefore workers may still work for a short time even after manager.Stop() is returned.