chrislu 1 year ago
parent
commit
915416a277
  1. 6
      weed/command/filer_remote_gateway_buckets.go
  2. 8
      weed/command/filer_remote_sync_dir.go

6
weed/command/filer_remote_gateway_buckets.go

@ -224,7 +224,7 @@ func (option *RemoteGatewayOptions) makeBucketedEventProcessor(filerSource *sour
if writeErr != nil { if writeErr != nil {
return writeErr return writeErr
} }
return updateLocalEntry(&remoteSyncOptions, message.NewParentPath, message.NewEntry, remoteEntry)
return updateLocalEntry(option, message.NewParentPath, message.NewEntry, remoteEntry)
} }
if filer_pb.IsDelete(resp) { if filer_pb.IsDelete(resp) {
if resp.Directory == option.bucketsDir { if resp.Directory == option.bucketsDir {
@ -288,7 +288,7 @@ func (option *RemoteGatewayOptions) makeBucketedEventProcessor(filerSource *sour
if writeErr != nil { if writeErr != nil {
return writeErr return writeErr
} }
return updateLocalEntry(&remoteSyncOptions, message.NewParentPath, message.NewEntry, remoteEntry)
return updateLocalEntry(option, message.NewParentPath, message.NewEntry, remoteEntry)
} }
} }
} }
@ -325,7 +325,7 @@ func (option *RemoteGatewayOptions) makeBucketedEventProcessor(filerSource *sour
if writeErr != nil { if writeErr != nil {
return writeErr return writeErr
} }
return updateLocalEntry(&remoteSyncOptions, message.NewParentPath, message.NewEntry, remoteEntry)
return updateLocalEntry(option, message.NewParentPath, message.NewEntry, remoteEntry)
} }
} }

8
weed/command/filer_remote_sync_dir.go

@ -28,7 +28,7 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
return fmt.Errorf("read mount info: %v", detectErr) return fmt.Errorf("read mount info: %v", detectErr)
} }
eachEntryFunc, err := makeEventProcessor(remoteStorage, mountedDir, remoteStorageMountLocation, filerSource)
eachEntryFunc, err := option.makeEventProcessor(remoteStorage, mountedDir, remoteStorageMountLocation, filerSource)
if err != nil { if err != nil {
return err return err
} }
@ -80,7 +80,7 @@ func followUpdatesAndUploadToRemote(option *RemoteSyncOptions, filerSource *sour
return pb.FollowMetadata(pb.ServerAddress(*option.filerAddress), option.grpcDialOption, metadataFollowOption, processEventFnWithOffset) return pb.FollowMetadata(pb.ServerAddress(*option.filerAddress), option.grpcDialOption, metadataFollowOption, processEventFnWithOffset)
} }
func makeEventProcessor(remoteStorage *remote_pb.RemoteConf, mountedDir string, remoteStorageMountLocation *remote_pb.RemoteStorageLocation, filerSource *source.FilerSource) (pb.ProcessMetadataFunc, error) {
func (option *RemoteSyncOptions) makeEventProcessor(remoteStorage *remote_pb.RemoteConf, mountedDir string, remoteStorageMountLocation *remote_pb.RemoteStorageLocation, filerSource *source.FilerSource) (pb.ProcessMetadataFunc, error) {
client, err := remote_storage.GetRemoteStorage(remoteStorage) client, err := remote_storage.GetRemoteStorage(remoteStorage)
if err != nil { if err != nil {
return nil, err return nil, err
@ -152,7 +152,7 @@ func makeEventProcessor(remoteStorage *remote_pb.RemoteConf, mountedDir string,
if writeErr != nil { if writeErr != nil {
return writeErr return writeErr
} }
return updateLocalEntry(&remoteSyncOptions, message.NewParentPath, message.NewEntry, remoteEntry)
return updateLocalEntry(option, message.NewParentPath, message.NewEntry, remoteEntry)
} }
if filer_pb.IsDelete(resp) { if filer_pb.IsDelete(resp) {
glog.V(2).Infof("delete: %+v", resp) glog.V(2).Infof("delete: %+v", resp)
@ -191,7 +191,7 @@ func makeEventProcessor(remoteStorage *remote_pb.RemoteConf, mountedDir string,
if writeErr != nil { if writeErr != nil {
return writeErr return writeErr
} }
return updateLocalEntry(&remoteSyncOptions, message.NewParentPath, message.NewEntry, remoteEntry)
return updateLocalEntry(option, message.NewParentPath, message.NewEntry, remoteEntry)
} }
return nil return nil

Loading…
Cancel
Save