Updated AgentRequest

This commit is contained in:
Trial97
2020-05-05 17:02:37 +03:00
committed by Dan Christian Bogos
parent 3b9b2895e0
commit 763710fb80
22 changed files with 411 additions and 331 deletions

View File

@@ -70,7 +70,7 @@ func (onm *OrderedNavigableMap) Empty() bool {
}
// Remove removes the item for the given path and updates the order
func (onm *OrderedNavigableMap) Remove(fullPath FullPath) (err error) {
func (onm *OrderedNavigableMap) Remove(fullPath *FullPath) (err error) {
path := stripIdxFromLastPathElm(fullPath.Path)
if path == EmptyString || fullPath.PathItems[len(fullPath.PathItems)-1].Index != nil {
return ErrWrongPath
@@ -91,16 +91,16 @@ func (onm *OrderedNavigableMap) Remove(fullPath FullPath) (err error) {
return
}
// Set sets the value at the given path
// this is the old to be capable of building the code without updating all the code
// will be replaced with Set2 after we decide that is the optimal solution
func (onm *OrderedNavigableMap) Set(fldPath PathItems, val NMInterface) (addedNew bool, err error) {
return onm.Set2(&FullPath{PathItems: fldPath, Path: fldPath.String()}, val)
}
// // Set sets the value at the given path
// // this is the old to be capable of building the code without updating all the code
// // will be replaced with Set2 after we decide that is the optimal solution
// func (onm *OrderedNavigableMap) Set(fldPath PathItems, val NMInterface) (addedNew bool, err error) {
// return onm.Set2(&FullPath{PathItems: fldPath, Path: fldPath.String()}, val)
// }
// Set2 sets the value at the given path
// Set sets the value at the given path
// this used with full path and the processed path to not calculate them for every set
func (onm *OrderedNavigableMap) Set2(fullPath *FullPath, val NMInterface) (addedNew bool, err error) {
func (onm *OrderedNavigableMap) Set(fullPath *FullPath, val NMInterface) (addedNew bool, err error) {
if len(fullPath.PathItems) == 0 {
return false, ErrWrongPath
}
@@ -182,3 +182,10 @@ func (onm *OrderedNavigableMap) GetOrder() (order []PathItems) {
}
return
}
// RemoveAll will clean the data and the odrder from OrderedNavigableMap
func (onm *OrderedNavigableMap) RemoveAll() {
onm.nm = NavigableMap2{}
onm.orderIdx = NewPathItemList()
onm.orderRef = make(map[string][]*PathItemElement)
}