database

package
v0.0.0-...-4d39105 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {

	// Central lock is required for Set/Delete operations. Could be possible
	// to do key-level locking which would allow update Set operations to not
	// take a global lock, but not doing that for now.
	sync.RWMutex
	// contains filtered or unexported fields
}

Database is the main interface for data storage and access for callers.

func New

func New() *Database

New creates a new Database struct, loads any available data from disk, schedules regular checkpointing, then returns a pointer to the Database indicating it is ready to serve requests.

func (*Database) Delete

func (s *Database) Delete(msg *rpc.Msg)

Delete removes the value for the provided key.

func (*Database) Get

func (s *Database) Get(msg *rpc.Msg) (rpc.ValueType, error)

Get stores returns the value for provided key. If not present in the Database then an error is returned instead.

func (*Database) Set

func (s *Database) Set(msg *rpc.Msg)

Set updates the value for provided key. If not already present the value is silently added.

Jump to

Keyboard shortcuts

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