backend

package
v1.0.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package backend is a generated protocol buffer package.

It is generated from these files:

backend/consensus.proto

It has these top-level messages:

Handshake

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 RegisterConsensusServer

func RegisterConsensusServer(s *grpc.Server, srv ConsensusServer)

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][]byte, conn *connection.Manager, persist *persist.Persist) (*Backend, error)

func (*Backend) AddReceiver

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

AddReceiver adds a receiver instance for a given chainId

func (*Backend) AddSbftPeer

func (b *Backend) AddSbftPeer(chainID string, support multichain.ConsenterSupport, config *s.Config) (*s.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 *s.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) ([]*s.Request, []filter.Committer)

func (*Backend) Deliver

func (b *Backend) Deliver(chainId string, batch *s.Batch, committers []commonfilter.Committer)

Deliver writes a block

func (*Backend) Enqueue

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

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) *s.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 *s.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) Timer

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

Timer starts a timer

func (*Backend) Unicast

func (b *Backend) Unicast(chainID string, msg *s.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 *s.Request) ([][]*s.Request, [][]filter.Committer, bool)

type ConsensusClient

type ConsensusClient interface {
	Consensus(ctx context.Context, in *Handshake, opts ...grpc.CallOption) (Consensus_ConsensusClient, error)
}

func NewConsensusClient

func NewConsensusClient(cc *grpc.ClientConn) ConsensusClient

type ConsensusServer

type ConsensusServer interface {
	Consensus(*Handshake, Consensus_ConsensusServer) error
}

type Consensus_ConsensusClient

type Consensus_ConsensusClient interface {
	Recv() (*simplebft.MultiChainMsg, error)
	grpc.ClientStream
}

type Consensus_ConsensusServer

type Consensus_ConsensusServer interface {
	Send(*simplebft.MultiChainMsg) error
	grpc.ServerStream
}

type Executable

type Executable interface {
	Execute(*Backend)
}

type Handshake

type Handshake struct {
}

func (*Handshake) Descriptor

func (*Handshake) Descriptor() ([]byte, []int)

func (*Handshake) ProtoMessage

func (*Handshake) ProtoMessage()

func (*Handshake) Reset

func (m *Handshake) Reset()

func (*Handshake) String

func (m *Handshake) String() string

type PeerInfo

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

type StackConfig

type StackConfig struct {
	ListenAddr string
	CertFile   string
	KeyFile    string
	DataDir    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