mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-20 02:31:51 +08:00
format output
This commit is contained in:
@@ -146,8 +146,10 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
|
|||||||
}
|
}
|
||||||
dest := toRemoteStorageLocation(util.FullPath(mountedDir), util.NewFullPath(message.NewParentPath, message.NewEntry.Name), remoteStorageMountLocation)
|
dest := toRemoteStorageLocation(util.FullPath(mountedDir), util.NewFullPath(message.NewParentPath, message.NewEntry.Name), remoteStorageMountLocation)
|
||||||
if message.NewEntry.IsDirectory {
|
if message.NewEntry.IsDirectory {
|
||||||
|
glog.V(0).Infof("mkdir %s", remote_storage.FormatLocation(dest))
|
||||||
return client.WriteDirectory(dest, message.NewEntry)
|
return client.WriteDirectory(dest, message.NewEntry)
|
||||||
}
|
}
|
||||||
|
glog.V(0).Infof("create %s", remote_storage.FormatLocation(dest))
|
||||||
reader := filer.NewFileReader(filerSource, message.NewEntry)
|
reader := filer.NewFileReader(filerSource, message.NewEntry)
|
||||||
remoteEntry, writeErr := client.WriteFile(dest, message.NewEntry, reader)
|
remoteEntry, writeErr := client.WriteFile(dest, message.NewEntry, reader)
|
||||||
if writeErr != nil {
|
if writeErr != nil {
|
||||||
@@ -158,6 +160,7 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
|
|||||||
if message.OldEntry != nil && message.NewEntry == nil {
|
if message.OldEntry != nil && message.NewEntry == nil {
|
||||||
glog.V(2).Infof("delete: %+v", resp)
|
glog.V(2).Infof("delete: %+v", resp)
|
||||||
dest := toRemoteStorageLocation(util.FullPath(mountedDir), util.NewFullPath(resp.Directory, message.OldEntry.Name), remoteStorageMountLocation)
|
dest := toRemoteStorageLocation(util.FullPath(mountedDir), util.NewFullPath(resp.Directory, message.OldEntry.Name), remoteStorageMountLocation)
|
||||||
|
glog.V(0).Infof("delete %s", remote_storage.FormatLocation(dest))
|
||||||
return client.DeleteFile(dest)
|
return client.DeleteFile(dest)
|
||||||
}
|
}
|
||||||
if message.OldEntry != nil && message.NewEntry != nil {
|
if message.OldEntry != nil && message.NewEntry != nil {
|
||||||
@@ -173,14 +176,17 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
|
|||||||
if resp.Directory == message.NewParentPath && message.OldEntry.Name == message.NewEntry.Name {
|
if resp.Directory == message.NewParentPath && message.OldEntry.Name == message.NewEntry.Name {
|
||||||
if filer.IsSameData(message.OldEntry, message.NewEntry) {
|
if filer.IsSameData(message.OldEntry, message.NewEntry) {
|
||||||
glog.V(2).Infof("update meta: %+v", resp)
|
glog.V(2).Infof("update meta: %+v", resp)
|
||||||
|
glog.V(0).Infof("delete %s", remote_storage.FormatLocation(dest))
|
||||||
return client.UpdateFileMetadata(dest, message.OldEntry, message.NewEntry)
|
return client.UpdateFileMetadata(dest, message.OldEntry, message.NewEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glog.V(2).Infof("update: %+v", resp)
|
glog.V(2).Infof("update: %+v", resp)
|
||||||
|
glog.V(0).Infof("delete %s", remote_storage.FormatLocation(oldDest))
|
||||||
if err := client.DeleteFile(oldDest); err != nil {
|
if err := client.DeleteFile(oldDest); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
reader := filer.NewFileReader(filerSource, message.NewEntry)
|
reader := filer.NewFileReader(filerSource, message.NewEntry)
|
||||||
|
glog.V(0).Infof("create %s", remote_storage.FormatLocation(dest))
|
||||||
remoteEntry, writeErr := client.WriteFile(dest, message.NewEntry, reader)
|
remoteEntry, writeErr := client.WriteFile(dest, message.NewEntry, reader)
|
||||||
if writeErr != nil {
|
if writeErr != nil {
|
||||||
return writeErr
|
return writeErr
|
||||||
|
@@ -27,6 +27,10 @@ func ParseLocation(remote string) (loc *filer_pb.RemoteStorageLocation) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FormatLocation(loc *filer_pb.RemoteStorageLocation) string {
|
||||||
|
return fmt.Sprintf("%s/%s%s", loc.Name, loc.Bucket, loc.Path)
|
||||||
|
}
|
||||||
|
|
||||||
type VisitFunc func(dir string, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error
|
type VisitFunc func(dir string, name string, isDirectory bool, remoteEntry *filer_pb.RemoteEntry) error
|
||||||
|
|
||||||
type RemoteStorageClient interface {
|
type RemoteStorageClient interface {
|
||||||
|
Reference in New Issue
Block a user