Documentation ¶
Overview ¶
Package file implements a simple file storage layer for an index to operate on. The Store object implements the store.Storer interface, which is used by higher level index constructs. Note: in log file an entry is represented as -> <size><data> where size is a uint32 encoded in little endian to 4 bytes, storing the length in bytes of data, and data is a pb.Entry marshaled to bytes A log file looks like: <size><data><size><data>...<size><data><size><data>
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides operations for persisting to a file and reading data back. It implements the storage.Storer interface.
func NewStore ¶
NewStore returns a new Store object or an error. It accepts a file and options for overriding default behavior.
func (*Store) Append ¶
Append writes to the tail of the storage file and returns the written entry's position or an error.
func (*Store) Begin ¶
func (s *Store) Begin() storage.ForwardIterator
Begin returns an iterator to the beginning of the storage log.
func (*Store) Cleanup ¶
Cleanup is a utility for testing that closes and removes the file. NOTE: This should be unexported in the future.
type StoreOption ¶
type StoreOption func(*options)
StoreOption is func that modifies the store's configuration options.
func SyncInterval ¶
func SyncInterval(dur time.Duration) StoreOption
SyncInterval overrides the Index default sync interval.