Documentation ¶
Index ¶
- Variables
- func EncodeEntry(w io.WriteSeeker, e *Entry) (int64, error)
- func EncodeIndex(w io.WriteSeeker, e *Index) (int64, error)
- func Offset(rw io.ReadWriteSeeker) (int64, error)
- type Batch
- type Entry
- type Index
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Offset() (int64, error)
- func (r *Reader) ReadEntry() (*Entry, error)
- func (r *Reader) ReadEntryAt(offset int64) (*Entry, error)
- func (r *Reader) ReadFrom(path string) (*Reader, error)
- func (r *Reader) ReadIndex() (*Index, error)
- func (r *Reader) ReadIndexAt(offset int64) (*Index, error)
- func (r *Reader) Seek(offset int64, whence int) (int64, error)
- type Writer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func EncodeEntry ¶
func EncodeEntry(w io.WriteSeeker, e *Entry) (int64, error)
EncodeEntry writes the provided entry to the writer provided
func EncodeIndex ¶
func EncodeIndex(w io.WriteSeeker, e *Index) (int64, error)
EncodeIndex encodes and writes the provided entry index to w
Types ¶
type Batch ¶ added in v1.3.1
type Batch struct {
Entries []*Entry
}
func (*Batch) WriteEntry ¶ added in v1.3.1
type Entry ¶
Entry is a key-value data entry
func DecodeEntry ¶
DecodeEntry encodes the next entry from the reader provided
func DecodeEntryAt ¶
DecodeEntryAt decodes the entry from the reader provided at the offset provided
func (*Entry) CheckSize ¶ added in v1.7.0
CheckSize take a maximum key and maximum value size and checks to ensure the entry key and value do not exceed the specified max sizes. It returns a nil error if all is okay, otherwise ErrKeyTooLarge or ErrValueTooLarge
type Index ¶
Index is a binary entry index
func DecodeIndex ¶
DecodeIndex reads and decodes the provided entry index from r
func DecodeIndexAt ¶
DecodeIndexAt decodes the index at the provided offset using the provided reader
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader provides a read-only file descriptor
func OpenReader ¶
OpenReader returns a *reader for the file at the provided path
func (*Reader) ReadEntryAt ¶
ReadEntryAt reads the encoded entry at the offset provided
func (*Reader) ReadFrom ¶
ReadFrom checks the given path and if it matches, simply returns the same reader, but if it is different it opens a new one recycling the same file descriptor. this allows you to read from multiple files fairly quickly and pain free.
func (*Reader) ReadIndexAt ¶
ReadIndexAt reads the encoded entry index at the offset provided
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer provides a write-only file descriptor
func OpenWriter ¶
OpenWriter returns a *writer for the file at the provided path
func (*Writer) SetSyncOnWrite ¶
func (*Writer) WriteEntry ¶
WriteEntry writes the provided entry to disk