download

package
v0.0.0-...-cd21dfb Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MetadataSize = common.HashLength + 8 + 8

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadingFile

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

func CreateDownloadingFile

func CreateDownloadingFile(filename string, root common.Hash, size int64) (*DownloadingFile, error)

func (*DownloadingFile) Close

func (file *DownloadingFile) Close() error

func (*DownloadingFile) Metadata

func (file *DownloadingFile) Metadata() *Metadata

func (*DownloadingFile) Seal

func (file *DownloadingFile) Seal() error

func (*DownloadingFile) Write

func (file *DownloadingFile) Write(data []byte) error

type Metadata

type Metadata struct {
	Root   common.Hash // file merkle root
	Size   int64       // file size to download
	Offset int64       // offset to write for the next time
}

func DeserializeMedata

func DeserializeMedata(encoded []byte) (*Metadata, error)

func LoadMetadata

func LoadMetadata(file *os.File) (*Metadata, error)

func NewMetadata

func NewMetadata(root common.Hash, size int64) *Metadata

func (*Metadata) Extend

func (md *Metadata) Extend(file *os.File) error

func (*Metadata) Serialize

func (md *Metadata) Serialize() []byte

func (*Metadata) Write

func (md *Metadata) Write(file *os.File, data []byte) error

Jump to

Keyboard shortcuts

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