-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.go
57 lines (44 loc) · 1.16 KB
/
paths.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
package gitdb
import (
"path/filepath"
)
func (g *gitdb) absDbPath() string {
absDbPath, err := filepath.Abs(g.config.DbPath)
if err != nil {
panic(err)
}
return absDbPath
}
func (g *gitdb) dbDir() string {
return filepath.Join(g.absDbPath(), "data")
}
func (g *gitdb) fullPath(m Model) string {
return filepath.Join(g.dbDir(), m.GetSchema().name())
}
func (g *gitdb) blockFilePath(dataset, block string) string {
return filepath.Join(g.dbDir(), dataset, block+".json")
}
func (g *gitdb) lockDir(m Model) string {
return filepath.Join(g.fullPath(m), "Lock")
}
//index path
func (g *gitdb) indexDir() string {
return filepath.Join(g.absDbPath(), g.internalDirName(), "index")
}
func (g *gitdb) indexPath(dataset string) string {
return filepath.Join(g.indexDir(), dataset)
}
//ssh paths
func (g *gitdb) sshDir() string {
return filepath.Join(g.absDbPath(), g.internalDirName(), "ssh")
}
//ssh paths
func (g *gitdb) publicKeyFilePath() string {
return filepath.Join(g.sshDir(), "gitdb.pub")
}
func (g *gitdb) privateKeyFilePath() string {
return filepath.Join(g.sshDir(), "gitdb")
}
func (g *gitdb) internalDirName() string {
return ".gitdb" //todo rename
}