database

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbClient

type DbClient struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DbClient is database client

func NewDbClient

func NewDbClient() *DbClient

NewDbClient returns new database client

func (*DbClient) Add

func (c *DbClient) Add(path string, entry *decoder.FileDataEntry)

Add puts new entry to the database, or updates the old one if given key already exists

func (*DbClient) Delete

func (c *DbClient) Delete(path, key string)

Delete removes key in given path.

func (*DbClient) DeleteFile

func (c *DbClient) DeleteFile(path string)

DeleteFile removes file entry including all keys within

func (*DbClient) GetDataForFile

func (c *DbClient) GetDataForFile(path string) []*decoder.FileDataEntry

GetDataForFile returns a map of key-value entries from given file

func (*DbClient) GetDataForKey

func (c *DbClient) GetDataForKey(key string) (*decoder.FileDataEntry, bool)

GetDataForKey returns data for given key.

func (*DbClient) GetDataForPrefix

func (c *DbClient) GetDataForPrefix(prefix string) []*decoder.FileDataEntry

GetDataForPrefix returns all values which match provided prefix

type FilesSystemDB

type FilesSystemDB interface {
	// Add new key-value data under provided path (path represents file). Newly added data are stored with initial
	// revision, existing entries are updated
	Add(path string, entry *decoder.FileDataEntry)
	// Delete removes key-value data from provided file
	Delete(path, key string)
	// Delete file removes file entry from database, together with all underlying key-value data
	DeleteFile(path string)
	// GetValuesForPrefix filters the whole database and returns a map of key-value data
	GetDataForPrefix(prefix string) []*decoder.FileDataEntry
	// GetDataFromFile returns all the configuration for specific file
	GetDataForFile(path string) []*decoder.FileDataEntry
	// GetDataForKey returns data for key with flag whether the data was found or not
	GetDataForKey(key string) (*decoder.FileDataEntry, bool)
}

FilesSystemDB provides methods to manipulate internal filesystem database

Jump to

Keyboard shortcuts

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