-/*
-Checks if a tranascation with similar type has been ongoing. If not then creates one.
-Returns error if there is similar transatcion ongoing.
-*/
-func (t *Tracker) TrackTransaction(subID uint16, act Action, addr string, port uint16, params *xapp.RMRParams) (*Transaction, error) {
- key := TransactionKey{subID, act}
- xappkey := TransactionXappKey{addr, port, params.Xid}
- trans := &Transaction{t, key, xappkey, params}
- t.mutex.Lock()
- defer t.mutex.Unlock()
- if _, ok := t.transactionTable[key]; ok {
- // TODO: Implement merge related check here. If the key is same but the value is different.
- err := fmt.Errorf("transaction tracker: Similar transaction with sub id %d and type %s is ongoing", key.SubID, key.TransType)
- return nil, err
- }
- if _, ok := t.transactionXappTable[xappkey]; ok {
- // TODO: Implement merge related check here. If the key is same but the value is different.
- err := fmt.Errorf("transaction tracker: Similar transaction with xapp key %v is ongoing", xappkey)
- return nil, err
+func (t *Tracker) Track(trans *TransactionXapp) error {
+
+ if trans.GetEndpoint() == nil {
+ err := fmt.Errorf("Tracker: No valid endpoint given in %s", trans.String())
+ return err