|
@ -2,6 +2,10 @@ package storage |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"fmt" |
|
|
"fmt" |
|
|
|
|
|
"path" |
|
|
|
|
|
"strconv" |
|
|
|
|
|
"sync" |
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/master_pb" |
|
|
"github.com/chrislusf/seaweedfs/weed/pb/master_pb" |
|
|
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" |
|
|
"github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb" |
|
@ -10,11 +14,6 @@ import ( |
|
|
"github.com/chrislusf/seaweedfs/weed/storage/needle" |
|
|
"github.com/chrislusf/seaweedfs/weed/storage/needle" |
|
|
"github.com/chrislusf/seaweedfs/weed/storage/types" |
|
|
"github.com/chrislusf/seaweedfs/weed/storage/types" |
|
|
|
|
|
|
|
|
"path" |
|
|
|
|
|
"strconv" |
|
|
|
|
|
"sync" |
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@ -25,7 +24,8 @@ type Volume struct { |
|
|
DataBackend backend.BackendStorageFile |
|
|
DataBackend backend.BackendStorageFile |
|
|
nm NeedleMapper |
|
|
nm NeedleMapper |
|
|
needleMapKind NeedleMapType |
|
|
needleMapKind NeedleMapType |
|
|
readOnly bool |
|
|
|
|
|
|
|
|
noWriteOrDelete bool // if readonly, either noWriteOrDelete or noWriteCanDelete
|
|
|
|
|
|
noWriteCanDelete bool // if readonly, either noWriteOrDelete or noWriteCanDelete
|
|
|
MemoryMapMaxSizeMb uint32 |
|
|
MemoryMapMaxSizeMb uint32 |
|
|
|
|
|
|
|
|
SuperBlock |
|
|
SuperBlock |
|
@ -51,7 +51,7 @@ func NewVolume(dirname string, collection string, id needle.VolumeId, needleMapK |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
func (v *Volume) String() string { |
|
|
func (v *Volume) String() string { |
|
|
return fmt.Sprintf("Id:%v, dir:%s, Collection:%s, dataFile:%v, nm:%v, readOnly:%v", v.Id, v.dir, v.Collection, v.DataBackend, v.nm, v.readOnly) |
|
|
|
|
|
|
|
|
return fmt.Sprintf("Id:%v, dir:%s, Collection:%s, dataFile:%v, nm:%v, noWrite:%v canDelete:%v", v.Id, v.dir, v.Collection, v.DataBackend, v.nm, v.noWriteOrDelete || v.noWriteCanDelete, v.noWriteCanDelete) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func VolumeFileName(dir string, collection string, id int) (fileName string) { |
|
|
func VolumeFileName(dir string, collection string, id int) (fileName string) { |
|
@ -210,7 +210,7 @@ func (v *Volume) ToVolumeInformationMessage() *master_pb.VolumeInformationMessag |
|
|
FileCount: uint64(v.FileCount()), |
|
|
FileCount: uint64(v.FileCount()), |
|
|
DeleteCount: uint64(v.DeletedCount()), |
|
|
DeleteCount: uint64(v.DeletedCount()), |
|
|
DeletedByteCount: v.DeletedSize(), |
|
|
DeletedByteCount: v.DeletedSize(), |
|
|
ReadOnly: v.readOnly, |
|
|
|
|
|
|
|
|
ReadOnly: v.noWriteOrDelete, |
|
|
ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()), |
|
|
ReplicaPlacement: uint32(v.ReplicaPlacement.Byte()), |
|
|
Version: uint32(v.Version()), |
|
|
Version: uint32(v.Version()), |
|
|
Ttl: v.Ttl.ToUint32(), |
|
|
Ttl: v.Ttl.ToUint32(), |
|
|