From 898d943b25975e83dff81bb532243cee823a47af Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 17 Jul 2019 23:43:48 -0700 Subject: [PATCH] refactoring --- weed/server/volume_grpc_batch_delete.go | 2 +- weed/server/volume_grpc_tail.go | 2 +- weed/storage/store.go | 4 ++-- weed/topology/store_replicate.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/weed/server/volume_grpc_batch_delete.go b/weed/server/volume_grpc_batch_delete.go index d7fbb6edf..fdb7937d2 100644 --- a/weed/server/volume_grpc_batch_delete.go +++ b/weed/server/volume_grpc_batch_delete.go @@ -58,7 +58,7 @@ func (vs *VolumeServer) BatchDelete(ctx context.Context, req *volume_server_pb.B break } n.LastModified = now - if size, err := vs.store.Delete(volumeId, n); err != nil { + if size, err := vs.store.DeleteVolumeNeedle(volumeId, n); err != nil { resp.Results = append(resp.Results, &volume_server_pb.DeleteResult{ FileId: fid, Status: http.StatusInternalServerError, diff --git a/weed/server/volume_grpc_tail.go b/weed/server/volume_grpc_tail.go index 698bad5b8..34c55a599 100644 --- a/weed/server/volume_grpc_tail.go +++ b/weed/server/volume_grpc_tail.go @@ -110,7 +110,7 @@ func (vs *VolumeServer) VolumeTailReceiver(ctx context.Context, req *volume_serv defer glog.V(1).Infof("receive tailing volume %d finished", v.Id) return resp, operation.TailVolumeFromSource(req.SourceVolumeServer, vs.grpcDialOption, v.Id, req.SinceNs, int(req.IdleTimeoutSeconds), func(n *needle.Needle) error { - _, _, err := vs.store.Write(v.Id, n) + _, _, err := vs.store.WriteVolumeNeedle(v.Id, n) return err }) diff --git a/weed/storage/store.go b/weed/storage/store.go index d2dd76d52..e99d77774 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -211,7 +211,7 @@ func (s *Store) Close() { } } -func (s *Store) Write(i needle.VolumeId, n *needle.Needle) (size uint32, isUnchanged bool, err error) { +func (s *Store) WriteVolumeNeedle(i needle.VolumeId, n *needle.Needle) (size uint32, isUnchanged bool, err error) { if v := s.findVolume(i); v != nil { if v.readOnly { err = fmt.Errorf("volume %d is read only", i) @@ -230,7 +230,7 @@ func (s *Store) Write(i needle.VolumeId, n *needle.Needle) (size uint32, isUncha return } -func (s *Store) Delete(i needle.VolumeId, n *needle.Needle) (uint32, error) { +func (s *Store) DeleteVolumeNeedle(i needle.VolumeId, n *needle.Needle) (uint32, error) { if v := s.findVolume(i); v != nil && !v.readOnly { return v.deleteNeedle(n) } diff --git a/weed/topology/store_replicate.go b/weed/topology/store_replicate.go index d4076d548..d21c4d210 100644 --- a/weed/topology/store_replicate.go +++ b/weed/topology/store_replicate.go @@ -25,7 +25,7 @@ func ReplicatedWrite(masterNode string, s *storage.Store, //check JWT jwt := security.GetJwt(r) - size, isUnchanged, err = s.Write(volumeId, n) + size, isUnchanged, err = s.WriteVolumeNeedle(volumeId, n) if err != nil { err = fmt.Errorf("failed to write to local disk: %v", err) return @@ -89,7 +89,7 @@ func ReplicatedDelete(masterNode string, store *storage.Store, //check JWT jwt := security.GetJwt(r) - ret, err := store.Delete(volumeId, n) + ret, err := store.DeleteVolumeNeedle(volumeId, n) if err != nil { glog.V(0).Infoln("delete error:", err) return ret, err