-
Notifications
You must be signed in to change notification settings - Fork 7
Development
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 byconfigInst.parse([]byte)
- Create a
manager.Manager
instance bymanager.NewManager(&configInst)
- (Internal implementation:
NewManager
creates workers for each repo and forward related part ofconfig
(calledrepoConfig, 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 isInterval
) - Main routine can control
manager
's behavior bymanager.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 aftermanager.Stop()
is returned.
See according sections for details: