diff options
| author | joeslay <54322500+joeslay@users.noreply.github.com> | 2019-09-11 10:25:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-11 10:25:27 +0100 |
| commit | 9ea9a5e97a513ed3cbcf04a4f14f05a344aae65c (patch) | |
| tree | 1c8616222a72905cf739ab2306e73097c1be6916 /weed/storage/volume.go | |
| parent | 15a4c91c28d41a143728677b0a73e57ef56af19c (diff) | |
| parent | 02710f96244903bb99fc6376531159d18735afdc (diff) | |
| download | seaweedfs-9ea9a5e97a513ed3cbcf04a4f14f05a344aae65c.tar.xz seaweedfs-9ea9a5e97a513ed3cbcf04a4f14f05a344aae65c.zip | |
Merge pull request #5 from chrislusf/master
merge seaweed master
Diffstat (limited to 'weed/storage/volume.go')
| -rw-r--r-- | weed/storage/volume.go | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/weed/storage/volume.go b/weed/storage/volume.go index afe3b4c8a..92839f9e6 100644 --- a/weed/storage/volume.go +++ b/weed/storage/volume.go @@ -90,51 +90,57 @@ func (v *Volume) FileStat() (datSize uint64, idxSize uint64, modTime time.Time) func (v *Volume) ContentSize() uint64 { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + if v.nm == nil { + return 0 + } return v.nm.ContentSize() } func (v *Volume) DeletedSize() uint64 { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + if v.nm == nil { + return 0 + } return v.nm.DeletedSize() } func (v *Volume) FileCount() uint64 { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + if v.nm == nil { + return 0 + } return uint64(v.nm.FileCount()) } func (v *Volume) DeletedCount() uint64 { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + if v.nm == nil { + return 0 + } return uint64(v.nm.DeletedCount()) } func (v *Volume) MaxFileKey() types.NeedleId { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + if v.nm == nil { + return 0 + } return v.nm.MaxFileKey() } func (v *Volume) IndexFileSize() uint64 { v.dataFileAccessLock.Lock() defer v.dataFileAccessLock.Unlock() + if v.nm == nil { + return 0 + } return v.nm.IndexFileSize() } -func (v *Volume) IndexFileContent() ([]byte, error) { - v.dataFileAccessLock.Lock() - defer v.dataFileAccessLock.Unlock() - return v.nm.IndexFileContent() -} - -func (v *Volume) IndexFileName() string { - v.dataFileAccessLock.Lock() - defer v.dataFileAccessLock.Unlock() - return v.nm.IndexFileName() -} - // Close cleanly shuts down this volume func (v *Volume) Close() { v.dataFileAccessLock.Lock() |
