Documentation
¶
Index ¶
- Constants
- Variables
- func MinOffset(offsets map[int64]struct{}) int64
- func Size(m Message, v Version) int64
- type Message
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Consume(position, maxPosition int64, maxCount int64) ([]Message, error)
- func (r *Reader) Get(position int64) (msg Message, err error)
- func (r *Reader) InitialPosition() int64
- func (r *Reader) Read(position int64) (msg Message, nextPosition int64, err error)
- func (r *Reader) Version() Version
- type Version
- type Writer
Constants ¶
View Source
const ( // OffsetOldest represents the smallest offset still available // Use it to consume all messages, starting at the first available OffsetOldest int64 = -2 // OffsetNewest represents the offset that will be used for the next produce // Use it to consume only new messages OffsetNewest int64 = -1 // OffsetInvalid is the offset returned when error is detected OffsetInvalid int64 = -3 )
View Source
const HeaderSize = int64(len(magic) + 2) // magic + Version byte + reserved byte
Variables ¶
View Source
var ( VUnknown = Version{} V1 = Version{/* contains filtered or unexported fields */} V2 = Version{/* contains filtered or unexported fields */} VLast Version = V2 // always last version )
View Source
var (
ErrCorrupted = errors.New("log corrupted")
)
View Source
var ErrInvalidOffset = errors.New("invalid offset")
View Source
var ErrNotFound = errors.New("not found")
View Source
var Invalid = Message{Offset: OffsetInvalid}
Functions ¶
Types ¶
type Reader ¶
type Reader struct {
Path string
// contains filtered or unexported fields
}
func (*Reader) InitialPosition ¶
type Writer ¶
type Writer struct {
Path string
// contains filtered or unexported fields
}
func OpenWriter ¶
func (*Writer) SyncAndClose ¶
Click to show internal directories.
Click to hide internal directories.