internal

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 18 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 ConfigureMemPool added in v0.3.1

func ConfigureMemPool(maxConcurrency *int)

ConfigureMemPool configurate the mempool accordingly

func DirSize added in v0.2.2

func DirSize(path string) (int64, error)

func Exists added in v0.2.2

func Exists(path string) bool

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) Load added in v0.2.2

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

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