X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Fsdl.go;h=f179975bf9e30510715a0c4ff415f03118428a49;hb=4abf18056b1674fb284c4d7d753c35a3ddab37e4;hp=ecf6a8554aebf5ba76f11ca7f170f0f0fba083d2;hpb=f073592e0c568bea4eaf71fe2659a4dd4fd573db;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/sdl.go b/pkg/control/sdl.go index ecf6a85..f179975 100644 --- a/pkg/control/sdl.go +++ b/pkg/control/sdl.go @@ -68,6 +68,7 @@ func (c *Control) WriteSubscriptionToSdl(subId uint32, subs *Subscription) error } if err = c.db.Set(strconv.FormatUint(uint64(subId), 10), jsonData); err != nil { + c.UpdateCounter(cSDLWriteFailure) return fmt.Errorf("SDL: WriteSubscriptionToSdl(): %s", err.Error()) } else { xapp.Logger.Debug("SDL: Subscription written in db. subId = %v", subId) @@ -81,6 +82,7 @@ func (c *Control) ReadSubscriptionFromSdl(subId uint32) (*Subscription, error) { key := strconv.FormatUint(uint64(subId), 10) retMap, err := c.db.Get([]string{key}) if err != nil { + c.UpdateCounter(cSDLReadFailure) return nil, fmt.Errorf("SDL: ReadSubscriptionFromSdl(): %s", err.Error()) } else { xapp.Logger.Debug("SDL: Subscription read from db. subId = %v", subId) @@ -162,6 +164,7 @@ func (c *Control) ReadAllSubscriptionsFromSdl() ([]uint32, map[uint32]*Subscript // Get all keys keys, err := c.db.GetAll() if err != nil { + c.UpdateCounter(cSDLReadFailure) return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), GetAll(). Error while reading keys from DBAAS %s\n", err.Error()) } @@ -172,6 +175,7 @@ func (c *Control) ReadAllSubscriptionsFromSdl() ([]uint32, map[uint32]*Subscript // Get all subscriptionInfos iSubscriptionMap, err := c.db.Get(keys) if err != nil { + c.UpdateCounter(cSDLReadFailure) return nil, nil, fmt.Errorf("SDL: ReadAllSubscriptionsFromSdl(), Get(): Error while reading subscriptions from DBAAS %s\n", err.Error()) } @@ -216,6 +220,7 @@ func removeNumber(s []uint32, removedNum uint32) ([]uint32, error) { func (c *Control) RemoveAllSubscriptionsFromSdl() error { if err := c.db.RemoveAll(); err != nil { + c.UpdateCounter(cSDLRemoveFailure) return fmt.Errorf("SDL: RemoveAllSubscriptionsFromSdl(): %s\n", err.Error()) } else { xapp.Logger.Debug("SDL: All subscriptions removed from db")