mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
auto list of storage types
This commit is contained in:
parent
38f73c8324
commit
da49d25950
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/remote_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/remote_pb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"io"
|
"io"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -100,6 +101,26 @@ var (
|
||||||
remoteStorageClientsLock sync.Mutex
|
remoteStorageClientsLock sync.Mutex
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func GetAllRemoteStorageNames() string {
|
||||||
|
var storageNames []string
|
||||||
|
for k := range RemoteStorageClientMakers {
|
||||||
|
storageNames = append(storageNames, k)
|
||||||
|
}
|
||||||
|
sort.Strings(storageNames)
|
||||||
|
return strings.Join(storageNames, "|")
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRemoteStorageNamesHasBucket() string {
|
||||||
|
var storageNames []string
|
||||||
|
for k, m := range RemoteStorageClientMakers {
|
||||||
|
if m.HasBucket() {
|
||||||
|
storageNames = append(storageNames, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sort.Strings(storageNames)
|
||||||
|
return strings.Join(storageNames, "|")
|
||||||
|
}
|
||||||
|
|
||||||
func ParseRemoteLocation(remoteConfType string, remote string) (remoteStorageLocation *remote_pb.RemoteStorageLocation, err error) {
|
func ParseRemoteLocation(remoteConfType string, remote string) (remoteStorageLocation *remote_pb.RemoteStorageLocation, err error) {
|
||||||
maker, found := RemoteStorageClientMakers[remoteConfType]
|
maker, found := RemoteStorageClientMakers[remoteConfType]
|
||||||
if !found {
|
if !found {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
"github.com/chrislusf/seaweedfs/weed/filer"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/remote_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/remote_pb"
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/remote_storage"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
"github.com/golang/protobuf/jsonpb"
|
"github.com/golang/protobuf/jsonpb"
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
|
@ -60,7 +61,7 @@ func (c *commandRemoteConfigure) Do(args []string, commandEnv *CommandEnv, write
|
||||||
isDelete := remoteConfigureCommand.Bool("delete", false, "delete one remote storage by its name")
|
isDelete := remoteConfigureCommand.Bool("delete", false, "delete one remote storage by its name")
|
||||||
|
|
||||||
remoteConfigureCommand.StringVar(&conf.Name, "name", "", "a short name to identify the remote storage")
|
remoteConfigureCommand.StringVar(&conf.Name, "name", "", "a short name to identify the remote storage")
|
||||||
remoteConfigureCommand.StringVar(&conf.Type, "type", "s3", "[s3|gcs|azure|b2|aliyun|tencent|baidu|wasabi|hdfs|filebase|storj] storage type")
|
remoteConfigureCommand.StringVar(&conf.Type, "type", "s3", fmt.Sprintf("[%s] storage type", remote_storage.GetAllRemoteStorageNames()))
|
||||||
|
|
||||||
remoteConfigureCommand.StringVar(&conf.S3AccessKey, "s3.access_key", "", "s3 access key")
|
remoteConfigureCommand.StringVar(&conf.S3AccessKey, "s3.access_key", "", "s3 access key")
|
||||||
remoteConfigureCommand.StringVar(&conf.S3SecretKey, "s3.secret_key", "", "s3 secret key")
|
remoteConfigureCommand.StringVar(&conf.S3SecretKey, "s3.secret_key", "", "s3 secret key")
|
||||||
|
|
Loading…
Reference in a new issue