pipeline

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: BSD-3-Clause Imports: 14 Imported by: 9

Documentation

Overview

Package pipeline provides functionality for hashing pipelines needed to create different flavors of merkelised representations

of arbitrary data. The interface exposes an io.Writer and Sum method, for components to use as a black box. Within a pipeline, writers are chainable. It is up for the implementer to decide whether a writer calls the next writer. Implementers should always implement the Sum method and call the next writer's Sum method (in case there is one), returning its result to the calling context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FeedPipeline

func FeedPipeline(ctx context.Context, pipeline Interface, r io.Reader, dataLength int64) (addr swarm.Address, err error)

FeedPipeline feeds the pipeline with the given reader until EOF is reached. It returns the cryptographic root hash of the content.

Types

type Interface

type Interface interface {
	io.Writer
	Sum() ([]byte, error)
}

Interface exposes an `io.Writer` and `Sum` method, for components to use as a black box. Within a pipeline, writers are chainable. It is up for the implementer to decide whether a writer calls the next writer. Implementers should always implement the `Sum` method and call the next writer's `Sum` method (in case there is one), returning its result to the calling context.

func NewPipelineBuilder

func NewPipelineBuilder(ctx context.Context, s storage.Storer, mode storage.ModePut, encrypt bool) Interface

NewPipelineBuilder returns the appropriate pipeline according to the specified parameters

Jump to

Keyboard shortcuts

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