github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/events.go (about)

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