discovery

package
v1.0.0-alpha4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package discovery is a generated protocol buffer package.

It is generated from these files:

discovery/protocol.proto

It has these top-level messages:

SignedRequest
Request
Response
AuthInfo
Query
QueryResult
ConfigQuery
ConfigResult
PeerMembershipQuery
PeerMembershipResult
ChaincodeQuery
ChaincodeInterest
ChaincodeCall
ChaincodeQueryResult
LocalPeerQuery
EndorsementDescriptor
Layout
Peers
Peer
Error
Endpoints
Endpoint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDiscoveryServer

func RegisterDiscoveryServer(s *grpc.Server, srv DiscoveryServer)

Types

type AuthInfo

type AuthInfo struct {
	// This is the identity of the client that is used to verify the signature
	// on the SignedRequest's payload.
	// It is a msp.SerializedIdentity in bytes form
	ClientIdentity []byte `protobuf:"bytes,1,opt,name=client_identity,json=clientIdentity,proto3" json:"client_identity,omitempty"`
	// This is the hash of the client's TLS cert.
	// When the network is running with TLS, clients that don't include a certificate
	// will be denied access to the service.
	// Since the Request is encapsulated with a SignedRequest (which is signed),
	// this binds the TLS session to the enrollement identity of the client and
	// therefore both authenticates the client to the server,
	// and also prevents the server from relaying the request message to another server.
	ClientTlsCertHash []byte `protobuf:"bytes,2,opt,name=client_tls_cert_hash,json=clientTlsCertHash,proto3" json:"client_tls_cert_hash,omitempty"`
}

AuthInfo aggregates authentication information that the server uses to authenticate the client

func (*AuthInfo) Descriptor

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

func (*AuthInfo) GetClientIdentity

func (m *AuthInfo) GetClientIdentity() []byte

func (*AuthInfo) GetClientTlsCertHash

func (m *AuthInfo) GetClientTlsCertHash() []byte

func (*AuthInfo) ProtoMessage

func (*AuthInfo) ProtoMessage()

func (*AuthInfo) Reset

func (m *AuthInfo) Reset()

func (*AuthInfo) String

func (m *AuthInfo) String() string

type ChaincodeCall

type ChaincodeCall struct {
	Name            string   `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	CollectionNames []string `protobuf:"bytes,2,rep,name=collection_names,json=collectionNames" json:"collection_names,omitempty"`
}

ChaincodeCall defines a call to a chaincode. It may have collections that are related to the chaincode

func (*ChaincodeCall) Descriptor

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

func (*ChaincodeCall) GetCollectionNames

func (m *ChaincodeCall) GetCollectionNames() []string

func (*ChaincodeCall) GetName

func (m *ChaincodeCall) GetName() string

func (*ChaincodeCall) ProtoMessage

func (*ChaincodeCall) ProtoMessage()

func (*ChaincodeCall) Reset

func (m *ChaincodeCall) Reset()

func (*ChaincodeCall) String

func (m *ChaincodeCall) String() string

type ChaincodeInterest

type ChaincodeInterest struct {
	Chaincodes []*ChaincodeCall `protobuf:"bytes,1,rep,name=chaincodes" json:"chaincodes,omitempty"`
}

ChaincodeInterest defines an interest about an endorsement for a specific single chaincode invocation. Multiple chaincodes indicate chaincode to chaincode invocations.

func (*ChaincodeInterest) Descriptor

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

func (*ChaincodeInterest) GetChaincodes

func (m *ChaincodeInterest) GetChaincodes() []*ChaincodeCall

func (*ChaincodeInterest) ProtoMessage

func (*ChaincodeInterest) ProtoMessage()

func (*ChaincodeInterest) Reset

func (m *ChaincodeInterest) Reset()

func (*ChaincodeInterest) String

func (m *ChaincodeInterest) String() string

type ChaincodeQuery

type ChaincodeQuery struct {
	Interests []*ChaincodeInterest `protobuf:"bytes,1,rep,name=interests" json:"interests,omitempty"`
}

ChaincodeQuery requests ChaincodeQueryResults for a given list of chaincode invocations. Each invocation is a separate one, and the endorsement policy is evaluated independantly for each given interest.

func (*ChaincodeQuery) Descriptor

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

func (*ChaincodeQuery) GetInterests

func (m *ChaincodeQuery) GetInterests() []*ChaincodeInterest

func (*ChaincodeQuery) ProtoMessage

func (*ChaincodeQuery) ProtoMessage()

func (*ChaincodeQuery) Reset

func (m *ChaincodeQuery) Reset()

func (*ChaincodeQuery) String

func (m *ChaincodeQuery) String() string

type ChaincodeQueryResult

type ChaincodeQueryResult struct {
	Content []*EndorsementDescriptor `protobuf:"bytes,1,rep,name=content" json:"content,omitempty"`
}

ChaincodeQueryResult contains EndorsementDescriptors for chaincodes

func (*ChaincodeQueryResult) Descriptor

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

func (*ChaincodeQueryResult) GetContent

func (m *ChaincodeQueryResult) GetContent() []*EndorsementDescriptor

func (*ChaincodeQueryResult) ProtoMessage

func (*ChaincodeQueryResult) ProtoMessage()

func (*ChaincodeQueryResult) Reset

func (m *ChaincodeQueryResult) Reset()

func (*ChaincodeQueryResult) String

func (m *ChaincodeQueryResult) String() string

type ConfigQuery

type ConfigQuery struct {
}

ConfigQuery requests a ConfigResult

func (*ConfigQuery) Descriptor

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

func (*ConfigQuery) ProtoMessage

func (*ConfigQuery) ProtoMessage()

func (*ConfigQuery) Reset

func (m *ConfigQuery) Reset()

func (*ConfigQuery) String

func (m *ConfigQuery) String() string

type ConfigResult

type ConfigResult struct {
	// msps is a map from MSP_ID to FabricMSPConfig
	Msps map[string]*msp.FabricMSPConfig `` /* 128-byte string literal not displayed */
	// orderers is a map from MSP_ID to endpoint lists of orderers
	Orderers map[string]*Endpoints `` /* 136-byte string literal not displayed */
}

func (*ConfigResult) Descriptor

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

func (*ConfigResult) GetMsps

func (m *ConfigResult) GetMsps() map[string]*msp.FabricMSPConfig

func (*ConfigResult) GetOrderers

func (m *ConfigResult) GetOrderers() map[string]*Endpoints

func (*ConfigResult) ProtoMessage

func (*ConfigResult) ProtoMessage()

func (*ConfigResult) Reset

func (m *ConfigResult) Reset()

func (*ConfigResult) String

func (m *ConfigResult) String() string

type DiscoveryClient

type DiscoveryClient interface {
	// Discover receives a signed request, and returns a response.
	Discover(ctx context.Context, in *SignedRequest, opts ...grpc.CallOption) (*Response, error)
}

func NewDiscoveryClient

func NewDiscoveryClient(cc *grpc.ClientConn) DiscoveryClient

type DiscoveryServer

type DiscoveryServer interface {
	// Discover receives a signed request, and returns a response.
	Discover(context.Context, *SignedRequest) (*Response, error)
}

type EndorsementDescriptor

type EndorsementDescriptor struct {
	Chaincode string `protobuf:"bytes,1,opt,name=chaincode" json:"chaincode,omitempty"`
	// Specifies the endorsers, separated to groups.
	EndorsersByGroups map[string]*Peers `` /* 181-byte string literal not displayed */
	// Specifies options of fulfulling the endorsement policy.
	// Each option lists the group names, and the amount of signatures needed
	// from each group.
	Layouts []*Layout `protobuf:"bytes,3,rep,name=layouts" json:"layouts,omitempty"`
}

EndorsementDescriptor contains information about which peers can be used to request endorsement from, such that the endorsement policy would be fulfilled. Here is how to compute a set of peers to ask an endorsement from, given an EndorsementDescriptor: Let e: G --> P be the endorsers_by_groups field that maps a group to a set of peers. Note that applying e on a group g yields a set of peers.

  1. Select a layout l: G --> N out of the layouts given. l is the quantities_by_group field of a Layout, and it maps a group to an integer.
  2. R = {} (an empty set of peers)
  3. For each group g in the layout l, compute n = l(g) 3.1) Denote P_g as a set of n random peers {p0, p1, ... p_n} selected from e(g) 3.2) R = R U P_g (add P_g to R)
  4. The set of peers R is the peers the client needs to request endorsements from

func (*EndorsementDescriptor) Descriptor

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

func (*EndorsementDescriptor) GetChaincode

func (m *EndorsementDescriptor) GetChaincode() string

func (*EndorsementDescriptor) GetEndorsersByGroups

func (m *EndorsementDescriptor) GetEndorsersByGroups() map[string]*Peers

func (*EndorsementDescriptor) GetLayouts

func (m *EndorsementDescriptor) GetLayouts() []*Layout

func (*EndorsementDescriptor) ProtoMessage

func (*EndorsementDescriptor) ProtoMessage()

func (*EndorsementDescriptor) Reset

func (m *EndorsementDescriptor) Reset()

func (*EndorsementDescriptor) String

func (m *EndorsementDescriptor) String() string

type Endpoint

type Endpoint struct {
	Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"`
	Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
}

Endpoint is a combination of a host and a port

func (*Endpoint) Descriptor

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

func (*Endpoint) GetHost

func (m *Endpoint) GetHost() string

func (*Endpoint) GetPort

func (m *Endpoint) GetPort() uint32

func (*Endpoint) ProtoMessage

func (*Endpoint) ProtoMessage()

func (*Endpoint) Reset

func (m *Endpoint) Reset()

func (*Endpoint) String

func (m *Endpoint) String() string

type Endpoints

type Endpoints struct {
	Endpoint []*Endpoint `protobuf:"bytes,1,rep,name=endpoint" json:"endpoint,omitempty"`
}

Endpoints is a list of Endpoint(s)

func (*Endpoints) Descriptor

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

func (*Endpoints) GetEndpoint

func (m *Endpoints) GetEndpoint() []*Endpoint

func (*Endpoints) ProtoMessage

func (*Endpoints) ProtoMessage()

func (*Endpoints) Reset

func (m *Endpoints) Reset()

func (*Endpoints) String

func (m *Endpoints) String() string

type Error

type Error struct {
	Content string `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"`
}

Error denotes that something went wrong and contains the error message

func (*Error) Descriptor

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

func (*Error) GetContent

func (m *Error) GetContent() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) Reset

func (m *Error) Reset()

func (*Error) String

func (m *Error) String() string

type Layout

type Layout struct {
	// Specifies how many non repeated signatures of each group
	// are needed for endorsement
	QuantitiesByGroup map[string]uint32 `` /* 182-byte string literal not displayed */
}

Layout contains a mapping from a group name to number of peers that are needed for fulfilling an endorsement policy

func (*Layout) Descriptor

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

func (*Layout) GetQuantitiesByGroup

func (m *Layout) GetQuantitiesByGroup() map[string]uint32

func (*Layout) ProtoMessage

func (*Layout) ProtoMessage()

func (*Layout) Reset

func (m *Layout) Reset()

func (*Layout) String

func (m *Layout) String() string

type LocalPeerQuery

type LocalPeerQuery struct {
}

LocalPeerQuery queries for peers in a non channel context

func (*LocalPeerQuery) Descriptor

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

func (*LocalPeerQuery) ProtoMessage

func (*LocalPeerQuery) ProtoMessage()

func (*LocalPeerQuery) Reset

func (m *LocalPeerQuery) Reset()

func (*LocalPeerQuery) String

func (m *LocalPeerQuery) String() string

type Peer

type Peer struct {
	// This is an Envelope of a GossipMessage with a gossip.StateInfo message
	StateInfo *gossip.Envelope `protobuf:"bytes,1,opt,name=state_info,json=stateInfo" json:"state_info,omitempty"`
	// This is an Envelope of a GossipMessage with a gossip.AliveMessage message
	MembershipInfo *gossip.Envelope `protobuf:"bytes,2,opt,name=membership_info,json=membershipInfo" json:"membership_info,omitempty"`
	// This is the msp.SerializedIdentity of the peer, represented in bytes.
	Identity []byte `protobuf:"bytes,3,opt,name=identity,proto3" json:"identity,omitempty"`
}

Peer contains information about the peer such as its channel specific state, and membership information.

func (*Peer) Descriptor

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

func (*Peer) GetIdentity

func (m *Peer) GetIdentity() []byte

func (*Peer) GetMembershipInfo

func (m *Peer) GetMembershipInfo() *gossip.Envelope

func (*Peer) GetStateInfo

func (m *Peer) GetStateInfo() *gossip.Envelope

func (*Peer) ProtoMessage

func (*Peer) ProtoMessage()

func (*Peer) Reset

func (m *Peer) Reset()

func (*Peer) String

func (m *Peer) String() string

type PeerMembershipQuery

type PeerMembershipQuery struct {
}

PeerMembershipQuery requests PeerMembershipResult

func (*PeerMembershipQuery) Descriptor

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

func (*PeerMembershipQuery) ProtoMessage

func (*PeerMembershipQuery) ProtoMessage()

func (*PeerMembershipQuery) Reset

func (m *PeerMembershipQuery) Reset()

func (*PeerMembershipQuery) String

func (m *PeerMembershipQuery) String() string

type PeerMembershipResult

type PeerMembershipResult struct {
	PeersByOrg map[string]*Peers `` /* 160-byte string literal not displayed */
}

PeerMembershipResult contains peers mapped by their organizations (MSP_ID)

func (*PeerMembershipResult) Descriptor

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

func (*PeerMembershipResult) GetPeersByOrg

func (m *PeerMembershipResult) GetPeersByOrg() map[string]*Peers

func (*PeerMembershipResult) ProtoMessage

func (*PeerMembershipResult) ProtoMessage()

func (*PeerMembershipResult) Reset

func (m *PeerMembershipResult) Reset()

func (*PeerMembershipResult) String

func (m *PeerMembershipResult) String() string

type Peers

type Peers struct {
	Peers []*Peer `protobuf:"bytes,1,rep,name=peers" json:"peers,omitempty"`
}

Peers contains a list of Peer(s)

func (*Peers) Descriptor

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

func (*Peers) GetPeers

func (m *Peers) GetPeers() []*Peer

func (*Peers) ProtoMessage

func (*Peers) ProtoMessage()

func (*Peers) Reset

func (m *Peers) Reset()

func (*Peers) String

func (m *Peers) String() string

type Query

type Query struct {
	Channel string `protobuf:"bytes,1,opt,name=channel" json:"channel,omitempty"`
	// Types that are valid to be assigned to Query:
	//	*Query_ConfigQuery
	//	*Query_PeerQuery
	//	*Query_CcQuery
	//	*Query_LocalPeers
	Query isQuery_Query `protobuf_oneof:"query"`
}

Query asks for information in the context of a specific channel

func (*Query) Descriptor

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

func (*Query) GetCcQuery

func (m *Query) GetCcQuery() *ChaincodeQuery

func (*Query) GetChannel

func (m *Query) GetChannel() string

func (*Query) GetConfigQuery

func (m *Query) GetConfigQuery() *ConfigQuery

func (*Query) GetLocalPeers

func (m *Query) GetLocalPeers() *LocalPeerQuery

func (*Query) GetPeerQuery

func (m *Query) GetPeerQuery() *PeerMembershipQuery

func (*Query) GetQuery

func (m *Query) GetQuery() isQuery_Query

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) Reset

func (m *Query) Reset()

func (*Query) String

func (m *Query) String() string

func (*Query) XXX_OneofFuncs

func (*Query) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type QueryResult

type QueryResult struct {
	// Types that are valid to be assigned to Result:
	//	*QueryResult_Error
	//	*QueryResult_ConfigResult
	//	*QueryResult_CcQueryRes
	//	*QueryResult_Members
	Result isQueryResult_Result `protobuf_oneof:"result"`
}

QueryResult contains a result for a given Query. The corresponding Query can be inferred by the index of the QueryResult from its enclosing Response message. QueryResults are ordered in the same order as the Queries are ordered in their enclosing Request.

func (*QueryResult) Descriptor

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

func (*QueryResult) GetCcQueryRes

func (m *QueryResult) GetCcQueryRes() *ChaincodeQueryResult

func (*QueryResult) GetConfigResult

func (m *QueryResult) GetConfigResult() *ConfigResult

func (*QueryResult) GetError

func (m *QueryResult) GetError() *Error

func (*QueryResult) GetMembers

func (m *QueryResult) GetMembers() *PeerMembershipResult

func (*QueryResult) GetResult

func (m *QueryResult) GetResult() isQueryResult_Result

func (*QueryResult) ProtoMessage

func (*QueryResult) ProtoMessage()

func (*QueryResult) Reset

func (m *QueryResult) Reset()

func (*QueryResult) String

func (m *QueryResult) String() string

func (*QueryResult) XXX_OneofFuncs

func (*QueryResult) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type QueryResult_CcQueryRes

type QueryResult_CcQueryRes struct {
	CcQueryRes *ChaincodeQueryResult `protobuf:"bytes,3,opt,name=cc_query_res,json=ccQueryRes,oneof"`
}

type QueryResult_ConfigResult

type QueryResult_ConfigResult struct {
	ConfigResult *ConfigResult `protobuf:"bytes,2,opt,name=config_result,json=configResult,oneof"`
}

type QueryResult_Error

type QueryResult_Error struct {
	Error *Error `protobuf:"bytes,1,opt,name=error,oneof"`
}

type QueryResult_Members

type QueryResult_Members struct {
	Members *PeerMembershipResult `protobuf:"bytes,4,opt,name=members,oneof"`
}

type QueryType

type QueryType uint8

QueryType defines the types of service discovery requests

const (
	InvalidQueryType QueryType = iota
	ConfigQueryType
	PeerMembershipQueryType
	ChaincodeQueryType
	LocalMembershipQueryType
)

type Query_CcQuery

type Query_CcQuery struct {
	CcQuery *ChaincodeQuery `protobuf:"bytes,4,opt,name=cc_query,json=ccQuery,oneof"`
}

type Query_ConfigQuery

type Query_ConfigQuery struct {
	ConfigQuery *ConfigQuery `protobuf:"bytes,2,opt,name=config_query,json=configQuery,oneof"`
}

type Query_LocalPeers

type Query_LocalPeers struct {
	LocalPeers *LocalPeerQuery `protobuf:"bytes,5,opt,name=local_peers,json=localPeers,oneof"`
}

type Query_PeerQuery

type Query_PeerQuery struct {
	PeerQuery *PeerMembershipQuery `protobuf:"bytes,3,opt,name=peer_query,json=peerQuery,oneof"`
}

type Request

type Request struct {
	// authentication contains information that the service uses to check
	// the client's eligibility for the queries.
	Authentication *AuthInfo `protobuf:"bytes,1,opt,name=authentication" json:"authentication,omitempty"`
	// queries
	Queries []*Query `protobuf:"bytes,2,rep,name=queries" json:"queries,omitempty"`
}

Request contains authentication info about the client that sent the request and the queries it wishes to query the service

func (*Request) Descriptor

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

func (*Request) GetAuthentication

func (m *Request) GetAuthentication() *AuthInfo

func (*Request) GetQueries

func (m *Request) GetQueries() []*Query

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

type Response

type Response struct {
	// The results are returned in the same order of the queries
	Results []*QueryResult `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
}

func (*Response) ConfigAt

func (m *Response) ConfigAt(i int) (*ConfigResult, *Error)

ConfigAt returns the ConfigResult at a given index in the Response, or an Error if present.

func (*Response) Descriptor

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

func (*Response) EndorsersAt

func (m *Response) EndorsersAt(i int) (*ChaincodeQueryResult, *Error)

EndorsersAt returns the PeerMembershipResult at a given index in the Response, or an Error if present.

func (*Response) GetResults

func (m *Response) GetResults() []*QueryResult

func (*Response) MembershipAt

func (m *Response) MembershipAt(i int) (*PeerMembershipResult, *Error)

MembershipAt returns the PeerMembershipResult at a given index in the Response, or an Error if present.

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

type SignedRequest

type SignedRequest struct {
	Payload   []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
}

SignedRequest contains a serialized Request in the payload field and a signature. The identity that is used to verify the signature can be extracted from the authentication field of type AuthInfo in the Request itself after deserializing it.

func (*SignedRequest) Descriptor

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

func (*SignedRequest) GetPayload

func (m *SignedRequest) GetPayload() []byte

func (*SignedRequest) GetSignature

func (m *SignedRequest) GetSignature() []byte

func (*SignedRequest) ProtoMessage

func (*SignedRequest) ProtoMessage()

func (*SignedRequest) Reset

func (m *SignedRequest) Reset()

func (*SignedRequest) String

func (m *SignedRequest) String() string

Jump to

Keyboard shortcuts

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