blocks

package
v0.0.0-...-e27afb6 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PartSize is a cache-optimized length that is used to send and share parts of a block amongst a group of nodes.
	// It is also used during uploads and downloads as the segment sizes to avoid buffering gigabytes of data in memory.
	PartSize = 64 * Kibibyte
)

Functions

func ComputeSignature

func ComputeSignature(algorithm string, data []byte) (string, error)

ComputeSignature will produce a signature string for the blob using the algorithm.

Types

type Block

type Block struct {
	Segments []*FileSegment
	Size     int64
}

Block allows data to be read from directly from file segments.

func (*Block) Read

func (b *Block) Read(p []byte) (n int, err error)

type FileSegment

type FileSegment struct {
	FilePath string
	Offset   int64
	Size     int64
}

FileSegment defines a part of a file used to construct a block.

func (*FileSegment) Read

func (f *FileSegment) Read(p []byte) (n int, err error)

type Size

type Size int32
const (
	Byte Size = 1 << (10 * iota)
	Kibibyte
	Mebibyte
)

Jump to

Keyboard shortcuts

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