github.com/koko1123/flow-go-1@v0.29.6/storage/events.go (about) 1 package storage 2 3 import ( 4 "github.com/koko1123/flow-go-1/model/flow" 5 ) 6 7 // Events represents persistent storage for events. 8 type Events interface { 9 10 // BatchStore will store events for the given block ID in a given batch 11 BatchStore(blockID flow.Identifier, events []flow.EventsList, batch BatchStorage) error 12 13 // ByBlockID returns the events for the given block ID 14 ByBlockID(blockID flow.Identifier) ([]flow.Event, error) 15 16 // ByBlockIDTransactionID returns the events for the given block ID and transaction ID 17 ByBlockIDTransactionID(blockID flow.Identifier, transactionID flow.Identifier) ([]flow.Event, error) 18 19 // ByBlockIDTransactionIndex returns the events for the transaction at given index in a given block 20 ByBlockIDTransactionIndex(blockID flow.Identifier, txIndex uint32) ([]flow.Event, error) 21 22 // ByBlockIDEventType returns the events for the given block ID and event type 23 ByBlockIDEventType(blockID flow.Identifier, eventType flow.EventType) ([]flow.Event, error) 24 25 // BatchRemoveByBlockID removes events keyed by a blockID in provided batch 26 // No errors are expected during normal operation, even if no entries are matched. 27 // If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned. 28 BatchRemoveByBlockID(blockID flow.Identifier, batch BatchStorage) error 29 } 30 31 type ServiceEvents interface { 32 // BatchStore stores service events keyed by a blockID in provided batch 33 // No errors are expected during normal operation, even if no entries are matched. 34 // If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned. 35 BatchStore(blockID flow.Identifier, events []flow.Event, batch BatchStorage) error 36 37 // ByBlockID returns the events for the given block ID 38 ByBlockID(blockID flow.Identifier) ([]flow.Event, error) 39 40 // BatchRemoveByBlockID removes service events keyed by a blockID in provided batch 41 // No errors are expected during normal operation, even if no entries are matched. 42 // If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned. 43 BatchRemoveByBlockID(blockID flow.Identifier, batch BatchStorage) error 44 }