storage

package module
v0.0.0-...-00a2d2b Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2018 License: Apache-2.0 Imports: 1 Imported by: 2

README

storage

Make go-nemo package better use

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option is prophet create option

func WithNemoDataPath

func WithNemoDataPath(nemoDataPath string) Option

WithNemoDataPath using nemo data path

func WithNemoOptions

func WithNemoOptions(nemoOptions string) Option

WithNemoOptions using nemo configuration file

type Storage

type Storage interface {
	// Set store the key,value
	Set(key []byte, value []byte, sync bool) error
	// Get returns the value
	Get(key []byte) ([]byte, error)
	// Delete deletes the key, if `sync` is true, will flush the disk immediate
	Delete(key []byte, sync bool) error
	// RangeDelete deletes the range [start,end) values
	RangeDelete(start, end []byte) error
	// Seek returns the first key >= given key, if no found, return None.
	Seek(key []byte) ([]byte, []byte, error)
	// Scan scans the range [start, end) and execute the handler func.
	// returns false means end the scan.
	Scan(start, end []byte, handler func(key, value []byte) (bool, error)) error
	// ScanWithPooledKey scans the range [start, end) and execute the handler func.
	// returns false means end the scan.
	ScanWithPooledKey(start, end []byte, handler func(key, value []byte) (bool, error), pooledKey bool) error
	// Free free the pooled bytes
	Free(pooled []byte)
	// NewWriteBatch returns a writebatch
	NewWriteBatch() WriteBatch
	// Write writes the writebatch
	Write(wb WriteBatch, sync bool) error
}

Storage is the storage

func NewStorage

func NewStorage(opts ...Option) Storage

NewStorage returns a storage using options

type WriteBatch

type WriteBatch interface {
	Delete(key []byte) error
	Set(key []byte, value []byte) error
}

WriteBatch batch operation

Jump to

Keyboard shortcuts

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