internal

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDatafileFilename = "%09d.data"
)

Variables

View Source
var (
	ErrReadonly  = errors.New("error: read only datafile")
	ErrReadError = errors.New("error: read error")
)
View Source
var (
	// Version release version
	Version = "0.0.1"

	// Commit will be overwritten automatically by the build system
	Commit = "HEAD"
)

Functions

func FullVersion

func FullVersion() string

FullVersion returns the full version and commit hash

func GetDatafiles

func GetDatafiles(path string) ([]string, error)

func NewEntry

func NewEntry(key string, value []byte) pb.Entry

func ParseIds

func ParseIds(fns []string) ([]int, error)

Types

type Datafile

type Datafile struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDatafile

func NewDatafile(path string, id int, readonly bool) (*Datafile, error)

func (*Datafile) Close

func (df *Datafile) Close() error

func (*Datafile) FileID

func (df *Datafile) FileID() int

func (*Datafile) Name

func (df *Datafile) Name() string

func (*Datafile) Read

func (df *Datafile) Read() (e pb.Entry, n int64, err error)

func (*Datafile) ReadAt

func (df *Datafile) ReadAt(index, size int64) (e pb.Entry, err error)

func (*Datafile) Size

func (df *Datafile) Size() int64

func (*Datafile) Sync

func (df *Datafile) Sync() error

func (*Datafile) Write

func (df *Datafile) Write(e pb.Entry) (int64, int64, error)

type Item

type Item struct {
	FileID int
	Offset int64
	Size   int64
}

type Keydir

type Keydir struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewKeydir

func NewKeydir() *Keydir

func NewKeydirFromBytes

func NewKeydirFromBytes(r io.Reader) (*Keydir, error)

func (*Keydir) Add

func (k *Keydir) Add(key string, fileid int, offset, size int64) Item

func (*Keydir) Bytes

func (k *Keydir) Bytes() ([]byte, error)

func (*Keydir) Delete

func (k *Keydir) Delete(key string)

func (*Keydir) Get

func (k *Keydir) Get(key string) (Item, bool)

func (*Keydir) Keys

func (k *Keydir) Keys() chan string

func (*Keydir) Len

func (k *Keydir) Len() int

func (*Keydir) Save

func (k *Keydir) Save(fn string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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