Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DataSegmentSize defines the maximum size of a given Data Segment. This
// values does not affect segments already present in the disk, if any.
DataSegmentSize int64
// IndexSegmentSize indicates the maximum size of the system index before
// it is split into a next file. Each index record takes 41 bytes
// choosing a multiple of that value will prevent index segments from
// consuming more than it may require.
IndexSegmentSize int64
// WorkDir represents the absolute path to the directory where the WAL will
// retain information. It is advised to use a directory in which only the
// WAL instance will have access, as all files within that directory will
// be automatically managed by the instance itself.
WorkDir string
// Logger allows a given stdlog.Logger instance to be set as the system
// logger. If unset, no logs will be generated.
Logger stdlog.Logger
}
func (Config) GetDataSegmentSize ¶
func (Config) GetIndexSegmentSize ¶
func (Config) GetWorkdir ¶
type WAL ¶
type WAL interface {
// WriteObject writes a given object to the WAL. Returns an error in case
// the write operation fails.
WriteObject(data []byte) error
// ReadObject attempts to read a previously stored object under a given
// id. Either returns an io.Reader for the object's data, or an error. In
// case the object has been marked for removal, a NotFoundError is returned.
ReadObject(id int64) (io.Reader, error)
// ReadObjects returns a new Cursor pointing to either the object under the
// specified id, or its right sibling, depending on the value of the
// inclusive flag.
ReadObjects(id int64, inclusive bool) Cursor
// Close flushes all data to disk, and safely closes underlying facilities
// of the WAL.
Close() error
// VacuumRecords marks and removes all records from the storage medium.
// Whether the provided id is also included in the vacuuming is defined by
// the inclusive flag.
VacuumRecords(id int64, inclusive bool) error
// CountObjects returns the amount of objects after a given id. In case the
// inclusive flag is set, the object itself is also accounted in the
// returned total.
CountObjects(id int64, inclusive bool) int64
// CurrentRecordID returns the id of the latest written object
CurrentRecordID() int64
// IsEmpty returns whether the WAL contains any items. Returns true in case
// no item is currently stored, otherwise returns false.
IsEmpty() bool
// MinimumRecordID returns the minimum record available in the WAL. Returns
// -1 in case no record is available.
MinimumRecordID() int64
}
Click to show internal directories.
Click to hide internal directories.