/
util.go
36 lines (26 loc) · 857 Bytes
/
util.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
package s3;
// Simple utilties.
import (
"path"
"github.com/eriq-augustine/elfs/connector"
"github.com/eriq-augustine/elfs/dirent"
)
const (
LOCK_FILENAME = "remote_lock"
)
func (this *S3Connector) getDataPath(direntInfo *dirent.Dirent) string {
if (direntInfo == nil) {
panic("Cannot get path for nil dirent.");
}
var prefix string = string(direntInfo.Id)[0:connector.DATA_GROUP_PREFIX_LEN];
return path.Join(connector.FS_SYS_DIR_DATA, prefix, string(direntInfo.Id));
}
func (this *S3Connector) getMetadataPath(metadataId string) string {
if (metadataId == "") {
panic("Cannot get path for empty metadata.");
}
return path.Join(connector.FS_SYS_DIR_ADMIN, metadataId);
}
func (this *S3Connector) getLockPath() string {
return path.Join(connector.FS_SYS_DIR_ADMIN, LOCK_FILENAME);
}