X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pkg%2Fcontrol%2Ftransaction.go;h=f722d11d368cc6cf2584fe4e4a62d6f0dcedbc8e;hb=2f26fb2885e2afda0c2908acbdf923ca63a1fbc6;hp=b2b838b1d132231721db804ccd3b001332254a7a;hpb=83ada00338d2c9fa47d48c406b4a46b9d7888aff;p=ric-plt%2Fsubmgr.git diff --git a/pkg/control/transaction.go b/pkg/control/transaction.go index b2b838b..f722d11 100644 --- a/pkg/control/transaction.go +++ b/pkg/control/transaction.go @@ -20,7 +20,7 @@ package control import ( - "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/packer" + "gerrit.o-ran-sc.org/r/ric-plt/e2ap/pkg/e2ap" "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" "strconv" "sync" @@ -42,18 +42,21 @@ type TransactionIf interface { //----------------------------------------------------------------------------- type Transaction struct { - mutex sync.Mutex // - 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 *packer.PackedData //Encoded message to be send + mutex sync.Mutex // + Seq uint64 //transaction sequence + tracker *Tracker //tracker instance + Meid *xapp.RMRMeid //meid transaction related + 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() @@ -104,7 +101,7 @@ func (t *Transaction) GetMeid() *xapp.RMRMeid { return nil } -func (t *Transaction) GetPayload() *packer.PackedData { +func (t *Transaction) GetPayload() *e2ap.PackedData { t.mutex.Lock() defer t.mutex.Unlock() return t.Payload @@ -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 + SubId uint32 } 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.SubId), 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.SubId +} + func (t *TransactionXapp) Release() { t.mutex.Lock() xapp.Logger.Debug("RELEASE %s", t.String())