diff options
| author | Chris Lu <chris.lu@gmail.com> | 2016-07-02 23:58:23 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2016-07-02 23:58:23 -0700 |
| commit | 576573711a2e9c4173c91001b2857a1bd52c9426 (patch) | |
| tree | 7f647ad6ad78e89886cfbc80a4a24b636d974b2c | |
| parent | 3d8df0f709795a3e0e9ba6849dcc7b7614173ca9 (diff) | |
| download | seaweedfs-576573711a2e9c4173c91001b2857a1bd52c9426.tar.xz seaweedfs-576573711a2e9c4173c91001b2857a1bd52c9426.zip | |
refactoring
| -rw-r--r-- | weed/storage/volume.go | 17 | ||||
| -rw-r--r-- | weed/storage/volume_loading.go | 18 |
2 files changed, 18 insertions, 17 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go index 2053cd679..701d88760 100644 --- a/weed/storage/volume.go +++ b/weed/storage/volume.go @@ -299,23 +299,6 @@ func (v *Volume) ContentSize() uint64 { return v.nm.ContentSize() } -func checkFile(filename string) (exists, canRead, canWrite bool, modTime time.Time) { - exists = true - fi, err := os.Stat(filename) - if os.IsNotExist(err) { - exists = false - return - } - if fi.Mode()&0400 != 0 { - canRead = true - } - if fi.Mode()&0200 != 0 { - canWrite = true - } - modTime = fi.ModTime() - return -} - // volume is expired if modified time + volume ttl < now // except when volume is empty // or when the volume does not have a ttl diff --git a/weed/storage/volume_loading.go b/weed/storage/volume_loading.go index 968471620..f2099de83 100644 --- a/weed/storage/volume_loading.go +++ b/weed/storage/volume_loading.go @@ -3,6 +3,7 @@ package storage import ( "fmt" "os" + "time" "github.com/chrislusf/seaweedfs/weed/glog" ) @@ -87,3 +88,20 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind } return e } + +func checkFile(filename string) (exists, canRead, canWrite bool, modTime time.Time) { + exists = true + fi, err := os.Stat(filename) + if os.IsNotExist(err) { + exists = false + return + } + if fi.Mode()&0400 != 0 { + canRead = true + } + if fi.Mode()&0200 != 0 { + canWrite = true + } + modTime = fi.ModTime() + return +} |
