backend

package
v0.0.0-...-7491e2d Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSig

func CheckSig(publicKey crypto.PublicKey, data []byte, sig []byte) error

CheckSig checks a signature

func Sign

func Sign(privateKey crypto.PrivateKey, data []byte) []byte

Sign signs a given data

Types

type Backend

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

func NewBackend

func NewBackend(peers map[string]*sb.Consenter, conn *connection.Manager, persist *persist.Persist, tlsCert []byte, localMsp string) (*Backend, error)

func (*Backend) AddReceiver

func (b *Backend) AddReceiver(chainId string, recv simplebft.Receiver)

AddReceiver adds a receiver instance for a given chainId

func (*Backend) AddSbftPeer

func (b *Backend) AddSbftPeer(chainID string, support consensus.ConsenterSupport, config *sb.Options) (*simplebft.SBFT, error)

AddSbftPeer adds a new SBFT peer for the given chainId using the given support and configuration

func (*Backend) Broadcast

func (b *Backend) Broadcast(msg *sb.MultiChainMsg) error

Unicast sends to all external SBFT peers

func (*Backend) CheckSig

func (b *Backend) CheckSig(data []byte, src uint64, sig []byte) error

CheckSig checks a signature

func (*Backend) Cut

func (b *Backend) Cut(chainID string) []*sb.Request

func (*Backend) Deliver

func (b *Backend) Deliver(chainId string, batch *sb.Batch)

Deliver writes a block

func (*Backend) Enqueue

func (b *Backend) Enqueue(chainID string, env *cb.Envelope) error

Enqueue enqueues an Envelope for a chainId for ordering, marshalling it first

func (*Backend) GetMyId

func (b *Backend) GetMyId() uint64

GetMyId returns the ID of the backend in the SFTT network (1..N)

func (*Backend) LastBatch

func (b *Backend) LastBatch(chainId string) *sb.Batch

LastBatch returns the last batch for a given chain identified by its ID

func (*Backend) Persist

func (b *Backend) Persist(chainId string, key string, data proto.Message)

Persist persists data identified by a chainId and a key

func (*Backend) Reconnect

func (b *Backend) Reconnect(chainId string, replica uint64)

Reconnect requests connection to a replica identified by its ID and chainId

func (*Backend) Restore

func (b *Backend) Restore(chainId string, key string, out proto.Message) bool

Restore loads persisted data identified by chainId and key

func (*Backend) Send

func (b *Backend) Send(chainID string, msg *sb.Msg, dest uint64)

Send sends to a specific SBFT peer identified by chainId and dest

func (*Backend) Sign

func (b *Backend) Sign(data []byte) []byte

Sign signs a given data

func (*Backend) StartAndConnectWorkers

func (b *Backend) StartAndConnectWorkers()

func (*Backend) Timer

func (b *Backend) Timer(d time.Duration, tf func()) simplebft.Canceller

Timer starts a timer

func (*Backend) Unicast

func (b *Backend) Unicast(chainID string, msg *sb.Msg, dest uint64) error

Unicast sends to a specific external SBFT peer identified by chainId and dest

func (*Backend) Validate

func (b *Backend) Validate(chainID string, req *sb.Request) ([][]*sb.Request, bool)

type Executable

type Executable interface {
	Execute(*Backend)
}

type PeerInfo

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

type StackConfig

type StackConfig struct {
	ListenAddr string
	CertFile   string
	KeyFile    string
	WALDir     string
	SnapDir    string
}

type Timer

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

func (*Timer) Cancel

func (t *Timer) Cancel()

func (*Timer) Execute

func (t *Timer) Execute(backend *Backend)

Jump to

Keyboard shortcuts

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