Documentation
¶
Overview ¶
Package storage provides implementations and shared components for tessera storage backends.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FlushFunc ¶
FlushFunc is the signature of a function which will receive the slice of queued entries. Normally, this function would be provided by storage implementations. It's important to note that the implementation MUST call each entry's MarshalBundleData function before attempting to integrate it into the tree. See the comment on Entry.MarshalBundleData for further info.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue knows how to queue up a number of entries in order, taking care of deduplication as they're added.
When the buffered queue grows past a defined size, or the age of the oldest entry in the queue reaches a defined threshold, the queue will call a provided FlushFunc with a slice containing all queued entries in the same order as they were added.
If multiple identical entries are added to the queue between flushes, the queue will deduplicate them by passing only the first through to the FlushFunc, and returning the index assigned to that entry to all duplicate add calls. Note that this deduplication only applies to "in-flight" entries currently in the queue; entries added after a flush will not be deduped against those added before the flush.
func NewQueue ¶
NewQueue creates a new queue with the specified maximum age and size.
The provided FlushFunc will be called with a slice containing the contents of the queue, in the same order as they were added, when either the oldest entry in the queue has been there for maxAge, or the size of the queue reaches maxSize.
type SequencedEntry ¶
type SequencedEntry struct { // BundleData is the entry's data serialised into the correct format for appending to an entry bundle. BundleData []byte // LeafHash is the entry's Merkle leaf hash. LeafHash []byte }
SequencedEntry represents a log entry which has already been sequenced.