Documentation ¶
Index ¶
- Constants
- Variables
- func EcShardBaseFileName(collection string, id int) (baseFileName string)
- func EcShardFileName(collection string, dir string, id int) (fileName string)
- func RebuildEcFiles(baseFileName string) ([]uint32, error)
- func RebuildEcxFile(baseFileName string) error
- func ToExt(ecIndex int) string
- func WriteEcFiles(baseFileName string) error
- func WriteSortedEcxFile(baseFileName string) (e error)
- type EcVolume
- func (ev *EcVolume) AddEcVolumeShard(ecVolumeShard *EcVolumeShard) bool
- func (ev *EcVolume) Close()
- func (ev *EcVolume) CreatedAt() time.Time
- func (ev *EcVolume) DeleteEcVolumeShard(shardId ShardId) (ecVolumeShard *EcVolumeShard, deleted bool)
- func (ev *EcVolume) DeleteNeedleFromEcx(needleId types.NeedleId) (err error)
- func (ev *EcVolume) Destroy()
- func (ev *EcVolume) FileName() string
- func (ev *EcVolume) FindEcVolumeShard(shardId ShardId) (ecVolumeShard *EcVolumeShard, found bool)
- func (ev *EcVolume) FindNeedleFromEcx(needleId types.NeedleId) (offset types.Offset, size uint32, err error)
- func (ev *EcVolume) LocateEcShardNeedle(needleId types.NeedleId, version needle.Version) (offset types.Offset, size uint32, intervals []Interval, err error)
- func (ev *EcVolume) ShardIdList() (shardIds []ShardId)
- func (ev *EcVolume) ShardSize() int64
- func (ev *EcVolume) ToVolumeEcShardInformationMessage() (messages []*master_pb.VolumeEcShardInformationMessage)
- type EcVolumeInfo
- func (ecInfo *EcVolumeInfo) AddShardId(id ShardId)
- func (ecInfo *EcVolumeInfo) HasShardId(id ShardId) bool
- func (ecInfo *EcVolumeInfo) Minus(other *EcVolumeInfo) *EcVolumeInfo
- func (ecInfo *EcVolumeInfo) RemoveShardId(id ShardId)
- func (ecInfo *EcVolumeInfo) ShardIdCount() (count int)
- func (ecInfo *EcVolumeInfo) ShardIds() (ret []ShardId)
- func (ecInfo *EcVolumeInfo) ToVolumeEcShardInformationMessage() (ret *master_pb.VolumeEcShardInformationMessage)
- type EcVolumeShard
- type Interval
- type ShardBits
- func (b ShardBits) AddShardId(id ShardId) ShardBits
- func (b ShardBits) HasShardId(id ShardId) bool
- func (b ShardBits) Minus(other ShardBits) ShardBits
- func (b ShardBits) Plus(other ShardBits) ShardBits
- func (b ShardBits) RemoveShardId(id ShardId) ShardBits
- func (b ShardBits) ShardIdCount() (count int)
- func (b ShardBits) ShardIds() (ret []ShardId)
- type ShardId
Constants ¶
View Source
const ( DataShardsCount = 10 ParityShardsCount = 4 TotalShardsCount = DataShardsCount + ParityShardsCount ErasureCodingLargeBlockSize = 1024 * 1024 * 1024 // 1GB ErasureCodingSmallBlockSize = 1024 * 1024 // 1MB )
Variables ¶
View Source
var (
NotFoundError = errors.New("needle not found")
)
Functions ¶
func EcShardBaseFileName ¶
func EcShardFileName ¶
func RebuildEcFiles ¶
func RebuildEcxFile ¶
func WriteEcFiles ¶
WriteEcFiles generates .ec01 ~ .ec14 files
func WriteSortedEcxFile ¶
WriteSortedEcxFile generates .ecx file from existing .idx file all keys are sorted in ascending order
Types ¶
type EcVolume ¶
type EcVolume struct { VolumeId needle.VolumeId Collection string Shards []*EcVolumeShard ShardLocations map[ShardId][]string ShardLocationsRefreshTime time.Time ShardLocationsLock sync.RWMutex Version needle.Version // contains filtered or unexported fields }
func NewEcVolume ¶
func (*EcVolume) AddEcVolumeShard ¶
func (ev *EcVolume) AddEcVolumeShard(ecVolumeShard *EcVolumeShard) bool
func (*EcVolume) DeleteEcVolumeShard ¶
func (ev *EcVolume) DeleteEcVolumeShard(shardId ShardId) (ecVolumeShard *EcVolumeShard, deleted bool)
func (*EcVolume) DeleteNeedleFromEcx ¶
func (*EcVolume) FindEcVolumeShard ¶
func (ev *EcVolume) FindEcVolumeShard(shardId ShardId) (ecVolumeShard *EcVolumeShard, found bool)
func (*EcVolume) FindNeedleFromEcx ¶
func (*EcVolume) LocateEcShardNeedle ¶
func (*EcVolume) ShardIdList ¶
func (*EcVolume) ToVolumeEcShardInformationMessage ¶
func (ev *EcVolume) ToVolumeEcShardInformationMessage() (messages []*master_pb.VolumeEcShardInformationMessage)
type EcVolumeInfo ¶
data structure used in master
func NewEcVolumeInfo ¶
func NewEcVolumeInfo(collection string, vid needle.VolumeId, shardBits ShardBits) *EcVolumeInfo
func (*EcVolumeInfo) AddShardId ¶
func (ecInfo *EcVolumeInfo) AddShardId(id ShardId)
func (*EcVolumeInfo) HasShardId ¶
func (ecInfo *EcVolumeInfo) HasShardId(id ShardId) bool
func (*EcVolumeInfo) Minus ¶
func (ecInfo *EcVolumeInfo) Minus(other *EcVolumeInfo) *EcVolumeInfo
func (*EcVolumeInfo) RemoveShardId ¶
func (ecInfo *EcVolumeInfo) RemoveShardId(id ShardId)
func (*EcVolumeInfo) ShardIdCount ¶
func (ecInfo *EcVolumeInfo) ShardIdCount() (count int)
func (*EcVolumeInfo) ShardIds ¶
func (ecInfo *EcVolumeInfo) ShardIds() (ret []ShardId)
func (*EcVolumeInfo) ToVolumeEcShardInformationMessage ¶
func (ecInfo *EcVolumeInfo) ToVolumeEcShardInformationMessage() (ret *master_pb.VolumeEcShardInformationMessage)
type EcVolumeShard ¶
type EcVolumeShard struct { VolumeId needle.VolumeId ShardId ShardId Collection string // contains filtered or unexported fields }
func NewEcVolumeShard ¶
func (*EcVolumeShard) Close ¶
func (shard *EcVolumeShard) Close()
func (*EcVolumeShard) Destroy ¶
func (shard *EcVolumeShard) Destroy()
func (*EcVolumeShard) FileName ¶
func (shard *EcVolumeShard) FileName() (fileName string)
func (*EcVolumeShard) ReadAt ¶
func (shard *EcVolumeShard) ReadAt(buf []byte, offset int64) (int, error)
func (*EcVolumeShard) Size ¶
func (shard *EcVolumeShard) Size() int64
func (*EcVolumeShard) String ¶
func (shard *EcVolumeShard) String() string
type Interval ¶
type Interval struct { BlockIndex int InnerBlockOffset int64 Size uint32 IsLargeBlock bool LargeBlockRowsCount int }
func LocateData ¶
type ShardBits ¶
type ShardBits uint32 // use bits to indicate the shard id, use 32 bits just for possible future extension
func (ShardBits) AddShardId ¶
func (ShardBits) HasShardId ¶
func (ShardBits) RemoveShardId ¶
func (ShardBits) ShardIdCount ¶
Click to show internal directories.
Click to hide internal directories.