internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SimpleJoinerJob

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

SimpleJoinerJob encapsulates a single joiner operation, providing the consumer with blockwise reads of data represented by a content addressed chunk tree.

Every chunk has a span length, which is a 64-bit integer in little-endian encoding stored as a prefix in the chunk itself. This represents the length of the data that reference represents.

If a chunk's span length is greater than swarm.ChunkSize, the chunk will be treated as an intermediate chunk, meaning the contents of the chunk are handled as references to other chunks which in turn are retrieved.

Otherwise it passes the data chunk to the io.Reader and blocks until the consumer reads the chunk.

The process is repeated until the readCount reaches the announced spanLength of the chunk.

func NewSimpleJoinerJob

func NewSimpleJoinerJob(ctx context.Context, getter storage.Getter, rootChunk swarm.Chunk) *SimpleJoinerJob

NewSimpleJoinerJob creates a new simpleJoinerJob.

func (*SimpleJoinerJob) Close

func (j *SimpleJoinerJob) Close() error

Close is called by the consumer to gracefully abort the data retrieval.

func (*SimpleJoinerJob) Read

func (j *SimpleJoinerJob) Read(b []byte) (n int, err error)

Read is called by the consumer to retrieve the joined data. It must be called with a buffer equal to the maximum chunk size.

Jump to

Keyboard shortcuts

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