Use filerGroup for s3 buckets collection prefix (#4465)
* Use filerGroup for s3 buckets collection prefix * Fix templates * Remove flags * Remove s3CollectionPrefix
This commit is contained in:
@@ -54,7 +54,7 @@ func (c *commandS3BucketDelete) Do(args []string, commandEnv *CommandEnv, writer
|
||||
// delete the collection directly first
|
||||
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
|
||||
_, err = client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{
|
||||
Name: *bucketName,
|
||||
Name: getCollectionName(commandEnv, *bucketName),
|
||||
})
|
||||
return err
|
||||
})
|
||||
|
||||
@@ -57,7 +57,7 @@ func (c *commandS3BucketList) Do(args []string, commandEnv *CommandEnv, writer i
|
||||
if !entry.IsDirectory {
|
||||
return nil
|
||||
}
|
||||
collection := entry.Name
|
||||
collection := getCollectionName(commandEnv, entry.Name)
|
||||
var collectionSize, fileCount float64
|
||||
if collectionInfo, found := collectionInfos[collection]; found {
|
||||
collectionSize = collectionInfo.Size
|
||||
|
||||
@@ -65,7 +65,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv,
|
||||
if !entry.IsDirectory {
|
||||
return nil
|
||||
}
|
||||
collection := entry.Name
|
||||
collection := getCollectionName(commandEnv, entry.Name)
|
||||
var collectionSize float64
|
||||
if collectionInfo, found := collectionInfos[collection]; found {
|
||||
collectionSize = collectionInfo.Size
|
||||
|
||||
@@ -184,3 +184,10 @@ func readNeedleStatus(grpcDialOption grpc.DialOption, sourceVolumeServer pb.Serv
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
func getCollectionName(commandEnv *CommandEnv, bucket string) string {
|
||||
if *commandEnv.option.FilerGroup != "" {
|
||||
return fmt.Sprintf("%s_%s", *commandEnv.option.FilerGroup, bucket)
|
||||
}
|
||||
return bucket
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user