cloud drive: add list buckets

This commit is contained in:
Chris Lu
2021-09-03 20:42:02 -07:00
parent fbfc90fd1e
commit 83cd0fc739
5 changed files with 45 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import (
"io"
"strings"
"sync"
"time"
)
func ParseLocationName(remote string) (locationName string) {
@@ -65,6 +66,11 @@ func FormatLocation(loc *remote_pb.RemoteStorageLocation) string {
type VisitFunc func(dir string, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error
type Bucket struct {
Name string
CreatedAt time.Time
}
type RemoteStorageClient interface {
Traverse(loc *remote_pb.RemoteStorageLocation, visitFn VisitFunc) error
ReadFile(loc *remote_pb.RemoteStorageLocation, offset int64, size int64) (data []byte, err error)
@@ -73,6 +79,7 @@ type RemoteStorageClient interface {
WriteFile(loc *remote_pb.RemoteStorageLocation, entry *filer_pb.Entry, reader io.Reader) (remoteEntry *filer_pb.RemoteEntry, err error)
UpdateFileMetadata(loc *remote_pb.RemoteStorageLocation, oldEntry *filer_pb.Entry, newEntry *filer_pb.Entry) (err error)
DeleteFile(loc *remote_pb.RemoteStorageLocation) (err error)
ListBuckets() ([]*Bucket, error)
}
type RemoteStorageClientMaker interface {