Skip to content

Commit c716396

Browse files
committed
Adding a local backend
1 parent 86a23fc commit c716396

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Proton
33

44
GoLang Object Storage Abstractor
55

6+

p_local.go

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"io/ioutil"
6+
"os"
7+
)
8+
9+
type Local struct {
10+
Path string
11+
}
12+
13+
func (l *Local) Auth() string {
14+
return "Auth Local"
15+
}
16+
17+
func (l *Local) ListBuckets() string {
18+
listdir, _ := ioutil.ReadDir(l.Path)
19+
for i := range listdir {
20+
fmt.Println(listdir[i])
21+
}
22+
return "Local List Buckets"
23+
}
24+
25+
func (l *Local) CreateBucket(bucketName string) string {
26+
os.MkdirAll(l.Path+"/"+bucketName, 0777)
27+
return "Local Create Bucket"
28+
}
29+
30+
func (l *Local) DeleteBucket(bucketName string) string {
31+
return "Local Delete Bucket"
32+
}
33+
34+
func (l *Local) Put(src string, dst string) string {
35+
return "Local Put Object"
36+
}
37+
38+
func (l *Local) Get() string {
39+
return "Local Get Object"
40+
}
41+
42+
func (l *Local) Del() string {
43+
return "Local Put Object"
44+
}

p_s3.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (s *AWS_S3) DeleteBucket(bucketName string) string {
5656
return "S3 Delete Bucket"
5757
}
5858

59-
func (s *AWS_S3) Put() string {
59+
func (s *AWS_S3) Put(src string, dst string) string {
6060
return "S3 Put Object"
6161
}
6262

p_swift.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (s *OS_Swift) DeleteBucket(bucketName string) string {
5353
return "Swift Delete Bucket"
5454
}
5555

56-
func (s *OS_Swift) Put(path string, object string) string {
56+
func (s *OS_Swift) Put(src string, dst string) string {
5757
//_, err := s.SwiftHandler.ObjectPut(container string, objectName string, contents io.Reader, checkHash bool, Hash string, contentType string, h Headers)
5858
return "Swift Put Object"
5959
}

proton.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type ObjectStore interface {
1212
ListBuckets() string
1313
CreateBucket(bucketName string) string
1414
DeleteBucket(bucketName string) string
15-
Put() string
15+
Put(src string, dst string) string
1616
Get() string
1717
Del() string
1818
}
@@ -84,6 +84,8 @@ func loadConfig() ObjectStore {
8484
objstore = new(AWS_S3)
8585
case "swift":
8686
objstore = new(OS_Swift)
87+
case "local":
88+
objstore = new(Local)
8789
}
8890

8991
if err != nil {

0 commit comments

Comments
 (0)