mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactoring
This commit is contained in:
parent
0264a7f50a
commit
898d943b25
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue