golkeyvalNS

package
v0.0.0-...-1bfd785 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NSDBEngines = make(map[string]NSDBEngine)

DBEngines acts as map for all available db-engines.

View Source
var (
	NamespaceSeparator = ":"
)
NameSpaceSeparator could be modified if something other than colon-char ":"

is to be used as separator symbol for NameSpace.

Functions

func RegisterNSDBEngine

func RegisterNSDBEngine(name string, nsDbEngine NSDBEngine)

RegisterDBEngine gets used by adapters to register themselves.

Types

type Delimited

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

Delimited struct with required db details. Delimited is just easy quick namespacing style around stores with just key-val support like leveldb, such. Not to be opted for performance oriented use-cases.

func (*Delimited) Configure

func (delimited *Delimited) Configure(db golkeyval.DBEngine)

Configure populates Delimited required configs.

func (*Delimited) CreateNS

func (delimited *Delimited) CreateNS(key string) bool

CreateNS updates entry with its trail of namespace given a keyname.

func (*Delimited) DelKey

func (delimited *Delimited) DelKey(key string) bool

func (*Delimited) DeleteNS

func (delimited *Delimited) DeleteNS(key string) bool

DeleteNS deletes a namespace with all direct children with no further children and unroots it. For nodes with children, it just delete baselevel value, doesn't unroot.

func (*Delimited) DeleteNSKey

func (delimited *Delimited) DeleteNSKey(key string) bool

DeleteNSKey directly deletes a child key-val and unroot it from parent.

func (*Delimited) DeleteNSRecursive

func (delimited *Delimited) DeleteNSRecursive(key string) bool

DeleteNSRecursive to delete a namespace with all children below and unroot it.

func (*Delimited) GetVal

func (delimited *Delimited) GetVal(key string) string

func (*Delimited) PushKeyVal

func (delimited *Delimited) PushKeyVal(key string, val string) bool

func (*Delimited) PushNS

func (delimited *Delimited) PushNS(key string, val string) bool

PushNS feeds in namespace entries given namespace key and val.

func (*Delimited) ReadNS

func (delimited *Delimited) ReadNS(key string) golhashmap.HashMap

ReadNS reads all direct child values in a given NameSpace For e.g.:

given keys a, a:b, a:b:1, a:b:2, a:b:2:3
reads for a:b:1, a:b:2 if queried for a:b

func (*Delimited) ReadNSRecursive

func (delimited *Delimited) ReadNSRecursive(key string) golhashmap.HashMap

ReadNSRecursive reads all values belonging to tree below given NameSpace For e.g.:

given keys a, a:b, a:b:1, a:b:2, a:b:2:3
reads for a:b:1, a:b:2, a:b:2:3 if queried for a:b

func (*Delimited) UnrootNS

func (delimited *Delimited) UnrootNS(key string) bool

UnrootNS update key's presence from it's parent's group-val of child key names.

type NSDBEngine

type NSDBEngine interface {
	Configure(db golkeyval.DBEngine)
	PushNS(key string, val string) bool
	ReadNS(key string) golhashmap.HashMap
	ReadNSRecursive(key string) golhashmap.HashMap
	DeleteNSKey(key string) bool
	DeleteNS(key string) bool
	DeleteNSRecursive(key string) bool
	// golkeyval proxy func
	PushKeyVal(key string, val string) bool
	GetVal(key string) string
	DelKey(key string) bool
}

DBEngine interface enables adapter feature for a key-val oriented DB.

func GetNSDBEngine

func GetNSDBEngine(name string) NSDBEngine

GetDBEngine gets used by client to fetch a required db-engine.

Jump to

Keyboard shortcuts

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