Code Review
/
ric-plt
/
xapp-frame.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add support for MEID
[ric-plt/xapp-frame.git]
/
pkg
/
xapp
/
db.go
diff --git
a/pkg/xapp/db.go
b/pkg/xapp/db.go
index
36fbfc1
..
542c755
100755
(executable)
--- a/
pkg/xapp/db.go
+++ b/
pkg/xapp/db.go
@@
-34,10
+34,10
@@
var SDLCounterOpts = []CounterOpts{
}
type SDLClient struct {
}
type SDLClient struct {
- db
*sdl.SdlInstance
- stat
map[string]Counter
- mux
sync.Mutex
- ready
bool
+ db *sdl.SdlInstance
+ stat map[string]Counter
+ mux sync.Mutex
+ ready bool
}
type RNIBClient struct {
}
type RNIBClient struct {
@@
-47,8
+47,8
@@
type RNIBClient struct {
// NewSDLClient returns a new SDLClient.
func NewSDLClient(ns string) *SDLClient {
return &SDLClient{
// NewSDLClient returns a new SDLClient.
func NewSDLClient(ns string) *SDLClient {
return &SDLClient{
- db: sdl.NewSdlInstance(ns, sdl.NewDatabase()),
- stat: Metric.RegisterCounterGroup(SDLCounterOpts, "SDL"),
+ db:
sdl.NewSdlInstance(ns, sdl.NewDatabase()),
+ stat:
Metric.RegisterCounterGroup(SDLCounterOpts, "SDL"),
ready: false,
}
}
ready: false,
}
}
@@
-70,8
+70,8
@@
func (s *SDLClient) IsReady() bool {
return s.ready
}
return s.ready
}
-func (s *SDLClient)
Store(key string, value
interface{}) (err error) {
- err = s.db.Set(
key, value
)
+func (s *SDLClient)
doSet(pairs ...
interface{}) (err error) {
+ err = s.db.Set(
pairs
)
if err != nil {
s.UpdateStatCounter("StoreError")
} else {
if err != nil {
s.UpdateStatCounter("StoreError")
} else {
@@
-80,9
+80,24
@@
func (s *SDLClient) Store(key string, value interface{}) (err error) {
return
}
return
}
+func (s *SDLClient) Store(key string, value interface{}) (err error) {
+ return s.doSet(key, value)
+}
+
+func (s *SDLClient) MStore(pairs ...interface{}) (err error) {
+ return s.doSet(pairs)
+}
+
func (s *SDLClient) Read(key string) (value map[string]interface{}, err error) {
func (s *SDLClient) Read(key string) (value map[string]interface{}, err error) {
- value, err = s.db.Get([]string{key})
- return
+ return s.db.Get([]string{key})
+}
+
+func (s *SDLClient) MRead(key []string) (value map[string]interface{}, err error) {
+ return s.db.Get(key)
+}
+
+func (s *SDLClient) ReadAllKeys(key string) (value []string, err error) {
+ return s.db.GetAll()
}
func (s *SDLClient) Subscribe(cb func(string, ...string), channel string) error {
}
func (s *SDLClient) Subscribe(cb func(string, ...string), channel string) error {