block_device

package
v0.0.0-...-71dce46 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockHeaderSize = 32 // 4 fields * 8 byte fields
)

Variables

View Source
var (
	BlockSize    uint64 = 4096 // number of bytes in a device block
	MetadataSize        = BlockSize

	MagicSentence = []byte("I am a torus block device!")
	MagicLen      = len(MagicSentence)
)

Functions

func GetDeviceSize

func GetDeviceSize(deviceFile *os.File) (uint64, error)

Types

type BlockHeader

type BlockHeader struct {
	Volume   uint64
	Inode    uint64
	Index    uint64
	Location uint64
}

func (*BlockHeader) Equal

func (b *BlockHeader) Equal(b2 *BlockHeader) bool

func (*BlockHeader) IsNil

func (b *BlockHeader) IsNil() bool

func (*BlockHeader) Marshal

func (b *BlockHeader) Marshal(buf []byte)

func (*BlockHeader) String

func (b *BlockHeader) String() string

func (*BlockHeader) Unmarshal

func (b *BlockHeader) Unmarshal(buf []byte)

type BlockHeaders

type BlockHeaders []*BlockHeader

func NewBlockHeaders

func NewBlockHeaders() BlockHeaders

func (BlockHeaders) Add

func (bs BlockHeaders) Add(b *BlockHeader) error

func (BlockHeaders) Delete

func (bs BlockHeaders) Delete(br torus.BlockRef)

func (BlockHeaders) IsUsed

func (bs BlockHeaders) IsUsed() bool

func (BlockHeaders) Marshal

func (bs BlockHeaders) Marshal(buf []byte) error

func (BlockHeaders) String

func (bs BlockHeaders) String() string

func (BlockHeaders) Unmarshal

func (bs BlockHeaders) Unmarshal(buf []byte) error

type Metadata

type Metadata struct {
	TorusBlockSize     uint64
	FormattedTimestamp time.Time
	UsedBlocks         uint64
}

func (*Metadata) Marshal

func (m *Metadata) Marshal() []byte

func (*Metadata) Unmarshal

func (m *Metadata) Unmarshal(buf []byte) error

Jump to

Keyboard shortcuts

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