kvdb

package
v1.3.19 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package kvdb provides a local key/value database server for AIS.

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Package kvdb provides a local key/value database server for AIS.

  • Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.

Index

Constants

View Source
const CollectionSepa = "##"

Variables

This section is empty.

Functions

func IsErrNotFound

func IsErrNotFound(err error) bool

func ParsePath

func ParsePath(path string) (string, string)

Extract collection and key names from full key path

Types

type BuntDriver

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

func NewBuntDB

func NewBuntDB(path string) (*BuntDriver, error)

func (*BuntDriver) Close

func (bd *BuntDriver) Close() error

func (*BuntDriver) Delete

func (bd *BuntDriver) Delete(collection, key string) error

func (*BuntDriver) DeleteCollection

func (bd *BuntDriver) DeleteCollection(collection string) error

func (*BuntDriver) Get

func (bd *BuntDriver) Get(collection, key string, object any) error

func (*BuntDriver) GetAll

func (bd *BuntDriver) GetAll(collection, pattern string) (map[string]string, error)

func (*BuntDriver) GetString

func (bd *BuntDriver) GetString(collection, key string) (string, error)

func (*BuntDriver) List

func (bd *BuntDriver) List(collection, pattern string) ([]string, error)

func (*BuntDriver) Set

func (bd *BuntDriver) Set(collection, key string, object any) error

func (*BuntDriver) SetString

func (bd *BuntDriver) SetString(collection, key, data string) error

type Driver

type Driver interface {
	// A driver should sync data with local drives on close
	Close() error
	// Write an object to database. Object is marshaled as JSON
	Set(collection, key string, object any) error
	// Read an object from database.
	Get(collection, key string, object any) error
	// Write an already marshaled object or simple string
	SetString(collection, key, data string) error
	// Read a string or an object as JSON from database
	GetString(collection, key string) (string, error)
	// Delete a single object
	Delete(collection, key string) error
	// Delete a collection. It iterates over all subkeys of key
	// `collection` and removes them one by one.
	DeleteCollection(collection string) error
	// Return subkeys of a collection(`key` is empty string) or a key.
	// Pattern is an arbitrary string and may contain '*' and '?' wildcards.
	// If a pattern does not include wildcards, the pattern is uses as a prefix.
	List(collection, pattern string) ([]string, error)
	// Return subkeys with their values: map[key]value
	GetAll(collection, pattern string) (map[string]string, error)
}

type ErrNotFound

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

func NewErrNotFound

func NewErrNotFound(collection, key string) *ErrNotFound

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

Jump to

Keyboard shortcuts

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