block

package
v0.0.0-...-96b211d Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	Temporary() bool

	Write(data []byte) error
	Verify() bool
	VerifyForce() bool

	Seek(offset int64) error
	Read(begins uint32, ends uint32, readHandler func(data []byte) error, completedHandler func(inconsistency bool) error) error

	Id() string
	Usage() uint16
	IncreaseUsage() error
	ResetUsage(uint16) error
	Size() (uint32, error)

	Delete() error
	Wipe() error
	Truncate(blockSize uint32) error

	Cancel()
	Close()
}

File handler for block file operations

func NewFile

func NewFile(root string, sha512Hex string, logger *zap.Logger) (File, error)

NewFile provides the file interface for (new) block file operations

type FileHeader

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

func NewFileHeader

func NewFileHeader(file *os.File) *FileHeader

func (*FileHeader) DecreaseUsage

func (h *FileHeader) DecreaseUsage() error

func (*FileHeader) IncreaseUsage

func (h *FileHeader) IncreaseUsage() error

func (*FileHeader) Load

func (h *FileHeader) Load() error

func (*FileHeader) ResetUsage

func (h *FileHeader) ResetUsage(usage uint16) error

func (*FileHeader) Size

func (h *FileHeader) Size() int64

func (*FileHeader) Usage

func (h *FileHeader) Usage() uint16

type Manager

type Manager interface {
	File(sha512Hex string, fileHandler func(file File) error) error
	LockFile(sha512Hex string, fileHandler func(file File) error) error

	Traverse(hexHandler func(sha512Hex string, size uint64) error) error

	Wipe() error
}

Manager interface is for file operation handling

func NewManager

func NewManager(dataPath string, logger *zap.Logger) (Manager, error)

NewManager creates the Manager interface for file operation handling

Jump to

Keyboard shortcuts

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