Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Closable ¶
type Closable interface {
// Close the database
Close()
}
A Closable is a handle or database that can be closed
type Database ¶
type Database interface { ReadOnlyView WriterView // Return a subset of the database for usage Bucket(id []byte) Database // NextSequence returns the next natural sequence for insert-order-centric applications // Note this will cause implementations to lock while finding the natural sequence NextSequence() []byte // Convert view of current database or bucket into a read-only one. // This should not be considered a transaction, just special sauce. View(f ReadOnlyFunc) error // Obtain a read-write view of the database in a transaction Update(f WriterFunc) error // Close the database (might no-op) Close() }
Database is the compound interface to the underlying database implementation
type DbForeachFunc ¶
DbForeachFunc is used in the root (untyped buckets)
type GobDecoderLight ¶
type GobDecoderLight struct {
// contains filtered or unexported fields
}
GobDecoderLight is a helper for decoding gob
func NewGobDecoderLight ¶
func NewGobDecoderLight() *GobDecoderLight
NewGobDecoderLight returns a new lock-free decoder
func (*GobDecoderLight) DecodeType ¶
func (g *GobDecoderLight) DecodeType(buf []byte, outT interface{}) error
DecodeType will attempt to decode the buffer into the pointer outT
type GobEncoderLight ¶
type GobEncoderLight struct {
// contains filtered or unexported fields
}
GobEncoderLight is a helper for encoding gob
func NewGobEncoderLight ¶
func NewGobEncoderLight() *GobEncoderLight
NewGobEncoderLight returns a new lock-free encoder
func (*GobEncoderLight) EncodeType ¶
func (g *GobEncoderLight) EncodeType(t interface{}) ([]byte, error)
EncodeType will convert give given pointer into a gob encoded byte set, and return them
type ReadOnlyFunc ¶
type ReadOnlyFunc func(view ReadOnlyView) error
A ReadOnlyFunc is expected by the Database.View method
type ReadOnlyView ¶
type ReadOnlyView interface { // Get an object from storage GetObject(id []byte, o interface{}) error // Determine if an object with that ID exists already HasObject(id []byte) (bool, error) // Attempt to decode the input into the given output pointer Decode(input []byte, o interface{}) error // For every key value pair, run the given function ForEach(f DbForeachFunc) error }
ReadOnlyView offers a read-only API for the database. Note it cannot gain access to buckets again, so you should obtain the view from the bucket.
type WriterFunc ¶
A WriterFunc is used for batch write (transactional) views