aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-01-05 19:52:38 -0800
committerChris Lu <chris.lu@gmail.com>2019-01-05 19:52:38 -0800
commit6b5d6bb5a6a7eabe7d467951f00bd466a6d9e456 (patch)
tree19ee94a254406b1f081dc37b7c213621461a1bc9
parent9383c91eb1ce9f20cad8706a70cec16ab15c453b (diff)
downloadseaweedfs-6b5d6bb5a6a7eabe7d467951f00bd466a6d9e456.tar.xz
seaweedfs-6b5d6bb5a6a7eabe7d467951f00bd466a6d9e456.zip
adjust error names
-rw-r--r--weed/operation/delete_content.go2
-rw-r--r--weed/operation/lookup_vid_cache.go8
-rw-r--r--weed/storage/volume_read_write.go4
3 files changed, 8 insertions, 6 deletions
diff --git a/weed/operation/delete_content.go b/weed/operation/delete_content.go
index fcb4f718a..e15859d15 100644
--- a/weed/operation/delete_content.go
+++ b/weed/operation/delete_content.go
@@ -131,7 +131,7 @@ func DeleteFilesAtOneVolumeServer(volumeServer string, fileIds []string) (ret []
}
for _, result := range ret {
- if result.Error != "" && result.Error != "Not Found" {
+ if result.Error != "" && result.Error != "not found" {
return nil, fmt.Errorf("delete fileId %s: %v", result.FileId, result.Error)
}
}
diff --git a/weed/operation/lookup_vid_cache.go b/weed/operation/lookup_vid_cache.go
index d4980a1f5..ccc1f2beb 100644
--- a/weed/operation/lookup_vid_cache.go
+++ b/weed/operation/lookup_vid_cache.go
@@ -9,6 +9,8 @@ import (
"github.com/chrislusf/seaweedfs/weed/glog"
)
+var ErrorNotFound = errors.New("not found")
+
type VidInfo struct {
Locations []Location
NextRefreshTime time.Time
@@ -28,14 +30,14 @@ func (vc *VidCache) Get(vid string) ([]Location, error) {
defer vc.RUnlock()
if 0 < id && id <= len(vc.cache) {
if vc.cache[id-1].Locations == nil {
- return nil, errors.New("Not Set")
+ return nil, errors.New("not set")
}
if vc.cache[id-1].NextRefreshTime.Before(time.Now()) {
- return nil, errors.New("Expired")
+ return nil, errors.New("expired")
}
return vc.cache[id-1].Locations, nil
}
- return nil, errors.New("Not Found")
+ return nil, ErrorNotFound
}
func (vc *VidCache) Set(vid string, locations []Location, duration time.Duration) {
id, err := strconv.Atoi(vid)
diff --git a/weed/storage/volume_read_write.go b/weed/storage/volume_read_write.go
index 8f628c178..b44900dd4 100644
--- a/weed/storage/volume_read_write.go
+++ b/weed/storage/volume_read_write.go
@@ -143,7 +143,7 @@ func (v *Volume) readNeedle(n *Needle) (int, error) {
}
}
if nv.Size == TombstoneFileSize {
- return -1, errors.New("Already Deleted")
+ return -1, errors.New("already deleted")
}
err := n.ReadData(v.dataFile, int64(nv.Offset)*NeedlePaddingSize, nv.Size, v.Version())
if err != nil {
@@ -163,7 +163,7 @@ func (v *Volume) readNeedle(n *Needle) (int, error) {
if uint64(time.Now().Unix()) < n.LastModified+uint64(ttlMinutes*60) {
return bytesRead, nil
}
- return -1, errors.New("Not Found")
+ return -1, ErrorNotFound
}
func ScanVolumeFile(dirname string, collection string, id VolumeId,