refactoring

This commit is contained in:
Chris Lu 2019-07-17 23:43:48 -07:00
parent 0264a7f50a
commit 898d943b25
4 changed files with 6 additions and 6 deletions

View file

@ -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,

View file

@ -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
})

View file

@ -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)
}

View file

@ -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