Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDeliverEnvelope(channelID string, signingIdentity SigningIdentity, cert *tls.Certificate, ...) (*common.Envelope, error)
- func CreateEnvelope(data []byte, header *common.Header, signingIdentity SigningIdentity) (*common.Envelope, error)
- func CreateHeader(txType common.HeaderType, channelID string, creator []byte, tlsCertHash []byte) (string, *common.Header, error)
- func DeliverReceive(df DeliverFiltered, address string, txid string, eventCh chan<- TxEvent) error
- func DeliverSend(df DeliverStream, envelope *common.Envelope) error
- func DeliverWaitForResponse(ctx context.Context, eventCh <-chan TxEvent, txid string) (bool, uint64, int, error)
- func GetRandomBytes(len int) ([]byte, error)
- func GetRandomNonce() ([]byte, error)
- type Callback
- type DeliverClient
- type DeliverFiltered
- type DeliverStream
- type Delivery
- type Hasher
- type Network
- type SigningIdentity
- type TxEvent
- type Vault
Constants ¶
const (
// NonceSize is the default NonceSize
NonceSize = 24
)
Variables ¶
var ( ErrComm = errors.New("communication issue") StartGenesis = &ab.SeekPosition{ Type: &ab.SeekPosition_Oldest{ Oldest: &ab.SeekOldest{}, }, } )
Functions ¶
func CreateDeliverEnvelope ¶
func CreateDeliverEnvelope(channelID string, signingIdentity SigningIdentity, cert *tls.Certificate, hasher Hasher, start *ab.SeekPosition) (*common.Envelope, error)
CreateDeliverEnvelope creates a signed envelope with SeekPosition_Newest for block
func CreateEnvelope ¶
func CreateEnvelope(data []byte, header *common.Header, signingIdentity SigningIdentity) (*common.Envelope, error)
CreateEnvelope creates a common.Envelope with given tx bytes, header, and SigningIdentity
func CreateHeader ¶
func CreateHeader(txType common.HeaderType, channelID string, creator []byte, tlsCertHash []byte) (string, *common.Header, error)
CreateHeader creates common.Header for a token transaction tlsCertHash is for client TLS cert, only applicable when ClientAuthRequired is true
func DeliverReceive ¶
func DeliverReceive(df DeliverFiltered, address string, txid string, eventCh chan<- TxEvent) error
func DeliverSend ¶
func DeliverSend(df DeliverStream, envelope *common.Envelope) error
func DeliverWaitForResponse ¶
func DeliverWaitForResponse(ctx context.Context, eventCh <-chan TxEvent, txid string) (bool, uint64, int, error)
DeliverWaitForResponse waits for either eventChan has value (i.e., response has been received) or ctx is timed out This function assumes that the eventCh is only for the specified txid If an eventCh is shared by multiple transactions, a loop should be used to listen to events from multiple transactions
func GetRandomBytes ¶
GetRandomBytes returns len random looking bytes
func GetRandomNonce ¶
GetRandomNonce returns a random byte array of length NonceSize
Types ¶
type Callback ¶
Callback is the callback function prototype to alert the rest of the stack about the availability of a new block. The function returns two argument a boolean to signal if delivery should be stopped, and an error to signal an issue during the processing of the block. In case of an error, the same block is re-processed after a delay.
type DeliverClient ¶
type DeliverClient interface { // NewDeliverFiltered returns a DeliverFiltered NewDeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (DeliverFiltered, error) // NewDeliver returns a DeliverStream NewDeliver(ctx context.Context, opts ...grpc.CallOption) (DeliverStream, error) // Certificate returns tls certificate for the deliver client to peer Certificate() *tls.Certificate }
DeliverClient defines the interface to create a DeliverStream client
func NewDeliverClient ¶
func NewDeliverClient(client peer.Client) (DeliverClient, error)
type DeliverFiltered ¶
type DeliverFiltered interface { Send(*common.Envelope) error Recv() (*pb.DeliverResponse, error) CloseSend() error }
DeliverFiltered defines the interface that abstracts deliver filtered grpc calls to peer
type DeliverStream ¶
type DeliverStream interface { Send(*common.Envelope) error Recv() (*pb.DeliverResponse, error) CloseSend() error }
DeliverStream defines the interface that abstracts deliver grpc calls to peer
type Delivery ¶
type Delivery struct {
// contains filtered or unexported fields
}
func (*Delivery) GetStartPosition ¶
func (d *Delivery) GetStartPosition() *ab.SeekPosition
type Network ¶
type Network interface { Channel(name string) (driver.Channel, error) PickPeer() *grpc.ConnectionConfig LocalMembership() driver.LocalMembership }