MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / Init

Function Init

client/driver.go:132–159  ·  view source on GitHub ↗

Init defines init process for client.

(configFile string, masterKey []byte)

Source from the content-addressed store, hash-verified

130
131// Init defines init process for client.
132func Init(configFile string, masterKey []byte) (err error) {
133 if !atomic.CompareAndSwapUint32(&driverInitialized, 0, 1) {
134 err = ErrAlreadyInitialized
135 return
136 }
137
138 // load config
139 if conf.GConf, err = conf.LoadConfig(configFile); err != nil {
140 return
141 }
142
143 route.InitKMS(conf.GConf.PubKeyStoreFile)
144 if err = kms.InitLocalKeyPair(conf.GConf.PrivateKeyFile, masterKey); err != nil {
145 return
146 }
147
148 // ping block producer to register node
149 if err = registerNode(); err != nil {
150 return
151 }
152
153 // run peers updater
154 if err = runPeerListUpdater(); err != nil {
155 return
156 }
157
158 return
159}
160
161// Create sends create database operation to block producer.
162func Create(meta ResourceMeta) (txHash hash.Hash, dsn string, err error) {

Callers 15

mainFunction · 0.92
TestFullProcessFunction · 0.92
TestFullProcessFunction · 0.92
mainFunction · 0.92
configInitFunction · 0.92
initTestDBFunction · 0.92
mainFunction · 0.92
mainFunction · 0.92
TestFullProcessFunction · 0.92
benchMinerFunction · 0.92
mainFunction · 0.92

Calls 5

LoadConfigFunction · 0.92
InitKMSFunction · 0.92
InitLocalKeyPairFunction · 0.92
runPeerListUpdaterFunction · 0.85
registerNodeFunction · 0.70

Tested by 8

TestFullProcessFunction · 0.74
TestFullProcessFunction · 0.74
initTestDBFunction · 0.74
TestFullProcessFunction · 0.74
benchMinerFunction · 0.74
TestInitFunction · 0.68