Documentation ¶
Index ¶
- Constants
- Variables
- type Cleaner
- type CommitLog
- func (l *CommitLog) Append(b []byte) (offset int64, err error)
- func (l *CommitLog) Close() error
- func (l *CommitLog) Delete() error
- func (l *CommitLog) DeleteRange(min uint64, max uint64) error
- func (l *CommitLog) FirstIndex() (uint64, error)
- func (c *CommitLog) Get(key []byte) ([]byte, error)
- func (l *CommitLog) GetLog(index uint64, log *raft.Log) error
- func (c *CommitLog) GetUint64(key []byte) (uint64, error)
- func (l *CommitLog) LastIndex() (uint64, error)
- func (l *CommitLog) NewReader(offset int64, maxBytes int32) (io.Reader, error)
- func (l *CommitLog) NewestOffset() int64
- func (l *CommitLog) OldestOffset() int64
- func (l *CommitLog) Read(p []byte) (n int, err error)
- func (l *CommitLog) Segments() []*Segment
- func (c *CommitLog) Set(key []byte, val []byte) error
- func (c *CommitLog) SetUint64(key []byte, val uint64) error
- func (l *CommitLog) StoreLog(log *raft.Log) error
- func (l *CommitLog) StoreLogs(logs []*raft.Log) error
- func (l *CommitLog) Truncate(offset int64) error
- type DeleteCleaner
- type Entry
- type Message
- type MessageSet
- type Options
- type Reader
- type Segment
- func (s *Segment) Close() error
- func (s *Segment) Delete() error
- func (s *Segment) IsFull() bool
- func (s *Segment) Read(p []byte) (n int, err error)
- func (s *Segment) ReadAt(p []byte, off int64) (n int, err error)
- func (s *Segment) SetupIndex(path string) (err error)
- func (s *Segment) Write(p []byte) (n int, err error)
Constants ¶
View Source
const ( LogFileSuffix = ".log" IndexFileSuffix = ".index" )
Variables ¶
View Source
var ( ErrSegmentNotFound = errors.New("segment not found") Encoding = binary.BigEndian )
View Source
var (
ErrIndexCorrupt = errors.New("corrupt index file")
)
Functions ¶
This section is empty.
Types ¶
type CommitLog ¶
type CommitLog struct { Options // contains filtered or unexported fields }
func (*CommitLog) FirstIndex ¶
func (*CommitLog) NewestOffset ¶
func (*CommitLog) OldestOffset ¶
type DeleteCleaner ¶
type DeleteCleaner struct { Retention struct { Bytes int64 } }
func NewDeleteCleaner ¶
func NewDeleteCleaner(bytes int64) *DeleteCleaner
type MessageSet ¶
type MessageSet []byte
func NewMessageSet ¶
func NewMessageSet(offset uint64, msgs ...Message) MessageSet
func (MessageSet) Offset ¶
func (ms MessageSet) Offset() int64
func (MessageSet) Payload ¶
func (ms MessageSet) Payload() []byte
func (MessageSet) PutOffset ¶
func (ms MessageSet) PutOffset(offset int64)
func (MessageSet) Size ¶
func (ms MessageSet) Size() int32
type Segment ¶
type Segment struct { Index *index BaseOffset int64 NextOffset int64 Position int64 sync.Mutex // contains filtered or unexported fields }
func (*Segment) SetupIndex ¶
SetupIndex creates and initializes an index. Initialization is: - Sanity check of the loaded index - Truncates the index (clears it) - Reads the log file from the beginning and re-initializes the index
Click to show internal directories.
Click to hide internal directories.