commitlog

package
v0.0.0-...-2d43357 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogFileSuffix   = ".log"
	IndexFileSuffix = ".index"
)

Variables

View Source
var (
	ErrIndexCorrupt = errors.New("corrupt index file")
)
View Source
var (
	ErrSegmentNotFound = errors.New("segment not found")
)

Functions

This section is empty.

Types

type Cleaner

type Cleaner interface {
	Clean([]*Segment) ([]*Segment, error)
}

type CommitLog

type CommitLog struct {
	Options
	// contains filtered or unexported fields
}

func New

func New(opts Options) (*CommitLog, error)

func (*CommitLog) Append

func (l *CommitLog) Append(b []byte) (offset int64, err error)

func (*CommitLog) Close

func (l *CommitLog) Close() error

func (*CommitLog) DeleteAll

func (l *CommitLog) DeleteAll() error

func (*CommitLog) Init

func (l *CommitLog) Init() error

func (*CommitLog) NewReader

func (l *CommitLog) NewReader(offset int64, maxBytes int32) (io.Reader, error)

func (*CommitLog) NewestOffset

func (l *CommitLog) NewestOffset() int64

func (*CommitLog) OldestOffset

func (l *CommitLog) OldestOffset() int64

func (*CommitLog) Open

func (l *CommitLog) Open() error

func (*CommitLog) Read

func (l *CommitLog) Read(p []byte) (n int, err error)

func (*CommitLog) Segments

func (l *CommitLog) Segments() []*Segment

func (*CommitLog) TruncateTo

func (l *CommitLog) TruncateTo(offset int64) error

type DeleteCleaner

type DeleteCleaner struct {
	Retention struct {
		Bytes int64
	}
}

func NewDeleteCleaner

func NewDeleteCleaner(bytes int64) *DeleteCleaner

func (*DeleteCleaner) Clean

func (c *DeleteCleaner) Clean(segments []*Segment) ([]*Segment, error)

type Entry

type Entry struct {
	Offset   int64
	Position int64
}

type Message

type Message []byte

func NewMessage

func NewMessage(p []byte) Message

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 Options

type Options struct {
	Path            string
	MaxSegmentBytes int64
	MaxLogBytes     int64
}

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

type Segment

type Segment struct {
	Index      *index
	BaseOffset int64
	NextOffset int64
	Position   int64

	sync.Mutex
	// contains filtered or unexported fields
}

func NewSegment

func NewSegment(path string, baseOffset int64, maxBytes int64) (*Segment, error)

func (*Segment) Close

func (s *Segment) Close() error

func (*Segment) Delete

func (s *Segment) Delete() error

func (*Segment) IsFull

func (s *Segment) IsFull() bool

func (*Segment) Read

func (s *Segment) Read(p []byte) (n int, err error)

func (*Segment) ReadAt

func (s *Segment) ReadAt(p []byte, off int64) (n int, err error)

func (*Segment) SetupIndex

func (s *Segment) SetupIndex(path string) (err error)

func (*Segment) Write

func (s *Segment) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL