batcher

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed is returned when a job is submitted after Close was called.
	ErrClosed = errors.New("use of closed batcher")
	// ErrCanceled is returned when a submitted job could not be processed before Close was called.
	ErrCanceled = errors.New("processing canceled")
)

Functions

This section is empty.

Types

type Curl

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

Curl defines an instance of a batched Curl hasher.

func NewCurl

func NewCurl(inputSize int, timeout time.Duration, workerCount int) *Curl

NewCurl initializes a new batched Curl instance.

func NewCurlP81

func NewCurlP81(inputSize int, timeout time.Duration, workerCount int) *Curl

NewCurlP81 returns a new batched Curl-P-81.

func (*Curl) BatchSize

func (c *Curl) BatchSize() int

BatchSize returns the maximum batch size.

func (*Curl) Close

func (c *Curl) Close() error

Close stops the batched Curl hasher. It blocks until all remaining jobs have been processed or canceled. Successive calls of Close are ignored.

func (*Curl) Hash

func (c *Curl) Hash(trits trinary.Trits) (trinary.Trits, error)

Hash returns the Curl hash of trits. It blocks until the hash has been computed or an error occurred.

func (*Curl) SubmitHash

func (c *Curl) SubmitHash(trits trinary.Trits) <-chan CurlResult

SubmitHash submits the Curl hash computation of trits to the batcher. It does not wait for the computation to finish but returns a channel for the result.

func (*Curl) WorkerCount

func (c *Curl) WorkerCount() int

WorkerCount returns the number of parallel workers computing the hashes.

type CurlResult

type CurlResult struct {
	Hash trinary.Trits
	Err  error
}

CurlResult defines the result to a submitted hash computation.

Jump to

Keyboard shortcuts

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