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

Function NewBusService

worker/chainbusservice.go:55–72  ·  view source on GitHub ↗

NewBusService creates a new chain bus instance.

(
	ctx context.Context, addr proto.AccountAddress, checkInterval time.Duration)

Source from the content-addressed store, hash-verified

53
54// NewBusService creates a new chain bus instance.
55func NewBusService(
56 ctx context.Context, addr proto.AccountAddress, checkInterval time.Duration) (_ *BusService,
57) {
58 ctd, ccl := context.WithCancel(ctx)
59 bs := &BusService{
60 Bus: chainbus.New(),
61 wg: sync.WaitGroup{},
62 caller: rpc.NewCaller(),
63 ctx: ctd,
64 cancel: ccl,
65 checkInterval: checkInterval,
66 localAddress: addr,
67 }
68 // State initialization: fetch last block and update fields `blockCount` and `sqlChainProfiles`
69 var _, profiles, count = bs.requestLastBlock()
70 bs.updateState(count, profiles)
71 return bs
72}
73
74// GetCurrentDBMapping returns current cached db mapping.
75func (bs *BusService) GetCurrentDBMapping() (dbMap map[proto.DatabaseID]*types.SQLChainProfile) {

Callers 2

NewDBMSFunction · 0.85
TestNewBusServiceFunction · 0.85

Calls 3

requestLastBlockMethod · 0.95
updateStateMethod · 0.95
NewFunction · 0.92

Tested by 1

TestNewBusServiceFunction · 0.68