initializer
This commit is contained in:
parent
127cd706b4
commit
560a16b6fe
10
.idea/libraries/Go_SDK.xml
Normal file
10
.idea/libraries/Go_SDK.xml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<component name="libraryTable">
|
||||||
|
<library name="Go SDK">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="file://$PROJECT_DIR$/../../../../../sdk/go/1.8/src" />
|
||||||
|
</CLASSES>
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$PROJECT_DIR$/../../../../../sdk/go/1.8/src" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,18 +1,18 @@
|
||||||
package initializer_go
|
package initializer_go
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
cm "loafle.com/overflow/agent_api/config_manager"
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
cm "loafle.com/overflow/agent_api/config_manager"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
once sync.Once
|
once sync.Once
|
||||||
instance *Initializer
|
instance *Initializer
|
||||||
)
|
)
|
||||||
|
|
||||||
type Initializer struct {
|
type Initializer struct {
|
||||||
gconf *cm.GlobalConfig
|
gconf *cm.GlobalConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(ch chan string, conf *cm.GlobalConfig) error {
|
func Start(ch chan string, conf *cm.GlobalConfig) error {
|
||||||
|
@ -26,6 +26,15 @@ func Start(ch chan string, conf *cm.GlobalConfig) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func Stop(res chan bool) {
|
||||||
|
|
||||||
|
GetInstance().stop()
|
||||||
|
|
||||||
|
res <- true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func GetInstance() *Initializer {
|
func GetInstance() *Initializer {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
instance = &Initializer{}
|
instance = &Initializer{}
|
||||||
|
@ -47,3 +56,6 @@ func (i *Initializer) getSecretKey() (string, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *Initializer) stop() {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user