X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Ftransaction.go;h=c7ca81258eb02c7e8684e2137ca4cb1342a75836;hb=fbd4df5c352abde2ca4c0867f7471a0050242fdb;hp=df4d7db4147a34c101a05330b2d5a3184bb5dd74;hpb=a9bf76cb8dec6e52e7699edf1631c214647f8beb;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/transaction.go b/pkg/control/transaction.go index df4d7db..c7ca812 100644 --- a/pkg/control/transaction.go +++ b/pkg/control/transaction.go @@ -46,14 +46,17 @@ type Transaction struct { Seq uint64 //transaction sequence tracker *Tracker //tracker instance Meid *xapp.RMRMeid //meid transaction related - ReqId RequestId // Mtype int //Encoded message type to be send Payload *e2ap.PackedData //Encoded message to be send EventChan chan interface{} } func (t *Transaction) String() string { - return "trans(" + strconv.FormatUint(uint64(t.Seq), 10) + "/" + t.Meid.RanName + "/" + t.ReqId.String() + ")" + meidstr := "N/A" + if t.Meid != nil { + meidstr = t.Meid.String() + } + return "trans(" + strconv.FormatUint(uint64(t.Seq), 10) + "/" + meidstr + ")" } func (t *Transaction) SendEvent(event interface{}, waittime time.Duration) (bool, bool) { @@ -83,12 +86,6 @@ func (t *Transaction) WaitEvent(waittime time.Duration) (interface{}, bool) { return event, false } -func (t *Transaction) GetReqId() *RequestId { - t.mutex.Lock() - defer t.mutex.Unlock() - return &t.ReqId -} - func (t *Transaction) GetMtype() int { t.mutex.Lock() defer t.mutex.Unlock() @@ -132,7 +129,7 @@ func (t *TransactionSubs) Release() { // //----------------------------------------------------------------------------- type TransactionXappKey struct { - RmrEndpoint + xapp.RmrEndpoint Xid string // xapp xid in req } @@ -144,8 +141,9 @@ func (key *TransactionXappKey) String() string { // //----------------------------------------------------------------------------- type TransactionXapp struct { - Transaction // - XappKey *TransactionXappKey // + Transaction + XappKey *TransactionXappKey + RequestId e2ap.RequestId } func (t *TransactionXapp) String() string { @@ -153,10 +151,10 @@ func (t *TransactionXapp) String() string { if t.XappKey != nil { transkey = t.XappKey.String() } - return "transxapp(" + t.Transaction.String() + "/" + transkey + ")" + return "transxapp(" + t.Transaction.String() + "/" + transkey + "/" + strconv.FormatUint(uint64(t.RequestId.InstanceId), 10) + ")" } -func (t *TransactionXapp) GetEndpoint() *RmrEndpoint { +func (t *TransactionXapp) GetEndpoint() *xapp.RmrEndpoint { t.mutex.Lock() defer t.mutex.Unlock() if t.XappKey != nil { @@ -183,6 +181,12 @@ func (t *TransactionXapp) GetSrc() string { return "" } +func (t *TransactionXapp) GetSubId() uint32 { + t.mutex.Lock() + defer t.mutex.Unlock() + return t.RequestId.InstanceId +} + func (t *TransactionXapp) Release() { t.mutex.Lock() xapp.Logger.Debug("RELEASE %s", t.String())