Fix for DB read after VM restart and REST subscription query aded
[ric-plt/submgr.git] / pkg / control / registry.go
index 2495d3b..72a2100 100644 (file)
@@ -20,6 +20,7 @@
 package control
 
 import (
+       "encoding/json"
        "fmt"
        "sync"
        "time"
@@ -104,6 +105,16 @@ func (r *Registry) Initialize() {
        }
 }
 
+func (r *Registry) GetAllRestSubscriptions() []byte {
+       r.mutex.Lock()
+       defer r.mutex.Unlock()
+       restSubscriptionsJson, err := json.Marshal(r.restSubscriptions)
+       if err != nil {
+               xapp.Logger.Error("GetAllRestSubscriptions(): %v", err)
+       }
+       return restSubscriptionsJson
+}
+
 func (r *Registry) CreateRESTSubscription(restSubId *string, xAppRmrEndPoint *string, maid *string) (*RESTSubscription, error) {
        r.mutex.Lock()
        defer r.mutex.Unlock()