bitmap

package
v0.0.0-...-7c30a37 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParseError

func NewParseError(blockIndex uint32, err error) error

NewParseError returns a new ParseError instance. The parameter blockIndex represents index of the block whose bitmap failed to parse The parameter err is the underlying error for parse failure.

Types

type BitMap

type BitMap struct {
	Length int32
	// contains filtered or unexported fields
}

BitMap type represents 'bitmap section' of a block.

func NewBitMapFromByteSlice

func NewBitMapFromByteSlice(b []byte) *BitMap

NewBitMapFromByteSlice creates a new BitMap, b is the byte slice that needs to be used as bitmap source. The caller should not reuse this byte slice anymore.

func NewBitMapFromByteSliceCopy

func NewBitMapFromByteSliceCopy(b []byte) *BitMap

NewBitMapFromByteSliceCopy creates a new BitMap, b is the byte slice that needs to be used as bitmap source. The caller can reuse the byte slice as this method creates a copy of it.

func (*BitMap) Get

func (b *BitMap) Get(idx int32) (bool, error)

Get returns the value of the bit at the given index. It returns error if idx < 0 or idx >= bitsCount.

func (*BitMap) Set

func (b *BitMap) Set(idx int32, value bool) error

Set sets the bit at the given index. It returns error if idx < 0 or idx >= bitsCount.

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory type is used to create BitMap instance by reading 'bitmap section' of a block.

func NewFactory

func NewFactory(vhdReader *reader.VhdReader, blockAllocationTable *bat.BlockAllocationTable) *Factory

NewFactory creates a new instance of Factory, which can be used to create a BitMap instance by reading the 'bitmap section' of a block. vhdReader is the reader to read the disk, blockAllocationTable wraps the disk's BAT table, which has one entry per block, this is used to retrieve the absolute offset to the beginning of the 'bitmap section' of a block and the size of the 'bitmap section'.

func (*Factory) Create

func (f *Factory) Create(blockIndex uint32) (*BitMap, error)

Create creates a BitMap instance by reading block's 'bitmap section', block is the index of the block entry in the BAT whose 'bitmap section' needs to be read. This function return error if any error occurs while reading or parsing the block's bitmap.

type ParseError

type ParseError struct {
	BlockIndex uint32
	// contains filtered or unexported fields
}

ParseError is the error type representing parsing error of a block's bitmap.

func (*ParseError) Error

func (e *ParseError) Error() string

Error returns the string representation of the BitmapParseError instance.

func (*ParseError) GetInnerErr

func (e *ParseError) GetInnerErr() error

GetInnerErr returns the inner error, this method satisfies InnerErr interface

Jump to

Keyboard shortcuts

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