persistentmemorydriver

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFilemode = 0644

DefaultFilemode indicates the default filemode

View Source
const DefaultFilename = "unikv.memory.bin"

DefaultFilename indicates the default filename for this driver to use

View Source
const Version = 1

Version declares the version of unikv which this driver supports

Variables

View Source
var Descriptor = &unikv.DriverDescriptor{
	Name:        "persistent-memory",
	Constructor: Constructor,
}

Descriptor describes memory driver

Functions

func Constructor

func Constructor(prefix string, ctx unikv.DriverContextRaw) (unikv.Driver, error)

Constructor constructs new memory drivers

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver is the memorydriver

func NewDriver

func NewDriver(prefix string, ctx *DriverContext) (*Driver, error)

NewDriver creates a driver

func (*Driver) Close

func (d *Driver) Close() error

Close closes driver

func (*Driver) Commit

func (d *Driver) Commit() error

Commit commits changes to file

func (*Driver) Get

func (d *Driver) Get(key string) (string, error)

Get gets data

func (*Driver) List added in v0.3.0

func (d *Driver) List() (interface{}, error)

List lists the keys

func (*Driver) Load

func (d *Driver) Load() error

Load loads data from file

func (*Driver) Put

func (d *Driver) Put(key string, value string) error

Put puts data

func (*Driver) Unset

func (d *Driver) Unset(key string) error

Unset unsets data

type DriverContext

type DriverContext struct {
	Filename      string `json:"filename"`
	Filemode      int    `json:"filemode"`
	CommitWhenPut bool   `json:"commit_when_put"`
	LoadWhenGet   bool   `json:"load_when_get"`
}

DriverContext defines the driver context

Jump to

Keyboard shortcuts

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