super_block

package
v0.0.0-...-0b345dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuperBlockSize = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ReplicaPlacement

type ReplicaPlacement struct {
	SameRackCount       int `json:"node,omitempty"`
	DiffRackCount       int `json:"rack,omitempty"`
	DiffDataCenterCount int `json:"dc,omitempty"`
}

func NewReplicaPlacementFromByte

func NewReplicaPlacementFromByte(b byte) (*ReplicaPlacement, error)

func NewReplicaPlacementFromString

func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error)

func (*ReplicaPlacement) Byte

func (rp *ReplicaPlacement) Byte() byte

func (*ReplicaPlacement) GetCopyCount

func (rp *ReplicaPlacement) GetCopyCount() int

func (*ReplicaPlacement) String

func (rp *ReplicaPlacement) String() string

type SuperBlock

type SuperBlock struct {
	Version            needle.Version
	ReplicaPlacement   *ReplicaPlacement
	Ttl                *needle.TTL
	CompactionRevision uint16
	Extra              *master_pb.SuperBlockExtra
	ExtraSize          uint16
}

* 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 ReadSuperBlock

func ReadSuperBlock(datBackend backend.BackendStorageFile) (superBlock SuperBlock, err error)

ReadSuperBlock reads from data file and load it into volume's super block

func (*SuperBlock) BlockSize

func (s *SuperBlock) BlockSize() int

func (*SuperBlock) Bytes

func (s *SuperBlock) Bytes() []byte

func (*SuperBlock) Initialized

func (s *SuperBlock) Initialized() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL