Documentation ¶
Index ¶
- Constants
- func CheckDataIntegrity(v *Volume, indexFile *os.File) error
- func SortVolumeInfos(vis volumeInfos)
- func VolumeFileName(collection string, dir string, id int) (fileName string)
- type FileId
- type GrowOption
- type SuperBlock
- type Volume
- func (v *Volume) Close()
- func (v *Volume) CommitCompact() error
- func (v *Volume) Compact() error
- func (v *Volume) ContentSize() uint64
- func (v *Volume) DeleteNeedle(n *needle.Needle) (uint32, error)
- func (v *Volume) Destroy() (err error)
- func (v *Volume) ExiredLongEnough(maxDelayMinutes uint32) bool
- func (v *Volume) Expired(volumeSizeLimit uint64) bool
- func (v *Volume) FileName() (fileName string)
- func (v *Volume) FileStat() (datSize uint64, idxSize uint64, modTime time.Time)
- func (v *Volume) GarbageLevel() float64
- func (v *Volume) NeedToReplicate() bool
- func (v *Volume) ReadNeedle(n *needle.Needle) (int, error)
- func (v *Volume) Size() int64
- func (v *Volume) ToVolumeInformationMessage() *pb.VolumeInformationMessage
- func (v *Volume) WriteNeedle(n *needle.Needle) (size uint32, isUnchanged bool, err error)
- type VolumeInfo
Constants ¶
View Source
const (
SuperBlockSize = 8
)
Variables ¶
This section is empty.
Functions ¶
func SortVolumeInfos ¶
func SortVolumeInfos(vis volumeInfos)
Types ¶
type FileId ¶
func NewFileIdFromNeedle ¶
type GrowOption ¶
type SuperBlock ¶
type SuperBlock struct { ReplicaPlacement *replicate.Placement Ttl *ttl.TTL CompactRevision uint16 // contains filtered or unexported fields }
* Super block currently has 8 bytes allocated for each volume. * Byte 0: version, 1 or 2 * Byte 1: Replica Placement strategy, 000, 001, 002, 010, etc * Byte 2 and byte 3: Time to live. See TTL for definition * Byte 4 and byte 5: The number of times the volume has been compacted. * Rest bytes: Reserved
func ParseSuperBlock ¶
func ParseSuperBlock(header []byte) (superBlock SuperBlock, err error)
func (*SuperBlock) Bytes ¶
func (s *SuperBlock) Bytes() []byte
func (*SuperBlock) Version ¶
func (s *SuperBlock) Version() version.Version
type Volume ¶
type Volume struct { Id util.VIDType Collection string NM needle.Mapper ReadOnly bool SuperBlock // contains filtered or unexported fields }
func (*Volume) ContentSize ¶
func (*Volume) ExiredLongEnough ¶
wait either maxDelayMinutes or 10% of ttl minutes
func (*Volume) GarbageLevel ¶
func (*Volume) NeedToReplicate ¶
func (*Volume) ReadNeedle ¶
read fills in Needle content by looking up n.Id from NeedleMapper
func (*Volume) ToVolumeInformationMessage ¶
func (v *Volume) ToVolumeInformationMessage() *pb.VolumeInformationMessage
type VolumeInfo ¶
type VolumeInfo struct { Id util.VIDType `json:"ID"` Size uint64 `json:"Size"` ReplicaPlacement *replicate.Placement Ttl *ttl.TTL `json:"TTL"` Collection string Version version.Version `json:"Version"` FileCount int `json:"FileCount"` DeleteCount int `json:"DeleteCount"` DeletedByteCount uint64 `json:"DeletedByteCount"` ReadOnly bool `json:"ReadOnly"` }
func NewVolumeInfo ¶
func NewVolumeInfo(m *pb.VolumeInformationMessage) (vi VolumeInfo, err error)
func (VolumeInfo) String ¶
func (vi VolumeInfo) String() string
Click to show internal directories.
Click to hide internal directories.