|
1234567891011121314151617181920212223242526272829303132333435363738 |
- package spacesyncer
-
- import (
- "gitlink.org.cn/cloudream/common/pkgs/trie"
- "gitlink.org.cn/cloudream/jcs-pub/client/types"
- stgtypes "gitlink.org.cn/cloudream/jcs-pub/common/pkgs/storage/types"
- )
-
- func execute(syncer *SpaceSyncer, task *task) {
- switch mode := task.Task.Mode.(type) {
- case *types.SpaceSyncModeFull:
- executeFull(syncer, task)
- case *types.SpaceSyncModeDiff:
- executeDiff(syncer, task, mode)
- }
- }
-
- func createDirNode(tree *trie.Trie[*stgtypes.DirEntry], pathComps []string, e *stgtypes.DirEntry) {
- var ptr = &tree.Root
- for _, c := range pathComps {
- ptr.Value = nil
- ptr = ptr.Create(c)
- }
- ptr.Value = e
- }
-
- func removeDirNode(tree *trie.Trie[*stgtypes.DirEntry], pathComps []string) {
- var ptr = &tree.Root
- for _, c := range pathComps {
- ptr.Value = nil
- next := ptr.WalkNext(c)
- if next == nil {
- break
- }
- }
- ptr.Value = nil
- ptr.RemoveSelf(true)
- }
|