kvdb

package
v1.3.22 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

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

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

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

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

Index

Constants

View Source
const CollectionSepa = "##"

Variables

This section is empty.

Functions

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)
}

Jump to

Keyboard shortcuts

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