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

Method Init

worker/dbms.go:175–203  ·  view source on GitHub ↗

Init defines dbms init logic.

()

Source from the content-addressed store, hash-verified

173
174// Init defines dbms init logic.
175func (dbms *DBMS) Init() (err error) {
176 // read meta
177 var localMeta *DBMSMeta
178 if localMeta, err = dbms.readMeta(); err != nil {
179 err = errors.Wrap(err, "read dbms meta failed")
180 return
181 }
182
183 // load current peers info from block producer
184 var dbMapping = dbms.busService.GetCurrentDBMapping()
185
186 // init database
187 if err = dbms.initDatabases(localMeta, dbMapping); err != nil {
188 err = errors.Wrap(err, "init databases with meta failed")
189 return
190 }
191
192 if err = dbms.busService.Subscribe("/CreateDatabase/", dbms.createDatabase); err != nil {
193 err = errors.Wrap(err, "init chain bus failed")
194 return
195 }
196 if err = dbms.busService.Subscribe("/UpdateBilling/", dbms.updateBilling); err != nil {
197 err = errors.Wrap(err, "init chain bus failed")
198 return
199 }
200 dbms.busService.Start()
201
202 return
203}
204
205func (dbms *DBMS) updateBilling(itx interfaces.Transaction, count uint32) {
206 var (

Callers 2

startTestServiceFunction · 0.95
TestDBMSFunction · 0.95

Calls 5

readMetaMethod · 0.95
initDatabasesMethod · 0.95
GetCurrentDBMappingMethod · 0.80
SubscribeMethod · 0.65
StartMethod · 0.45

Tested by 2

startTestServiceFunction · 0.76
TestDBMSFunction · 0.76