diff --git a/common/trieForDirPath.go b/common/trieForDirPath.go index ff0c5d821..0be0a03a1 100644 --- a/common/trieForDirPath.go +++ b/common/trieForDirPath.go @@ -6,7 +6,7 @@ import ( type TrieNode struct { Children map[string]*TrieNode - Value *uint32 + Value uint32 isEnd bool } @@ -31,24 +31,24 @@ func (t *Trie) Insert(key string, value uint32) { } node = child } - node.Value = &value + node.Value = value node.isEnd = true } -func (t *Trie) Get(key string) (*uint32, bool) { +func (t *Trie) Get(key string) (uint32, bool) { node := t.Root segments := strings.Split(key, "/") for _, segment := range segments { child, exists := node.Children[segment] if !exists { - return nil, false + return 0, false } node = child } if node.isEnd { return node.Value, true } - return nil, false + return 0, false } func (t *Trie) Delete(key string) bool { @@ -67,7 +67,7 @@ func (t *Trie) deleteHelper(node *TrieNode, segments []string, depth int) bool { return false // Key does not exist } node.isEnd = false // Unmark the end of the key - node.Value = nil + node.Value = 0 // If the node has no Children, it can be deleted return len(node.Children) == 0 diff --git a/ste/folderCreationTracker.go b/ste/folderCreationTracker.go index de3ae7ad8..90cab504b 100644 --- a/ste/folderCreationTracker.go +++ b/ste/folderCreationTracker.go @@ -86,7 +86,7 @@ func (f *jpptFolderTracker) CreateFolder(folder string, doCreation func() error) } if idx, ok := f.contents.Get(folder); ok { - status := f.plan.Transfer(*idx).TransferStatus() + status := f.plan.Transfer(idx).TransferStatus() if status == (common.ETransferStatus.FolderCreated()) || status == (common.ETransferStatus.Success()) { return nil } @@ -103,7 +103,7 @@ func (f *jpptFolderTracker) CreateFolder(folder string, doCreation func() error) if idx, ok := f.contents.Get(folder); ok { // overwrite it's transfer status - f.plan.Transfer(*idx).SetTransferStatus(common.ETransferStatus.FolderCreated(), false) + f.plan.Transfer(idx).SetTransferStatus(common.ETransferStatus.FolderCreated(), false) } else { // A folder hasn't been hit in traversal yet. // Recording it in memory is OK, because we *cannot* resume a job that hasn't finished traversal. @@ -130,7 +130,10 @@ func (f *jpptFolderTracker) ShouldSetProperties(folder string, overwrite common. var created bool if idx, ok := f.contents.Get(folder); ok { - created = f.plan.Transfer(*idx).TransferStatus() == common.ETransferStatus.FolderCreated() + status := f.plan.Transfer(idx).TransferStatus() + if status == (common.ETransferStatus.FolderCreated()) || status == (common.ETransferStatus.Success()) { + created = true + } } else { // This should not happen, ever. // Folder property jobs register with the tracker before they start getting processed.