Documentation ¶
Index ¶
- type Config
- type Log
- func (l *Log) Append(record *api.Record) (uint64, error)
- func (l *Log) Close() error
- func (l *Log) HighestOffset() (uint64, error)
- func (l *Log) LowestOffset() (uint64, error)
- func (l *Log) Read(offset uint64) (*api.Record, error)
- func (l *Log) Reader() io.Reader
- func (l *Log) Remove() error
- func (l *Log) Reset() error
- func (l *Log) Truncate(lowest uint64) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Segment struct { MaxStoreBytes uint64 MaxIndexBytes uint64 InitialOffset uint64 } }
Config provides configuration of a log, such as the max size of a segment's store and index.
type Log ¶
The log consists of a list of segments and a pointer to the active segment to append writes to. The directory stores segments.
func NewLog ¶
Set config defaults if the caller didn't specify, create a log instance and set up the instance.
func (*Log) Append ¶
Appends a record to the log. Append the record to the active segment. Make a new active segment if the segment is at its max size (per the max size configuration).
func (*Log) HighestOffset ¶
func (*Log) LowestOffset ¶
func (*Log) Reader ¶
Returns a reader to read the whole log. This is used to concatenate the segments' stores. The originReader type is needed to ensure we begin reading from the origin of the store and read the entire file.