kvs

package module
v0.0.0-...-2b321fe Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

kvs

Key-Value store for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Key value store Use the Open() method to create one, and Close() it when done

func Open

func Open(path string) (*Store, error)

Open a key-value store "path" is the full path to the database file, any leading directories must have been created already File is created with mode 0640 if needed Because of BoltDB restrictions, only one process may open the file at a time Attempts to open the file from another process will fail with a timeout error

func (*Store) Close

func (kvs *Store) Close() error

Closes the key-value store file

func (*Store) Delete

func (kvs *Store) Delete(key string) error

Delete the entry with the given key If no such key is present in the store, it returns error

func (*Store) Get

func (kvs *Store) Get(key string, value interface{}) error

Get the entry from the store "value" must be a pointer-typed If the key is missing in the store, Get returns an error The value passed to Get() can be nil, in which case any value read from the store is silently discarded

func (*Store) Put

func (kvs *Store) Put(key string, value interface{}) error

Put the entry in the storage The passed value is gob-encoded and stored The key can be an empty string, but the value cannot be nil - if it is, an error is returned

Jump to

Keyboard shortcuts

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