{"modulePath":"github.com/eric-erki/https-hyperledger.org","version":"v1.4.4","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package peer\n\n## Types\n\n```go\ntype MockCCComm struct {\n\t// contains filtered or unexported fields\n}\n```\nMockCCComm implements the mock communication between chaincode and peer We'd need two MockCCComm for communication. The receiver and sender will be switched between the two.\n\n```go\nfunc (s *MockCCComm) CloseSend() error\n```\nCloseSend closes send\n\n```go\nfunc (s *MockCCComm) GetRecvStream() chan *pb.ChaincodeMessage\n```\nGetRecvStream returns the recvStream\n\n```go\nfunc (s *MockCCComm) GetSendStream() chan *pb.ChaincodeMessage\n```\nGetSendStream returns the sendStream\n\n```go\nfunc (s *MockCCComm) Quit()\n```\nQuit closes the channels...\n\n```go\nfunc (s *MockCCComm) Recv() (*pb.ChaincodeMessage, error)\n```\nRecv receives a message\n\n```go\nfunc (s *MockCCComm) Run(done \u003c-chan struct{}) error\n```\nRun receives and sends indefinitely\n\n```go\nfunc (s *MockCCComm) Send(msg *pb.ChaincodeMessage) error\n```\nSend sends a message\n\n```go\nfunc (s *MockCCComm) SetBailOnError(b bool)\n```\nSetBailOnError will cause Run to return on any error\n\n```go\nfunc (s *MockCCComm) SetKeepAlive(ka *pb.ChaincodeMessage)\n```\nSetKeepAlive sets keepalive. This mut be done on the server only\n\n```go\nfunc (s *MockCCComm) SetName(newname string)\n```\n\n```go\nfunc (s *MockCCComm) SetPong(val bool)\n```\nSetPong pongs received keepalive. This mut be done on the chaincode only\n\n```go\nfunc (s *MockCCComm) SetResponses(respSet *MockResponseSet)\n```\nSetResponses sets responses for an Init or Invoke\n\n```go\ntype MockPeerCCSupport struct {\n\t// contains filtered or unexported fields\n}\n```\nMockPeerCCSupport provides CC support for peer interfaces.\n\n```go\nfunc NewMockPeerSupport() *MockPeerCCSupport\n```\nNewMockPeerSupport getsa mock peer support\n\n```go\nfunc (mp *MockPeerCCSupport) AddCC(name string, recv chan *pb.ChaincodeMessage, send chan *pb.ChaincodeMessage) (*MockCCComm, error)\n```\nAddCC adds a cc to the MockPeerCCSupport\n\n```go\nfunc (mp *MockPeerCCSupport) GetCC(name string) (*MockCCComm, error)\n```\nGetCC gets a cc from the MockPeerCCSupport\n\n```go\nfunc (mp *MockPeerCCSupport) GetCCMirror(name string) *MockCCComm\n```\nGetCCMirror creates a MockCCStream with streans switched\n\n```go\nfunc (mp *MockPeerCCSupport) RemoveAll() error\n```\nRemoveAll removes all ccs\n\n```go\nfunc (mp *MockPeerCCSupport) RemoveCC(name string) error\n```\nRemoveCC removes a cc\n\n```go\ntype MockResponse struct {\n\tRecvMsg *pb.ChaincodeMessage\n\tRespMsg interface{}\n}\n```\nMockResponse contains the expected received message (optional) and response to send (optional)\n\n```go\ntype MockResponseSet struct {\n\t//DoneFunc is invoked when all I/O is done for this\n\t//response set\n\tDoneFunc func(int, error)\n\n\t//ErrorFunc is invoked at any step when the input does not\n\t//match the received message\n\tErrorFunc func(int, error)\n\n\t//Responses contained the expected received message (optional)\n\t//and response to send (optional)\n\tResponses []*MockResponse\n}\n```\nMockResponseSet is used for processing CC to Peer comm such as GET/PUT/DEL state. The MockResponse contains the response to be returned for each input received.from the CC. Every stub call will generate a response\n\n","path":"github.com/eric-erki/https-hyperledger.org/common/mocks/peer","name":"peer","synopsis":"","isRedistributable":true}
