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(off 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 centralizes the configuration for the log
type Log ¶
Log consists of a list of segments and a pointer to the active segment to append writes to.
func NewLog ¶
NewLog sets defaults for any configs the caller didn't set, then it creates a log instance, and sets up that instance
func (*Log) Append ¶
Append appends a record to the active segment of the log. If the segment is at its max size (per the config), a new segment is made. A RWMutex is used to grant access to reads when there isn't a write holding the lock. TODO optimize locks per segment, rather than entire log.
func (*Log) HighestOffset ¶
HighestOffset returns the highest offset stored
func (*Log) LowestOffset ¶
LowestOffset returns the lowest offset stored