Rename backend subdir 'blobs' to 'data'
This commit is contained in:
parent
b403769ae8
commit
804cebde67
8 changed files with 22 additions and 31 deletions
|
@ -5,7 +5,7 @@ import "errors"
|
|||
type Type string
|
||||
|
||||
const (
|
||||
Blob Type = "blob"
|
||||
Data Type = "data"
|
||||
Key = "key"
|
||||
Lock = "lock"
|
||||
Snapshot = "snapshot"
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
const (
|
||||
dirMode = 0700
|
||||
blobPath = "blobs"
|
||||
dataPath = "data"
|
||||
snapshotPath = "snapshots"
|
||||
treePath = "trees"
|
||||
lockPath = "locks"
|
||||
|
@ -32,7 +32,7 @@ type Local struct {
|
|||
func OpenLocal(dir string) (*Local, error) {
|
||||
items := []string{
|
||||
dir,
|
||||
filepath.Join(dir, blobPath),
|
||||
filepath.Join(dir, dataPath),
|
||||
filepath.Join(dir, snapshotPath),
|
||||
filepath.Join(dir, treePath),
|
||||
filepath.Join(dir, lockPath),
|
||||
|
@ -83,7 +83,7 @@ func CreateLocal(dir string) (*Local, error) {
|
|||
versionFile := filepath.Join(dir, versionFileName)
|
||||
dirs := []string{
|
||||
dir,
|
||||
filepath.Join(dir, blobPath),
|
||||
filepath.Join(dir, dataPath),
|
||||
filepath.Join(dir, snapshotPath),
|
||||
filepath.Join(dir, treePath),
|
||||
filepath.Join(dir, lockPath),
|
||||
|
@ -104,7 +104,7 @@ func CreateLocal(dir string) (*Local, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// create paths for blobs, refs and temp
|
||||
// create paths for data, refs and temp
|
||||
for _, d := range dirs {
|
||||
err := os.MkdirAll(d, dirMode)
|
||||
if err != nil {
|
||||
|
@ -152,8 +152,8 @@ func (b *Local) renameFile(file *os.File, t Type, id ID) error {
|
|||
func (b *Local) dir(t Type) string {
|
||||
var n string
|
||||
switch t {
|
||||
case Blob:
|
||||
n = blobPath
|
||||
case Data:
|
||||
n = dataPath
|
||||
case Snapshot:
|
||||
n = snapshotPath
|
||||
case Tree:
|
||||
|
|
|
@ -45,7 +45,7 @@ func teardownBackend(t *testing.T, b *backend.Local) {
|
|||
}
|
||||
|
||||
func testBackend(b backend.Server, t *testing.T) {
|
||||
for _, tpe := range []backend.Type{backend.Blob, backend.Key, backend.Lock, backend.Snapshot, backend.Tree} {
|
||||
for _, tpe := range []backend.Type{backend.Data, backend.Key, backend.Lock, backend.Snapshot, backend.Tree} {
|
||||
// detect non-existing files
|
||||
for _, test := range TestStrings {
|
||||
id, err := backend.ParseID(test.id)
|
||||
|
|
|
@ -19,15 +19,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// dirMode = 0700
|
||||
// blobPath = "blobs"
|
||||
// snapshotPath = "snapshots"
|
||||
// treePath = "trees"
|
||||
// lockPath = "locks"
|
||||
// keyPath = "keys"
|
||||
// tempPath = "tmp"
|
||||
// versionFileName = "version"
|
||||
|
||||
tempfileRandomSuffixLength = 10
|
||||
)
|
||||
|
||||
|
@ -83,7 +74,7 @@ func OpenSFTP(dir string, program string, args ...string) (*SFTP, error) {
|
|||
// test if all necessary dirs and files are there
|
||||
items := []string{
|
||||
dir,
|
||||
filepath.Join(dir, blobPath),
|
||||
filepath.Join(dir, dataPath),
|
||||
filepath.Join(dir, snapshotPath),
|
||||
filepath.Join(dir, treePath),
|
||||
filepath.Join(dir, lockPath),
|
||||
|
@ -139,7 +130,7 @@ func CreateSFTP(dir string, program string, args ...string) (*SFTP, error) {
|
|||
versionFile := filepath.Join(dir, versionFileName)
|
||||
dirs := []string{
|
||||
dir,
|
||||
filepath.Join(dir, blobPath),
|
||||
filepath.Join(dir, dataPath),
|
||||
filepath.Join(dir, snapshotPath),
|
||||
filepath.Join(dir, treePath),
|
||||
filepath.Join(dir, lockPath),
|
||||
|
@ -160,7 +151,7 @@ func CreateSFTP(dir string, program string, args ...string) (*SFTP, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// create paths for blobs, refs and temp
|
||||
// create paths for data, refs and temp blobs
|
||||
for _, d := range dirs {
|
||||
// TODO: implement client.MkdirAll() and set mode to dirMode
|
||||
_, err = sftp.c.Lstat(d)
|
||||
|
@ -241,8 +232,8 @@ func (r *SFTP) renameFile(filename string, t Type, id ID) error {
|
|||
func (r *SFTP) dir(t Type) string {
|
||||
var n string
|
||||
switch t {
|
||||
case Blob:
|
||||
n = blobPath
|
||||
case Data:
|
||||
n = dataPath
|
||||
case Snapshot:
|
||||
n = snapshotPath
|
||||
case Tree:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue