Documentation
¶
Index ¶
- func ArrayIntersect(a, b []string) []string
- func CheckResults(jsres, jsexpected []byte) error
- func DeSerializeStore(s Store, jsBuffer []byte) error
- func GenerateKey(key, val string) string
- func InitializeStore(s Store, cfg Config) error
- func QueryStore(s Store, jsQuery []byte) ([]byte, error)
- func SerializeStore(s Store) ([]byte, error)
- func ShutdownStore(s Store) error
- func UpdateStore(s Store, byt []byte) error
- type BadgerStore
- type BoltStore
- type BoltStoreConfig
- type Config
- type InMemoryStore
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayIntersect ¶
ArrayIntersect Performs Intersection of two string array intersection of (m1, m3) (m1, m4) = (m1) any empty array results in no results
func CheckResults ¶
CheckResults current vs expected to error in case there is a mismatch
func DeSerializeStore ¶
DeSerializeStore deserializes JSON and Updates current store useful to restore store or for updating alternate store {"key1" : {"propkey1" : "propvalue1", "propkey2" : "propvalue2"}, "key2" ...}
func GenerateKey ¶
GenerateKey returns hash of key value used as a Store Key
func InitializeStore ¶
InitializeStore with optional configuration
func QueryStore ¶
QueryStore with single/multiple properties Properties are AND only, if an OR is required, query multiple times OR could be supported, but keeping it simple for now
func SerializeStore ¶
SerializeStore to JSON useful to backup store or for syncing to other stores {"propkey1:propvalue1" : ["key1", "key2"], "propkey2:propvalue2" : ["key2"] ...}
func ShutdownStore ¶
ShutdownStore to close any open file handles, or flush keys to store
func UpdateStore ¶
UpdateStore called with list of Key and Associated properties Check for consistncy of input json Converts {"m1": {"num": "6.13","strs": "a","key1": "b"}, "m2": {"num": "6.13","key1": "bddd"}} To {"num:6.13" : ["m1", m2"], "strs:a" : ["m1"], "key1:b" : ["m1"], "key1:bddd" : ["m2"]}
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
BadgerStore store for db
func (*BadgerStore) Initialize ¶
func (s *BadgerStore) Initialize(cfg Config) error
Initialize Store with custom configuration
func (*BadgerStore) Query ¶
func (s *BadgerStore) Query(key string) ([]string, error)
Query for key, return value would be a list of keys associated with the property
func (*BadgerStore) Serialize ¶
func (s *BadgerStore) Serialize() (map[string][]string, error)
Serialize store to backup, could be optionally compressed
func (*BadgerStore) Shutdown ¶
func (s *BadgerStore) Shutdown() error
Shutdown db, by closing all the open handles
func (*BadgerStore) Update ¶
func (s *BadgerStore) Update(key, value string) error
Update db with key value pair
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
BoltStore (Key, Value), value in JSON format
func (*BoltStore) Initialize ¶
Initialize Store with custom configuration
func (*BoltStore) Query ¶
Query for key, return value would be a list of keys associated with the property
type BoltStoreConfig ¶
BoltStoreConfig configuration for path, filemode and options
type Config ¶
type Config interface {
}
Config provides a interface for stores to have additional config provided during initialization Example: boltdb/badgerdb could provide directory name to store the db
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore is Concurrent friendly Store Map of Property and List of Keys associated with that property
func (*InMemoryStore) Initialize ¶
func (s *InMemoryStore) Initialize(cfg Config) error
Initialize Store with custom configuration
func (*InMemoryStore) Query ¶
func (s *InMemoryStore) Query(key string) ([]string, error)
Query for key, return value would be a list of keys associated with the property
func (*InMemoryStore) Serialize ¶
func (s *InMemoryStore) Serialize() (map[string][]string, error)
Serialize store to backup, could be optionally compressed
func (*InMemoryStore) Shutdown ¶
func (s *InMemoryStore) Shutdown() error
Shutdown -Not much to do since its inmemory
func (*InMemoryStore) Update ¶
func (s *InMemoryStore) Update(key, value string) error
Update key value pair