|
|
@ -15,9 +15,9 @@ import ( |
|
|
|
. "github.com/chrislusf/seaweedfs/weed/storage/types" |
|
|
|
) |
|
|
|
|
|
|
|
var ErrNotFound = errors.New("not found") |
|
|
|
var ErrDeleted = errors.New("already deleted") |
|
|
|
var ErrSizeMismatch = errors.New("size mismatch") |
|
|
|
var ErrorNotFound = errors.New("not found") |
|
|
|
var ErrorDeleted = errors.New("already deleted") |
|
|
|
var ErrorSizeMismatch = errors.New("size mismatch") |
|
|
|
|
|
|
|
func (v *Volume) checkReadWriteError(err error) { |
|
|
|
if err == nil { |
|
|
@ -289,7 +289,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro |
|
|
|
|
|
|
|
nv, ok := v.nm.Get(n.Id) |
|
|
|
if !ok || nv.Offset.IsZero() { |
|
|
|
return -1, ErrNotFound |
|
|
|
return -1, ErrorNotFound |
|
|
|
} |
|
|
|
readSize := nv.Size |
|
|
|
if readSize.IsDeleted() { |
|
|
@ -297,7 +297,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro |
|
|
|
glog.V(3).Infof("reading deleted %s", n.String()) |
|
|
|
readSize = -readSize |
|
|
|
} else { |
|
|
|
return -1, ErrDeleted |
|
|
|
return -1, ErrorDeleted |
|
|
|
} |
|
|
|
} |
|
|
|
if readSize == 0 { |
|
|
@ -327,7 +327,7 @@ func (v *Volume) readNeedle(n *needle.Needle, readOption *ReadOption) (int, erro |
|
|
|
if time.Now().Before(time.Unix(0, int64(n.AppendAtNs)).Add(time.Duration(ttlMinutes) * time.Minute)) { |
|
|
|
return bytesRead, nil |
|
|
|
} |
|
|
|
return -1, ErrNotFound |
|
|
|
return -1, ErrorNotFound |
|
|
|
} |
|
|
|
|
|
|
|
func (v *Volume) startWorker() { |
|
|
|