+ d.mutex.Lock()
+ defer d.mutex.Unlock()
+
+ if md5sum == "" {
+ xapp.Logger.Error("Attempt to store empty md5sum for restubsId %s retransmission map skipped", restSubsId)
+ return
+ }
+
+ d.removeOngoingTransaction(md5sum)
+
+ prevRestSubsId, exists := d.previousRequestMap[md5sum]
+
+ if exists {
+ if prevRestSubsId != restSubsId {
+ xapp.Logger.Error("Storing md5sum for a processed request for restSubsId %s md5sum %s over a previous restSubsId %s", restSubsId, md5sum, prevRestSubsId)
+ } else {
+ return
+ }
+ } else {
+ xapp.Logger.Debug("Storing md5sum for a processed request for restSubsId %s md5sum %s", restSubsId, md5sum)
+ }
+
+ d.previousRequestMap[md5sum] = restSubsId
+}
+
+func (d *duplicateCtrl) GetLastKnownRestSubsIdBasedOnMd5sum(md5sum string) (string, bool) {
+
+ d.mutex.Lock()
+ defer d.mutex.Unlock()
+
+ if md5sum == "" {
+ return "", false
+ }
+
+ m, e := d.previousRequestMap[md5sum]
+
+ return m, e
+}
+
+func (d *duplicateCtrl) DeleteLastKnownRestSubsIdBasedOnMd5sum(md5sum string) {
+
+ d.mutex.Lock()
+ defer d.mutex.Unlock()
+
+ restSubsId, exists := d.previousRequestMap[md5sum]
+
+ if !exists {
+ if md5sum == "" {
+ xapp.Logger.Info("Attempted to delete a cached md5sum, md5sum not set yet")
+ } else {
+ xapp.Logger.Error("Attempted to delete a cached md5sum %s, but the value was not found", md5sum)
+ }
+ } else {
+ xapp.Logger.Debug("Deleted a cached md5sum %s for restSubsId %s", md5sum, restSubsId)
+ delete(d.previousRequestMap, md5sum)
+ }
+}
+
+func CalculateRequestMd5sum(payload interface{}) (string, error) {