mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
when creating bucket, use remote storage client for default storage
This commit is contained in:
parent
63c84584bb
commit
13cc2ef723
|
@ -105,7 +105,6 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
storageName := *remoteSyncOptions.createBucketAt
|
|
||||||
remoteSyncOptions.bucketsDir = "/buckets"
|
remoteSyncOptions.bucketsDir = "/buckets"
|
||||||
// check buckets again
|
// check buckets again
|
||||||
remoteSyncOptions.WithFilerClient(func(filerClient filer_pb.SeaweedFilerClient) error {
|
remoteSyncOptions.WithFilerClient(func(filerClient filer_pb.SeaweedFilerClient) error {
|
||||||
|
@ -117,10 +116,11 @@ func runFilerRemoteSynchronize(cmd *Command, args []string) bool {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
storageName := *remoteSyncOptions.createBucketAt
|
||||||
if storageName != "" {
|
if storageName != "" {
|
||||||
fmt.Printf("synchronize %s, default new bucket creation in %s ...\n", remoteSyncOptions.bucketsDir, storageName)
|
fmt.Printf("synchronize %s, default new bucket creation in %s ...\n", remoteSyncOptions.bucketsDir, storageName)
|
||||||
util.RetryForever("filer.remote.sync buckets "+storageName, func() error {
|
util.RetryForever("filer.remote.sync buckets "+storageName, func() error {
|
||||||
return followBucketUpdatesAndUploadToRemote(&remoteSyncOptions, filerSource, storageName)
|
return remoteSyncOptions.followBucketUpdatesAndUploadToRemote(filerSource)
|
||||||
}, func(err error) bool {
|
}, func(err error) bool {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("synchronize %s to %s: %v", remoteSyncOptions.bucketsDir, storageName, err)
|
glog.Errorf("synchronize %s to %s: %v", remoteSyncOptions.bucketsDir, storageName, err)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func followBucketUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *source.FilerSource, storageName string) error {
|
func (option *RemoteSyncOptions) followBucketUpdatesAndUploadToRemote(filerSource *source.FilerSource) error {
|
||||||
|
|
||||||
// read filer remote storage mount mappings
|
// read filer remote storage mount mappings
|
||||||
if detectErr := option.collectRemoteStorageConf(); detectErr != nil {
|
if detectErr := option.collectRemoteStorageConf(); detectErr != nil {
|
||||||
|
@ -46,7 +46,12 @@ func (option *RemoteSyncOptions) makeBucketedEventProcessor(filerSource *source.
|
||||||
if !entry.IsDirectory {
|
if !entry.IsDirectory {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
client, err := option.findRemoteStorageClient(entry.Name)
|
remoteConf, found := option.remoteConfs[*option.createBucketAt]
|
||||||
|
if !found {
|
||||||
|
return fmt.Errorf("un-configured remote storage %s", *option.createBucketAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
client, err := remote_storage.GetRemoteStorage(remoteConf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue