bapl

package
v0.0.0-...-648c852 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

Batch Pool

This package holds API of the BatchPool.

MemPool

MemPool implements BatchPool solely in memory.

MulticastPool

MulticastPool implements multicast pool that directly multicast batches to remote peers simultaneously.

Documentation

Overview

Package bapl implements rudimentary implementation of BatchPool

Index

Constants

This section is empty.

Variables

View Source
var ErrBatchDeleted = errors.New("batch deleted")

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Data      []byte
	Signature crypto.Signature
}

func (*Batch) Hash

func (b *Batch) Hash() []byte

type BatchPool

type BatchPool interface {
	Push(context.Context, *Batch) error
	Pull(context.Context, []byte) (*Batch, error)
	ListBySigner(context.Context, []byte) ([]*Batch, error)
	Delete(context.Context, []byte) error
	Size(context.Context) (int, error)
}

type BatchVerifier

type BatchVerifier interface {
	Verify(context.Context, *Batch) (bool, error)
}

type FetchIncludersFn

type FetchIncludersFn func() []peer.ID

type MemPool

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

func NewMemPool

func NewMemPool() *MemPool

func (*MemPool) Close

func (p *MemPool) Close()

func (*MemPool) Delete

func (p *MemPool) Delete(_ context.Context, hash []byte) error

func (*MemPool) ListBySigner

func (p *MemPool) ListBySigner(_ context.Context, key []byte) ([]*Batch, error)

func (*MemPool) Pull

func (p *MemPool) Pull(ctx context.Context, hash []byte) (*Batch, error)

func (*MemPool) Push

func (p *MemPool) Push(_ context.Context, batch *Batch) error

func (*MemPool) Size

func (p *MemPool) Size(context.Context) (int, error)

type MulticastPool

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

func NewMulticastPool

func NewMulticastPool(
	pool BatchPool,
	host host.Host,
	includers FetchIncludersFn,
	signer crypto.Signer,
	verifier BatchVerifier,
) *MulticastPool

func (*MulticastPool) Delete

func (p *MulticastPool) Delete(ctx context.Context, hash []byte) error

func (*MulticastPool) ListBySigner

func (p *MulticastPool) ListBySigner(ctx context.Context, bytes []byte) ([]*Batch, error)

func (*MulticastPool) Pull

func (p *MulticastPool) Pull(ctx context.Context, hash []byte) (*Batch, error)

func (*MulticastPool) Push

func (p *MulticastPool) Push(ctx context.Context, batch *Batch) error

func (*MulticastPool) Size

func (p *MulticastPool) Size(ctx context.Context) (int, error)

func (*MulticastPool) Start

func (p *MulticastPool) Start()

func (*MulticastPool) Stop

func (p *MulticastPool) Stop()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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