rename dbloggingservice to dbwriterservice

This commit is contained in:
saji 2024-02-18 00:11:08 -06:00
parent 3f9df5c1eb
commit d456e64656

View file

@ -70,7 +70,7 @@ var serveThings = []service{
&xBeeService{}, &xBeeService{},
&canLoggerService{}, &canLoggerService{},
&rpcService{}, &rpcService{},
&dbLoggingService{}, &dbWriterService{},
&httpService{}, &httpService{},
} }
@ -331,24 +331,26 @@ func (h *httpService) Start(cCtx *cli.Context, deps svcDeps) (err error) {
return return
} }
// dbLoggingService listens to the CAN packet broker and saves packets to the database. // dbWriterService listens to the CAN packet broker and saves packets to the database.
type dbLoggingService struct { type dbWriterService struct {
} }
func (d *dbLoggingService) Status() { func (d *dbWriterService) Status() {
} }
func (d *dbLoggingService) String() string { func (d *dbWriterService) String() string {
return "db logger" return "db logger"
} }
func (d *dbLoggingService) Start(cCtx *cli.Context, deps svcDeps) (err error) { func (d *dbWriterService) Start(cCtx *cli.Context, deps svcDeps) (err error) {
// put CAN packets from the broker into the database. // put CAN packets from the broker into the database.
tdb := deps.Db tdb := deps.Db
rxCh, err := deps.Broker.Subscribe("dbRecorder") rxCh, err := deps.Broker.Subscribe("dbWriter")
defer deps.Broker.Unsubscribe("dbRecorder") defer deps.Broker.Unsubscribe("dbWriter")
// TODO: add buffering + timeout/backpressure
for { for {
select { select {