MCPcopy
hub / github.com/syncthing/syncthing / newSimple

Function newSimple

lib/versioner/simple.go:32–51  ·  view source on GitHub ↗
(cfg config.FolderConfiguration)

Source from the content-addressed store, hash-verified

30}
31
32func newSimple(cfg config.FolderConfiguration) Versioner {
33 keep, err := strconv.Atoi(cfg.Versioning.Params["keep"])
34 cleanoutDays, _ := strconv.Atoi(cfg.Versioning.Params["cleanoutDays"])
35 // On error we default to 0, "do not clean out the versioned items"
36
37 if err != nil {
38 keep = 5 // A reasonable default
39 }
40
41 s := simple{
42 keep: keep,
43 cleanoutDays: cleanoutDays,
44 folderFs: cfg.Filesystem(),
45 versionsFs: versionerFsFromFolderCfg(cfg),
46 copyRangeMethod: cfg.CopyRangeMethod.ToFS(),
47 }
48
49 l.Debugf("instantiated %#v", s)
50 return s
51}
52
53// Archive moves the named file away to a version archive. If this function
54// returns nil, the named file does not exist any more (has been archived).

Callers 3

TestPathTildesFunction · 0.85

Calls 4

versionerFsFromFolderCfgFunction · 0.85
FilesystemMethod · 0.80
DebugfMethod · 0.80
ToFSMethod · 0.45

Tested by 3

TestPathTildesFunction · 0.68