Documentation ¶
Overview ¶
Package database defines the interfaces used for data storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record interface { // Key returns the record's key. Key() *Key // Resolve resolves the record or a child record. Resolve(key *Key) (Record, *Key, error) // IsDirty returns true if the record has been modified. IsDirty() bool // Commit writes any modifications to the store. Commit() error // Walk walks the record. // // If the record is clean and opts.Changes is set, Walk returns immediately, // without calling the callback or recursing. Otherwise if the record is // terminal (not composite), Walk calls the callback on the record. The // behavior of Walk for a composite record depends on opts.Values, though // the first condition (return immediately if clean and opts.Changes is set) // still holds. If opts.Values is set, Walk calls the callback for every // component of the record but not for the composite record itself. If // opts.Values is not set, Walk calls the callback on the composite record. // If the callback returns skip = true, Walk returns immediately. Otherwise, // Walk calls the callback for every component of the record. Walk(opts WalkOptions, fn WalkFunc) error }
A Record is a component of a data model.
type Store ¶
type Store interface { // GetValue loads the value from the underlying store and writes it. Byte // stores call LoadBytes(data) and value stores call LoadValue(v, false). GetValue(key *record.Key, value Value) error // PutValue gets the value from the reader and stores it. A byte store // marshals the value and stores the bytes. A value store finds the // appropriate value and calls LoadValue(v, true). PutValue(key *record.Key, value Value) error }
A Store loads and stores values.
type Value ¶
type Value interface { Record // GetValue returns the value. GetValue() (value encoding.BinaryValue, version int, err error) // LoadValue stores the value of the reader into the receiver. LoadValue(value Value, put bool) error // LoadBytes unmarshals a value from bytes into the receiver. LoadBytes(data []byte, put bool) error }
A Value is a terminal record value.
type WalkOptions ¶
Click to show internal directories.
Click to hide internal directories.