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-2023, NVIDIA CORPORATION. All rights reserved.
Index ¶
- Constants
- func ParsePath(path string) (string, string)
- type BuntDriver
- func (bd *BuntDriver) Close() error
- func (bd *BuntDriver) Delete(collection, key string) error
- func (bd *BuntDriver) DeleteCollection(collection string) error
- func (bd *BuntDriver) Get(collection, key string, object any) error
- func (bd *BuntDriver) GetAll(collection, pattern string) (map[string]string, error)
- func (bd *BuntDriver) GetString(collection, key string) (string, error)
- func (bd *BuntDriver) List(collection, pattern string) ([]string, error)
- func (bd *BuntDriver) Set(collection, key string, object any) error
- func (bd *BuntDriver) SetString(collection, key, data string) error
- type Driver
Constants ¶
View Source
const CollectionSepa = "##"
Variables ¶
This section is empty.
Functions ¶
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) 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) 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)
}
Click to show internal directories.
Click to hide internal directories.