reorganized the source to place the resuable code under the hodu package and keep the command entry point in the main package under the cmd directory
This commit is contained in:
27
hodu.go
Normal file
27
hodu.go
Normal file
@ -0,0 +1,27 @@
|
||||
package hodu
|
||||
|
||||
import "sync"
|
||||
|
||||
const HODU_VERSION uint32 = 0x010000
|
||||
|
||||
type LogLevel int
|
||||
|
||||
const (
|
||||
LOG_DEBUG LogLevel = iota + 1
|
||||
LOG_ERROR
|
||||
LOG_WARN
|
||||
LOG_INFO
|
||||
)
|
||||
|
||||
type Logger interface {
|
||||
Write (level LogLevel, fmt string, args ...interface{})
|
||||
}
|
||||
|
||||
type Service interface {
|
||||
RunTask (wg *sync.WaitGroup) // blocking. run the actual task loop
|
||||
StartService(data interface{}) // non-blocking. spin up a service. it may be invokded multiple times for multiple instances
|
||||
StopServices() // non-blocking. send stop request to all services spun up
|
||||
WaitForTermination() // blocking. must wait until all services are stopped
|
||||
}
|
||||
|
||||
type ExtTask func(svc Service, wg *sync.WaitGroup)
|
Reference in New Issue
Block a user