Documentation
¶
Index ¶
Constants ¶
View Source
const LengthLen = 8
View Source
const MinEntryLen = OperTypeLen + OperTimeLen + LengthLen + MinKeyLen + LengthLen
View Source
const MinKeyLen = 1
View Source
const OperTimeLen = 8
Moves type size to the point of definition to make later modification easier
View Source
const OperTypeLen = 1
Used for binary marshaling unmarshaling. Moves the defintion of the size to the place the type is defined
Variables ¶
View Source
var ErrorNotEnoughBytes = errors.New("data is not long enough to hold a ledger entry")
Functions ¶
This section is empty.
Types ¶
type LedgerTxn ¶
type LedgerTxn interface {
// Append adds a new entry to the append-only log
Append(op Operation) error
// Filter returns all matching entries (determined by fn) sorted by timestamp
Filter(fn func(ent Entry) (bool, error)) (Entries, error)
// Compact compacts the local ledger deleting all entries for each key.
// Only the most recent N entries for each key will be kept
Compact(n int) error
}
type Operation ¶
type Operation struct {
Time uint64 // Timestamp of the operation
Type OperType // The type of operation being recorded
Key []byte // The key being modified
Value []byte // The new value of the modified key (if a set operation)
}
func (Operation) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler.
func (*Operation) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
Click to show internal directories.
Click to hide internal directories.