MCPcopy Create free account
hub / github.com/Pluralith/pluralith-cli / PushComDBEvent

Function PushComDBEvent

app/pkg/comdb/PushComDBEvent.go:8–28  ·  view source on GitHub ↗
(message ComDBEvent)

Source from the content-addressed store, hash-verified

6)
7
8func PushComDBEvent(message ComDBEvent) error {
9 functionName := "PushComDBEvent"
10 var comDB ComDB
11
12 AcquireDBLock()
13
14 // Read DB from disk
15 if readErr := ReadComFile(auxiliary.StateInstance.ComDBPath, &comDB); readErr != nil {
16 return fmt.Errorf("reading ComDB failed -> %v: %w", functionName, readErr)
17 }
18
19 // Prepend new event to existing event list
20 comDB.Events = append([]ComDBEvent{message}, comDB.Events...)
21
22 // Write updated DB to disk
23 if writeErr := WriteComDB(comDB); writeErr != nil {
24 return fmt.Errorf("writing to ComDB failed -> %v: %w", functionName, writeErr)
25 }
26
27 return nil
28}

Callers

nothing calls this directly

Calls 3

AcquireDBLockFunction · 0.85
ReadComFileFunction · 0.85
WriteComDBFunction · 0.85

Tested by

no test coverage detected