Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDoesNotExist is returned when a collection's data file // doesn't exist. ErrDoesNotExist = errors.New("lm2: does not exist") )
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection represents an ordered linked list map.
func NewCollection ¶
func NewCollection(file string, cacheSize int) (*Collection, error)
NewCollection creates a new collection with a data file at file. cacheSize represents the size of the collection cache.
func OpenCollection ¶
func OpenCollection(file string, cacheSize int) (*Collection, error)
OpenCollection opens a collection with a data file at file. cacheSize represents the size of the collection cache. ErrDoesNotExist is returned if file does not exist.
func (*Collection) Close ¶
func (c *Collection) Close()
Close closes a collection and all of its resources.
func (*Collection) Destroy ¶ added in v1.2.1
func (c *Collection) Destroy() error
Destroy closes the collection and removes its associated data files.
func (*Collection) NewCursor ¶
func (c *Collection) NewCursor() (*Cursor, error)
NewCursor returns a new cursor with a snapshot view of the current collection state.
func (*Collection) Stats ¶ added in v1.0.0
func (c *Collection) Stats() Stats
Stats returns collection statistics.
func (*Collection) Update ¶
func (c *Collection) Update(wb *WriteBatch) (int64, error)
Update atomically and durably applies a WriteBatch (a set of updates) to the collection. It returns the new version (on success) and an error.
func (*Collection) Version ¶ added in v0.1.3
func (c *Collection) Version() int64
Version returns the last committed version.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents a snapshot cursor.
func (*Cursor) Key ¶
Key returns the key of the current record. It returns an empty string if the cursor is not valid.
func (*Cursor) Next ¶
Next moves the cursor to the next record. It returns true if it lands on a valid record.
func (*Cursor) Seek ¶
Seek positions the cursor at the last key less than or equal to the provided key.
type WriteBatch ¶
type WriteBatch struct {
// contains filtered or unexported fields
}
WriteBatch represents a set of modifications.
func (*WriteBatch) Delete ¶
func (wb *WriteBatch) Delete(key string)
Delete marks a key for deletion.
func (*WriteBatch) Set ¶
func (wb *WriteBatch) Set(key, value string)
Set adds key => value to the WriteBatch. Note: If a key is passed to Delete and Set, then the Set will be ignored.