SDL CLI 'get' reads keys data in the given namespace
[ric-plt/sdlgo.git] / internal / cli / types.go
index ad942c8..53953a8 100644 (file)
 
 package cli
 
-//Name of the SDL CLI application
+import "gerrit.o-ran-sc.org/r/ric-plt/sdlgo/internal/sdlgoredis"
+
+//iDatabase is an interface towards database backend, for the time being
+//sdlgoredis.DB implements this interface.
+type iDatabase interface {
+       Info() (*sdlgoredis.DbInfo, error)
+       State() (*sdlgoredis.DbState, error)
+}
+
+//Database struct is a holder for the internal database instances.
+type Database struct {
+       Instances []iDatabase
+}
+
+//DbCreateCb callback function type to create a new database
+type DbCreateCb func() *Database
+
+//iSyncStorage is an interface towards SDL SyncStorage API
+type ISyncStorage interface {
+       Get(ns string, keys []string) (map[string]interface{}, error)
+       ListKeys(ns string, pattern string) ([]string, error)
+       Set(ns string, pairs ...interface{}) error
+       Remove(ns string, keys []string) error
+}
+
+//SyncStorageCreateCb callback function type to create a new SyncStorageInterface
+type SyncStorageCreateCb func() ISyncStorage
+
+//keysArgs struct is used for keys command arguments.
+type keysArgs struct {
+       ns      string
+       pattern string
+}
+
+//newKeysArgs constructs a new keysArgs struct.
+func newKeysArgs(ns string, pattern string) keysArgs {
+       return keysArgs{
+               ns:      ns,
+               pattern: pattern,
+       }
+}
+
+//SdlCliApp constant defines the name of the SDL CLI application
 const SdlCliApp = "sdlcli"