Documentation
¶
Index ¶
- Constants
- Variables
- func CreateDeliverEnvelope(channelID string, signingIdentity driver.SigningIdentity, ...) (*common.Envelope, error)
- func CreateEnvelope(data []byte, header *common.Header, signingIdentity driver.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 DeliverClient
- type DeliverFiltered
- type DeliverStream
- type Delivery
- type Hasher
- type Service
- type Services
- type TxEvent
- type ValidationFlags
- 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 driver.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 driver.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 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 services.PeerClient) (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 { NetworkName string LocalMembership driver.LocalMembership ConfigService driver.ConfigService Services Services Ledger driver.Ledger // contains filtered or unexported fields }
func New ¶
func New( networkName string, channelConfig driver.ChannelConfig, hasher Hasher, LocalMembership driver.LocalMembership, ConfigService driver.ConfigService, PeerManager Services, Ledger driver.Ledger, callback driver.BlockCallback, vault Vault, waitForEventTimeout time.Duration, tracerProvider trace.TracerProvider, _ metrics.Provider, ) (*Delivery, error)
func (*Delivery) GetStartPosition ¶
func (d *Delivery) GetStartPosition() *ab.SeekPosition
type Service ¶ added in v0.4.0
type Service struct { NetworkName string LocalMembership driver.LocalMembership ConfigService driver.ConfigService PeerManager Services Ledger driver.Ledger // contains filtered or unexported fields }
func NewService ¶ added in v0.4.0
func NewService( channel string, channelConfig driver.ChannelConfig, hasher hash.Hasher, networkName string, localMembership driver.LocalMembership, configService driver.ConfigService, peerManager Services, ledger driver.Ledger, waitForEventTimeout time.Duration, txIDStore driver.TXIDStore, transactionManager driver.TransactionManager, callback driver.BlockCallback, tracerProvider trace.TracerProvider, metricsProvider metrics.Provider, ) (*Service, error)
type Services ¶ added in v0.4.0
type Services interface {
NewPeerClient(cc grpc.ConnectionConfig) (services.PeerClient, error)
}
type TxEvent ¶
type TxEvent struct { TxID string Committed bool Block uint64 IndexInBlock int CommitPeer string Err error }
TxEvent contains information for token transaction commit
type ValidationFlags ¶ added in v0.4.0
type ValidationFlags []uint8