testclient

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelAdapter

type ChannelAdapter interface {
	GetInterestedChannels() ([]string, error)
	GetInterestedEvents() ([]*peer.Interest, error)
	Recv(msg *api.ChannelServiceResponse) (bool, error)
	Disconnected(err error)
}

ChannelAdapter is the interface by which a fabric channel service client registers for interested channels and receives events from the channel service server. This is a reference Go implementation of a channel service client

type ChannelClient

type ChannelClient struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ChannelClient holds the stream and adapter for client to work with

func NewChannelClient

func NewChannelClient(peerAddress string, regTimeout time.Duration, adapter ChannelAdapter) (*ChannelClient, error)

NewChannelClient returns a new grpc.ClientConn to the configured local peer

func (*ChannelClient) CreateEnvelopeForChannelServiceRequest

func (cc *ChannelClient) CreateEnvelopeForChannelServiceRequest(csreq *serverapi.ChannelServiceRequest) (*common.Envelope, error)

CreateEnvelopeForChannelServiceRequest creates a signed envelope for a given ChannelServiceRequest

func (*ChannelClient) DeregisterAsync

func (cc *ChannelClient) DeregisterAsync(channels []string) error

DeregisterAsync deregisters interest in channel and doesn't wait for a response

func (*ChannelClient) Recv

Recv receives next event - use when client has not called Start

func (*ChannelClient) RegisterAsync

func (cc *ChannelClient) RegisterAsync(config *RegistrationConfig) error

RegisterAsync registers interest based on the provided RegistrationConfig and doesn't wait for a response

func (*ChannelClient) Send

Send takes a ChannelServiceRequest, creates a signed envelope, and sends it to the connected ChannelServer

func (*ChannelClient) SendEnvelope

func (cc *ChannelClient) SendEnvelope(env *common.Envelope) error

SendEnvelope sends a signed envelope to the connected ChannelServer

func (*ChannelClient) Start

func (cc *ChannelClient) Start() error

Start establishes connection with channel service server and registers for interested channels

func (*ChannelClient) Stop

func (cc *ChannelClient) Stop() error

Stop terminates connection with the channel service server

type RegistrationConfig

type RegistrationConfig struct {
	InterestedChannels []string
	InterestedEvents   []*pb.Interest
	Timestamp          *timestamp.Timestamp
}

RegistrationConfig holds the information used when registering for events from the channel service

Jump to

Keyboard shortcuts

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