forked from keybase/kbfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
special_files.go
101 lines (82 loc) · 2.06 KB
/
special_files.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package libdokan
import (
"github.com/keybase/kbfs/dokan"
"github.com/keybase/kbfs/libfs"
)
// handleTLFSpecialFile handles special files that are within a TLF.
func handleTLFSpecialFile(name string, folder *Folder) dokan.File {
// Common files (the equivalent of handleCommonSpecialFile
// from libfuse) are handled in fs.go.
switch name {
case libfs.StatusFileName:
return NewTLFStatusFile(folder)
case libfs.UpdateHistoryFileName:
return NewUpdateHistoryFile(folder)
case libfs.EditHistoryName:
return NewTlfEditHistoryFile(folder)
case libfs.UnstageFileName:
return &UnstageFile{
folder: folder,
}
case libfs.DisableUpdatesFileName:
return &UpdatesFile{
folder: folder,
}
case libfs.EnableUpdatesFileName:
return &UpdatesFile{
folder: folder,
enable: true,
}
case libfs.RekeyFileName:
return &RekeyFile{
folder: folder,
}
case libfs.ReclaimQuotaFileName:
return &ReclaimQuotaFile{
folder: folder,
}
case libfs.SyncFromServerFileName:
return &SyncFromServerFile{
folder: folder,
}
case libfs.EnableJournalFileName:
return &JournalControlFile{
folder: folder,
action: libfs.JournalEnable,
}
case libfs.FlushJournalFileName:
return &JournalControlFile{
folder: folder,
action: libfs.JournalFlush,
}
case libfs.PauseJournalBackgroundWorkFileName:
return &JournalControlFile{
folder: folder,
action: libfs.JournalPauseBackgroundWork,
}
case libfs.ResumeJournalBackgroundWorkFileName:
return &JournalControlFile{
folder: folder,
action: libfs.JournalResumeBackgroundWork,
}
case libfs.DisableJournalFileName:
return &JournalControlFile{
folder: folder,
action: libfs.JournalDisable,
}
case libfs.EnableSyncFileName:
return &SyncControlFile{
folder: folder,
action: libfs.SyncEnable,
}
case libfs.DisableSyncFileName:
return &SyncControlFile{
folder: folder,
action: libfs.SyncDisable,
}
}
return nil
}