Documentation ¶
Overview ¶
Package fileseg implements segmented file based storage with a segmentation and compaction strategy. The Store object implements the Storer interface. It allows for compaction by virtualizing addresses through the use of hierarchical page tables. Hierarchical page tables comes with some storage overhead since we are maintaining multiple page tables instead of just one. The store maintains a page table with [<virtual-address> -> <segment-index>], with each segment maintaining its own page table with [<virtual-address> -> <offset>]. Each segment is backed by a file in a specified data directory. The Store orchestrates reads and writes to the various segments. The Store's page tables need to fit in memory.
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 data directory where storage segments are written as files. It implements the storage.Storer interface.
func NewStore ¶
NewStore returns a new Store object or an error. It accepts a data directory and options for overriding default behavior.
func (*Store) Append ¶
Append appends data to a storeage segment and returns its position or an error.
func (*Store) Begin ¶
func (s *Store) Begin() storage.ForwardIterator
Begin returns a forward iterator to the beginning of the storage entries.
type StoreOption ¶
type StoreOption func(*options)
StoreOption is func that modifies the store's configuration options.
func Compaction ¶
func Compaction(enabled bool) StoreOption
Compaction turns segment compaction on or off, default is on.
func SegmentSize ¶
func SegmentSize(n int) StoreOption
SegmentSize sets the max size for a given storage segment.
func SyncInterval ¶
func SyncInterval(dur time.Duration) StoreOption
SyncInterval overrides the Index default sync interval.