From bead75684b687d622b18af20c66ea662025ef8af Mon Sep 17 00:00:00 2001 From: Fedor Partanskiy Date: Tue, 17 Sep 2024 18:53:12 +0300 Subject: [PATCH] fabric batch operations Signed-off-by: Fedor Partanskiy --- core/chaincode/chaincode_support.go | 4 + core/chaincode/config.go | 34 +- core/chaincode/handler.go | 236 +++++-- core/chaincode/handler_test.go | 16 +- go.mod | 5 + go.sum | 8 +- integration/chaincode/onlyput/chaincode.go | 56 ++ integration/chaincode/onlyput/cmd/main.go | 23 + integration/e2e/bench_put_state_test.go | 144 ++++ integration/nwo/network.go | 2 + integration/nwo/template/core_template.go | 3 + integration/pvtdatapurge/data_purge_test.go | 2 +- internal/peer/node/start.go | 2 + sampleconfig/core.yaml | 8 + .../fabric-chaincode-go/v2/shim/handler.go | 166 +++++ .../common/collection.pb.go | 16 +- .../common/common.pb.go | 32 +- .../common/configtx.pb.go | 20 +- .../common/configuration.pb.go | 20 +- .../common/ledger.pb.go | 8 +- .../common/policies.pb.go | 20 +- .../discovery/protocol.pb.go | 48 +- .../discovery/protocol_grpc.pb.go | 34 +- .../gateway/gateway.pb.go | 34 +- .../gateway/gateway_grpc.pb.go | 98 ++- .../gossip/message.pb.go | 76 +-- .../gossip/message_grpc.pb.go | 93 ++- .../ledger/queryresult/kv_query_result.pb.go | 8 +- .../ledger/rwset/kvrwset/kv_rwset.pb.go | 32 +- .../ledger/rwset/rwset.pb.go | 16 +- .../msp/identities.pb.go | 8 +- .../msp/msp_config.pb.go | 22 +- .../msp/msp_principal.pb.go | 14 +- .../fabric-protos-go-apiv2/orderer/ab.pb.go | 24 +- .../orderer/ab_grpc.pb.go | 147 ++-- .../orderer/blockattestation.pb.go | 10 +- .../orderer/blockattestation_grpc.pb.go | 72 +- .../orderer/cluster.pb.go | 18 +- .../orderer/cluster_grpc.pb.go | 90 ++- .../orderer/clusterserver.pb.go | 20 +- .../orderer/clusterserver_grpc.pb.go | 90 ++- .../orderer/configuration.pb.go | 14 +- .../orderer/etcdraft/configuration.pb.go | 10 +- .../orderer/etcdraft/metadata.pb.go | 8 +- .../orderer/smartbft/configuration.pb.go | 6 +- .../peer/chaincode.pb.go | 135 +++- .../peer/chaincode_event.pb.go | 6 +- .../peer/chaincode_shim.pb.go | 642 ++++++++++++------ .../peer/chaincode_shim_grpc.pb.go | 178 +++-- .../peer/collection.pb.go | 16 +- .../peer/configuration.pb.go | 12 +- .../fabric-protos-go-apiv2/peer/events.pb.go | 20 +- .../peer/events_grpc.pb.go | 208 ++++-- .../peer/lifecycle/chaincode_definition.pb.go | 8 +- .../peer/lifecycle/db.pb.go | 10 +- .../peer/lifecycle/lifecycle.pb.go | 72 +- .../fabric-protos-go-apiv2/peer/peer.pb.go | 4 +- .../peer/peer_grpc.pb.go | 28 +- .../fabric-protos-go-apiv2/peer/policy.pb.go | 8 +- .../peer/proposal.pb.go | 14 +- .../peer/proposal_response.pb.go | 16 +- .../fabric-protos-go-apiv2/peer/query.pb.go | 14 +- .../peer/resources.pb.go | 14 +- .../peer/signed_cc_dep_spec.pb.go | 6 +- .../peer/snapshot.pb.go | 12 +- .../peer/snapshot_grpc.pb.go | 34 +- .../peer/transaction.pb.go | 14 +- .../transientstore/transientstore.pb.go | 6 +- .../github.com/onsi/gomega/gmeasure/cache.go | 202 ++++++ .../onsi/gomega/gmeasure/enum_support.go | 43 ++ .../onsi/gomega/gmeasure/experiment.go | 527 ++++++++++++++ .../onsi/gomega/gmeasure/measurement.go | 235 +++++++ .../github.com/onsi/gomega/gmeasure/rank.go | 141 ++++ .../github.com/onsi/gomega/gmeasure/stats.go | 153 +++++ .../onsi/gomega/gmeasure/stopwatch.go | 117 ++++ .../onsi/gomega/gmeasure/table/table.go | 370 ++++++++++ vendor/modules.txt | 10 +- 77 files changed, 3985 insertions(+), 1107 deletions(-) create mode 100644 integration/chaincode/onlyput/chaincode.go create mode 100644 integration/chaincode/onlyput/cmd/main.go create mode 100644 integration/e2e/bench_put_state_test.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/cache.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/enum_support.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/experiment.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/measurement.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/rank.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/stats.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/stopwatch.go create mode 100644 vendor/github.com/onsi/gomega/gmeasure/table/table.go diff --git a/core/chaincode/chaincode_support.go b/core/chaincode/chaincode_support.go index 700a801ad65..ec5e5200c59 100644 --- a/core/chaincode/chaincode_support.go +++ b/core/chaincode/chaincode_support.go @@ -73,6 +73,8 @@ type ChaincodeSupport struct { Runtime Runtime TotalQueryLimit int UserRunsCC bool + UsePutStateBatch bool + MaxSizePutStateBatch uint32 } // Launch starts executing chaincode if it is not already running. This method @@ -126,6 +128,8 @@ func (cs *ChaincodeSupport) HandleChaincodeStream(stream ccintf.ChaincodeStream) AppConfig: cs.AppConfig, Metrics: cs.HandlerMetrics, TotalQueryLimit: cs.TotalQueryLimit, + UsePutStateBatch: cs.UsePutStateBatch, + MaxSizePutStateBatch: cs.MaxSizePutStateBatch, } return handler.ProcessStream(stream) diff --git a/core/chaincode/config.go b/core/chaincode/config.go index 4459ba41400..78e1a81d208 100644 --- a/core/chaincode/config.go +++ b/core/chaincode/config.go @@ -16,21 +16,24 @@ import ( ) const ( - defaultExecutionTimeout = 30 * time.Second - minimumStartupTimeout = 5 * time.Second + defaultExecutionTimeout = 30 * time.Second + minimumStartupTimeout = 5 * time.Second + defaultMaxSizePutStateBatch = 1000 ) type Config struct { - TotalQueryLimit int - TLSEnabled bool - Keepalive time.Duration - ExecuteTimeout time.Duration - InstallTimeout time.Duration - StartupTimeout time.Duration - LogFormat string - LogLevel string - ShimLogLevel string - SCCAllowlist map[string]bool + TotalQueryLimit int + TLSEnabled bool + Keepalive time.Duration + ExecuteTimeout time.Duration + InstallTimeout time.Duration + StartupTimeout time.Duration + LogFormat string + LogLevel string + ShimLogLevel string + SCCAllowlist map[string]bool + UsePutStateBatch bool + MaxSizePutStateBatch uint32 } func GlobalConfig() *Config { @@ -71,6 +74,13 @@ func (c *Config) load() { if viper.IsSet("ledger.state.totalQueryLimit") { c.TotalQueryLimit = viper.GetInt("ledger.state.totalQueryLimit") } + if viper.IsSet("chaincode.additionalParams.usePutStateBatch") { + c.UsePutStateBatch = viper.GetBool("chaincode.additionalParams.usePutStateBatch") + } + c.MaxSizePutStateBatch = viper.GetUint32("ledger.state.maxSizePutStateBatch") + if c.MaxSizePutStateBatch <= 0 { + c.MaxSizePutStateBatch = defaultMaxSizePutStateBatch + } } func parseBool(s string) bool { diff --git a/core/chaincode/handler.go b/core/chaincode/handler.go index 1152cbf77d0..42f666fe3ed 100644 --- a/core/chaincode/handler.go +++ b/core/chaincode/handler.go @@ -130,6 +130,10 @@ type Handler struct { AppConfig ApplicationConfigRetriever // Metrics holds chaincode handler metrics Metrics *HandlerMetrics + // UsePutStateBatch an indication that the peer can accept changes from chaincode in batches + UsePutStateBatch bool + // MaxSizePutStateBatch maximum batch size for the change segment + MaxSizePutStateBatch uint32 // stateLock is used to read and set State. stateLock sync.RWMutex @@ -215,6 +219,8 @@ func (h *Handler) handleMessageReadyState(msg *pb.ChaincodeMessage) error { go h.HandleTransaction(msg, h.HandlePutStateMetadata) case pb.ChaincodeMessage_PURGE_PRIVATE_DATA: go h.HandleTransaction(msg, h.HandlePurgePrivateData) + case pb.ChaincodeMessage_CHANGE_STATE_BATCH: + go h.HandleTransaction(msg, h.HandleChangeStateBatch) default: return fmt.Errorf("[%s] Fabric side handler cannot handle message (%s) while in ready state", msg.Txid, msg.Type) } @@ -441,10 +447,22 @@ func (h *Handler) ProcessStream(stream ccintf.ChaincodeStream) error { // sendReady sends READY to chaincode serially (just like REGISTER) func (h *Handler) sendReady() error { chaincodeLogger.Debugf("sending READY for chaincode %s", h.chaincodeID) - ccMsg := &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_READY} + + chaincodeAdditionalParams := &pb.ChaincodeAdditionalParams{ + UsePutStateBatch: h.UsePutStateBatch, + MaxSizePutStateBatch: h.MaxSizePutStateBatch, + } + payloadBytes, err := proto.Marshal(chaincodeAdditionalParams) + if err != nil { + return errors.WithStack(err) + } + ccMsg := &pb.ChaincodeMessage{ + Type: pb.ChaincodeMessage_READY, + Payload: payloadBytes, + } // if error in sending tear down the h - if err := h.serialSend(ccMsg); err != nil { + if err = h.serialSend(ccMsg); err != nil { chaincodeLogger.Errorf("error sending READY (%s) for chaincode %s", err, h.chaincodeID) return err } @@ -504,7 +522,7 @@ func (h *Handler) HandleRegister(msg *pb.ChaincodeMessage) { } chaincodeLogger.Debugf("Got %s for chaincodeID = %s, sending back %s", pb.ChaincodeMessage_REGISTER, h.chaincodeID, pb.ChaincodeMessage_REGISTERED) - if err := h.serialSend(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_REGISTERED}); err != nil { + if err = h.serialSend(&pb.ChaincodeMessage{Type: pb.ChaincodeMessage_REGISTERED}); err != nil { chaincodeLogger.Errorf("error sending %s: %s", pb.ChaincodeMessage_REGISTERED, err) h.notifyRegistry(err) return @@ -555,10 +573,10 @@ func (h *Handler) registerTxid(msg *pb.ChaincodeMessage) bool { return false } -func (h *Handler) checkMetadataCap(msg *pb.ChaincodeMessage) error { - ac, exists := h.AppConfig.GetApplicationConfig(msg.ChannelId) +func (h *Handler) checkMetadataCap(channelId string) error { + ac, exists := h.AppConfig.GetApplicationConfig(channelId) if !exists { - return errors.Errorf("application config does not exist for %s", msg.ChannelId) + return errors.Errorf("application config does not exist for %s", channelId) } if !ac.Capabilities().KeyLevelEndorsement() { @@ -567,10 +585,10 @@ func (h *Handler) checkMetadataCap(msg *pb.ChaincodeMessage) error { return nil } -func (h *Handler) checkPurgePrivateDataCap(msg *pb.ChaincodeMessage) error { - ac, exists := h.AppConfig.GetApplicationConfig(msg.ChannelId) +func (h *Handler) checkPurgePrivateDataCap(channelId string) error { + ac, exists := h.AppConfig.GetApplicationConfig(channelId) if !exists { - return errors.Errorf("application config does not exist for %s", msg.ChannelId) + return errors.Errorf("application config does not exist for %s", channelId) } if !ac.Capabilities().PurgePvtData() { @@ -642,7 +660,7 @@ func (h *Handler) HandleGetState(msg *pb.ChaincodeMessage, txContext *Transactio if txContext.IsInitTransaction { return nil, errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { + if err = errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { return nil, err } res, err = txContext.TXSimulator.GetPrivateData(namespaceID, collection, getState.Key) @@ -687,7 +705,7 @@ func (h *Handler) HandleGetPrivateDataHash(msg *pb.ChaincodeMessage, txContext * // Handles query to ledger to get state metadata func (h *Handler) HandleGetStateMetadata(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) { - err := h.checkMetadataCap(msg) + err := h.checkMetadataCap(msg.ChannelId) if err != nil { return nil, err } @@ -707,7 +725,7 @@ func (h *Handler) HandleGetStateMetadata(msg *pb.ChaincodeMessage, txContext *Tr if txContext.IsInitTransaction { return nil, errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { + if err = errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { return nil, err } metadata, err = txContext.TXSimulator.GetPrivateDataMetadata(namespaceID, collection, getStateMetadata.Key) @@ -754,7 +772,7 @@ func (h *Handler) HandleGetStateByRange(msg *pb.ChaincodeMessage, txContext *Tra if txContext.IsInitTransaction { return nil, errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { + if err = errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { return nil, err } rangeIter, err = txContext.TXSimulator.GetPrivateDataRangeScanIterator(namespaceID, collection, @@ -877,7 +895,7 @@ func (h *Handler) HandleGetQueryResult(msg *pb.ChaincodeMessage, txContext *Tran if txContext.IsInitTransaction { return nil, errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { + if err = errorIfCreatorHasNoReadPermission(namespaceID, collection, txContext); err != nil { return nil, err } executeIter, err = txContext.TXSimulator.ExecuteQueryOnPrivateData(namespaceID, collection, getQueryResult.Query) @@ -1033,123 +1051,215 @@ func (h *Handler) getTxContextForInvoke(channelID string, txid string, payload [ func (h *Handler) HandlePutState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) { putState := &pb.PutState{} - err := proto.Unmarshal(msg.Payload, putState) - if err != nil { + if err := proto.Unmarshal(msg.Payload, putState); err != nil { return nil, errors.Wrap(err, "unmarshal failed") } + if err := h.putState(putState, txContext); err != nil { + return nil, errors.WithStack(err) + } + + return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil +} + +func (h *Handler) putState(msg *pb.PutState, txContext *TransactionContext) error { + var err error + namespaceID := txContext.NamespaceID - collection := putState.Collection + collection := msg.Collection if isCollectionSet(collection) { if txContext.IsInitTransaction { - return nil, errors.New("private data APIs are not allowed in chaincode Init()") + return errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { - return nil, err + if err = errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { + return err } - err = txContext.TXSimulator.SetPrivateData(namespaceID, collection, putState.Key, putState.Value) + err = txContext.TXSimulator.SetPrivateData(namespaceID, collection, msg.Key, msg.Value) } else { - err = txContext.TXSimulator.SetState(namespaceID, putState.Key, putState.Value) + err = txContext.TXSimulator.SetState(namespaceID, msg.Key, msg.Value) } if err != nil { - return nil, errors.WithStack(err) + return errors.WithStack(err) } - return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil + return nil } func (h *Handler) HandlePutStateMetadata(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) { - err := h.checkMetadataCap(msg) - if err != nil { - return nil, err + putStateMetadata := &pb.PutStateMetadata{} + if err := proto.Unmarshal(msg.Payload, putStateMetadata); err != nil { + return nil, errors.Wrap(err, "unmarshal failed") } - putStateMetadata := &pb.PutStateMetadata{} - err = proto.Unmarshal(msg.Payload, putStateMetadata) + if err := h.putStateMetadata(putStateMetadata, txContext, msg.ChannelId); err != nil { + return nil, errors.WithStack(err) + } + + return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil +} + +func (h *Handler) putStateMetadata(msg *pb.PutStateMetadata, txContext *TransactionContext, channelId string) error { + err := h.checkMetadataCap(channelId) if err != nil { - return nil, errors.Wrap(err, "unmarshal failed") + return err } metadata := make(map[string][]byte) - metadata[putStateMetadata.Metadata.Metakey] = putStateMetadata.Metadata.Value + metadata[msg.Metadata.Metakey] = msg.Metadata.Value namespaceID := txContext.NamespaceID - collection := putStateMetadata.Collection + collection := msg.Collection if isCollectionSet(collection) { if txContext.IsInitTransaction { - return nil, errors.New("private data APIs are not allowed in chaincode Init()") + return errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { - return nil, err + if err = errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { + return err } - err = txContext.TXSimulator.SetPrivateDataMetadata(namespaceID, collection, putStateMetadata.Key, metadata) + err = txContext.TXSimulator.SetPrivateDataMetadata(namespaceID, collection, msg.Key, metadata) } else { - err = txContext.TXSimulator.SetStateMetadata(namespaceID, putStateMetadata.Key, metadata) + err = txContext.TXSimulator.SetStateMetadata(namespaceID, msg.Key, metadata) } if err != nil { - return nil, errors.WithStack(err) + return errors.WithStack(err) } - return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil + return nil } func (h *Handler) HandleDelState(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) { delState := &pb.DelState{} - err := proto.Unmarshal(msg.Payload, delState) - if err != nil { + if err := proto.Unmarshal(msg.Payload, delState); err != nil { return nil, errors.Wrap(err, "unmarshal failed") } + if err := h.delState(delState, txContext); err != nil { + return nil, errors.WithStack(err) + } + + // Send response msg back to chaincode. + return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil +} + +func (h *Handler) delState(msg *pb.DelState, txContext *TransactionContext) error { + var err error + namespaceID := txContext.NamespaceID - collection := delState.Collection + collection := msg.Collection if isCollectionSet(collection) { if txContext.IsInitTransaction { - return nil, errors.New("private data APIs are not allowed in chaincode Init()") + return errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { - return nil, err + if err = errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { + return err } - err = txContext.TXSimulator.DeletePrivateData(namespaceID, collection, delState.Key) + err = txContext.TXSimulator.DeletePrivateData(namespaceID, collection, msg.Key) } else { - err = txContext.TXSimulator.DeleteState(namespaceID, delState.Key) + err = txContext.TXSimulator.DeleteState(namespaceID, msg.Key) } if err != nil { - return nil, errors.WithStack(err) + return errors.WithStack(err) } - // Send response msg back to chaincode. - return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil + return nil } func (h *Handler) HandlePurgePrivateData(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) { - err := h.checkPurgePrivateDataCap(msg) - if err != nil { - return nil, err - } delState := &pb.DelState{} if err := proto.Unmarshal(msg.Payload, delState); err != nil { return nil, errors.Wrap(err, "unmarshal failed") } + if err := h.purgePrivateData(delState, txContext, msg.ChannelId); err != nil { + return nil, errors.WithStack(err) + } + + // Send response msg back to chaincode. + return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil +} + +func (h *Handler) purgePrivateData(msg *pb.DelState, txContext *TransactionContext, channelId string) error { + err := h.checkPurgePrivateDataCap(channelId) + if err != nil { + return err + } + namespaceID := txContext.NamespaceID - collection := delState.Collection + collection := msg.Collection if collection == "" { - return nil, errors.New("only applicable for private data") + return errors.New("only applicable for private data") } if txContext.IsInitTransaction { - return nil, errors.New("private data APIs are not allowed in chaincode Init()") + return errors.New("private data APIs are not allowed in chaincode Init()") } - if err := errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { - return nil, err + if err = errorIfCreatorHasNoWritePermission(namespaceID, collection, txContext); err != nil { + return err } - if err := txContext.TXSimulator.PurgePrivateData(namespaceID, collection, delState.Key); err != nil { - return nil, errors.WithStack(err) + if err = txContext.TXSimulator.PurgePrivateData(namespaceID, collection, msg.Key); err != nil { + return errors.WithStack(err) + } + + return nil +} + +func (h *Handler) HandleChangeStateBatch(msg *pb.ChaincodeMessage, txContext *TransactionContext) (*pb.ChaincodeMessage, error) { + batch := &pb.ChangeStateBatch{} + err := proto.Unmarshal(msg.Payload, batch) + if err != nil { + return nil, errors.Wrap(err, "unmarshal failed") + } + + for _, kv := range batch.GetKvs() { + switch kv.GetType() { + case pb.StateKV_PUT_STATE: + putState := &pb.PutState{ + Key: kv.GetKey(), + Value: kv.GetValue(), + Collection: kv.GetCollection(), + } + if err = h.putState(putState, txContext); err != nil { + return nil, errors.WithStack(err) + } + + case pb.StateKV_DEL_STATE: + delState := &pb.DelState{ + Key: kv.GetKey(), + Collection: kv.GetCollection(), + } + if err = h.delState(delState, txContext); err != nil { + return nil, errors.WithStack(err) + } + + case pb.StateKV_PURGE_PRIVATE_DATA: + delState := &pb.DelState{ + Key: kv.GetKey(), + Collection: kv.GetCollection(), + } + if err = h.purgePrivateData(delState, txContext, msg.ChannelId); err != nil { + return nil, err + } + + case pb.StateKV_PUT_STATE_METADATA: + putStateMetadata := &pb.PutStateMetadata{ + Key: kv.GetKey(), + Collection: kv.GetCollection(), + Metadata: &pb.StateMetadata{ + Metakey: kv.GetMetadata().GetMetakey(), + Value: kv.GetMetadata().GetValue(), + }, + } + if err = h.putStateMetadata(putStateMetadata, txContext, msg.ChannelId); err != nil { + return nil, err + } + + default: + return nil, errors.New("unknown operation type") + } } - // Send response msg back to chaincode. return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_RESPONSE, Txid: msg.Txid, ChannelId: msg.ChannelId}, nil } @@ -1252,7 +1362,7 @@ func (h *Handler) Execute(txParams *ccprovider.TransactionParams, namespace stri } defer h.TXContexts.Delete(msg.ChannelId, msg.Txid) - if err := h.setChaincodeProposal(txParams.SignedProp, txParams.Proposal, msg); err != nil { + if err = h.setChaincodeProposal(txParams.SignedProp, txParams.Proposal, msg); err != nil { return nil, err } diff --git a/core/chaincode/handler_test.go b/core/chaincode/handler_test.go index 5aed680678e..155e95040d0 100644 --- a/core/chaincode/handler_test.go +++ b/core/chaincode/handler_test.go @@ -123,8 +123,10 @@ var _ = Describe("Handler", func() { UUIDGenerator: chaincode.UUIDGeneratorFunc(func() string { return "generated-query-id" }), - AppConfig: fakeApplicationConfigRetriever, - Metrics: chaincodeMetrics, + AppConfig: fakeApplicationConfigRetriever, + Metrics: chaincodeMetrics, + UsePutStateBatch: true, + MaxSizePutStateBatch: 1000, } chaincode.SetHandlerChatStream(handler, fakeChatStream) chaincode.SetHandlerChaincodeID(handler, "test-handler-name:1.0") @@ -2783,8 +2785,16 @@ var _ = Describe("Handler", func() { Type: pb.ChaincodeMessage_REGISTERED, })) + chaincodeAdditionalParams := &pb.ChaincodeAdditionalParams{ + UsePutStateBatch: true, + MaxSizePutStateBatch: 1000, + } + payloadBytes, err := proto.Marshal(chaincodeAdditionalParams) + Expect(err).NotTo(HaveOccurred()) + Expect(readyMessage).To(ProtoEqual(&pb.ChaincodeMessage{ - Type: pb.ChaincodeMessage_READY, + Type: pb.ChaincodeMessage_READY, + Payload: payloadBytes, })) }) diff --git a/go.mod b/go.mod index b7c14fb7a4c..62905261d6d 100644 --- a/go.mod +++ b/go.mod @@ -122,3 +122,8 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) + +replace ( + github.com/hyperledger/fabric-chaincode-go/v2 => github.com/scientificideas/fabric-chaincode-go/v2 v2.0.0-20240917062040-734ea7e39c20 + github.com/hyperledger/fabric-protos-go-apiv2 => github.com/scientificideas/fabric-protos-go-apiv2 v0.0.0-20240917052027-e43d30d02e8c +) diff --git a/go.sum b/go.sum index 2b5b50cae56..91b60f44712 100644 --- a/go.sum +++ b/go.sum @@ -898,14 +898,10 @@ github.com/hyperledger/aries-bbs-go v0.0.0-20240528084656-761671ea73bc h1:3Ykk6M github.com/hyperledger/aries-bbs-go v0.0.0-20240528084656-761671ea73bc/go.mod h1:Kofn6A6WWea1ZM8Rys5aBW9dszwJ7Ywa0kyyYL0TPYw= github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 h1:B1Nt8hKb//KvgGRprk0h1t4lCnwhE9/ryb1WqfZbV+M= github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE= -github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0 h1:IhkHfrl5X/fVnmB6pWeCYCdIJRi9bxj+WTnVN8DtW3c= -github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0/go.mod h1:PHHaFffjw7p7n9bmCfcm7RqDqYdivNEsJdiNIKZo5Lk= github.com/hyperledger/fabric-config v0.3.0 h1:FS5/dc9GAniljP6RYxQRG92AaiBVoN2vTvtOvnWqeQs= github.com/hyperledger/fabric-config v0.3.0/go.mod h1:kSevTn78K83Suc++JsEo7Nt1tYIPqDajW+ORz3OhWlg= github.com/hyperledger/fabric-lib-go v1.1.3-0.20240523144151-25edd1eaf5f5 h1:RPWTL5wxAb+xDOrsCU3QYZP65305F8v3PaOyzdbPVMU= github.com/hyperledger/fabric-lib-go v1.1.3-0.20240523144151-25edd1eaf5f5/go.mod h1:SHNCq8AB0VpHAmvJEtdbzabv6NNV1F48JdmDihasBjc= -github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 h1:YJrd+gMaeY0/vsN0aS0QkEKTivGoUnSRIXxGJ7KI+Pc= -github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4/go.mod h1:bau/6AJhvEcu9GKKYHlDXAxXKzYNfhP6xu2GXuxEcFk= github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -1086,6 +1082,10 @@ github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfF github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/sagikazarmark/locafero v0.6.0 h1:ON7AQg37yzcRPU69mt7gwhFEBwxI6P9T4Qu3N51bwOk= github.com/sagikazarmark/locafero v0.6.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0= +github.com/scientificideas/fabric-chaincode-go/v2 v2.0.0-20240917062040-734ea7e39c20 h1:/BlcEC/uR0/kgLZ2d4PxKHp8yrmxYh6AQAci00Rjjtw= +github.com/scientificideas/fabric-chaincode-go/v2 v2.0.0-20240917062040-734ea7e39c20/go.mod h1:TbldEYooqtR1AVWsdF6K4h123JAUNUEhD8VvHlASCk0= +github.com/scientificideas/fabric-protos-go-apiv2 v0.0.0-20240917052027-e43d30d02e8c h1:nPuFGreSUglrB87k4zVXr8lVN/A0uYy37qRorJmTO8A= +github.com/scientificideas/fabric-protos-go-apiv2 v0.0.0-20240917052027-e43d30d02e8c/go.mod h1:1x9TFdg5b2M9vema7s4EdQZ1qUV4peAtF2jQj8FjLjc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= diff --git a/integration/chaincode/onlyput/chaincode.go b/integration/chaincode/onlyput/chaincode.go new file mode 100644 index 00000000000..f86b3c509b8 --- /dev/null +++ b/integration/chaincode/onlyput/chaincode.go @@ -0,0 +1,56 @@ +/* +Copyright IBM Corp. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package onlyput + +import ( + "fmt" + "strconv" + + "github.com/hyperledger/fabric-chaincode-go/v2/shim" + pb "github.com/hyperledger/fabric-protos-go-apiv2/peer" +) + +type OnlyPut struct{} + +// Init initializes chaincode +// =========================== +func (t *OnlyPut) Init(_ shim.ChaincodeStubInterface) *pb.Response { + return shim.Success(nil) +} + +// Invoke - Our entry point for Invocations +// ======================================== +func (t *OnlyPut) Invoke(stub shim.ChaincodeStubInterface) *pb.Response { + function, args := stub.GetFunctionAndParameters() + fmt.Println("invoke is running " + function) + + switch function { + case "invoke": + return t.put(stub, args) + default: + // error + fmt.Println("invoke did not find func: " + function) + return shim.Error("Received unknown function invocation") + } +} + +// both params should be marshalled json data and base64 encoded +func (t *OnlyPut) put(stub shim.ChaincodeStubInterface, args []string) *pb.Response { + if len(args) != 1 { + return shim.Error("Incorrect number of arguments. Expecting 1") + } + num, _ := strconv.Atoi(args[0]) + + for i := range num { + key := "key" + strconv.Itoa(i) + err := stub.PutState(key, []byte(key)) + if err != nil { + return shim.Error(err.Error()) + } + } + return shim.Success(nil) +} diff --git a/integration/chaincode/onlyput/cmd/main.go b/integration/chaincode/onlyput/cmd/main.go new file mode 100644 index 00000000000..6d410890687 --- /dev/null +++ b/integration/chaincode/onlyput/cmd/main.go @@ -0,0 +1,23 @@ +/* +Copyright IBM Corp. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package main + +import ( + "fmt" + "os" + + "github.com/hyperledger/fabric-chaincode-go/v2/shim" + "github.com/hyperledger/fabric/integration/chaincode/onlyput" +) + +func main() { + err := shim.Start(&onlyput.OnlyPut{}) + if err != nil { + fmt.Fprintf(os.Stderr, "Exiting SBE chaincode: %s", err) + os.Exit(2) + } +} diff --git a/integration/e2e/bench_put_state_test.go b/integration/e2e/bench_put_state_test.go new file mode 100644 index 00000000000..349854b1f1d --- /dev/null +++ b/integration/e2e/bench_put_state_test.go @@ -0,0 +1,144 @@ +/* +Copyright IBM Corp. All Rights Reserved. + +SPDX-License-Identifier: Apache-2.0 +*/ + +package e2e + +import ( + "fmt" + "os" + "path/filepath" + "syscall" + + docker "github.com/fsouza/go-dockerclient" + "github.com/hyperledger/fabric/integration/channelparticipation" + "github.com/hyperledger/fabric/integration/nwo" + "github.com/hyperledger/fabric/integration/nwo/commands" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" + "github.com/onsi/gomega/gmeasure" + "github.com/tedsuo/ifrit" + ginkgomon "github.com/tedsuo/ifrit/ginkgomon_v2" +) + +var _ = Describe("Network", func() { + var ( + client *docker.Client + tempDir string + ) + + BeforeEach(func() { + var err error + tempDir, err = os.MkdirTemp("", "nwo") + Expect(err).NotTo(HaveOccurred()) + + client, err = docker.NewClientFromEnv() + Expect(err).NotTo(HaveOccurred()) + }) + + AfterEach(func() { + os.RemoveAll(tempDir) + }) + + DescribeTableSubtree("etcdraft network", func(desc string, usePutStateBatch bool) { + var network *nwo.Network + var ordererRunner *ginkgomon.Runner + var ordererProcess, peerProcess ifrit.Process + + BeforeEach(func() { + network = nwo.New(nwo.BasicEtcdRaft(), tempDir, client, StartPort(), components) + network.UsePutStateBatch = usePutStateBatch + + // Generate config and bootstrap the network + network.GenerateConfigTree() + network.Bootstrap() + + // Start all of the fabric processes + ordererRunner, ordererProcess, peerProcess = network.StartSingleOrdererNetwork("orderer") + }) + + AfterEach(func() { + if ordererProcess != nil { + ordererProcess.Signal(syscall.SIGTERM) + Eventually(ordererProcess.Wait(), network.EventuallyTimeout).Should(Receive()) + } + + if peerProcess != nil { + peerProcess.Signal(syscall.SIGTERM) + Eventually(peerProcess.Wait(), network.EventuallyTimeout).Should(Receive()) + } + + network.Cleanup() + }) + + It("deploys and executes chaincode (simple) using _lifecycle", func() { + orderer := network.Orderer("orderer") + channelparticipation.JoinOrdererJoinPeersAppChannel(network, "testchannel", orderer, ordererRunner) + peer := network.Peer("Org1", "peer0") + + chaincode := nwo.Chaincode{ + Name: "mycc", + Version: "0.0", + Path: "github.com/hyperledger/fabric/integration/chaincode/onlyput/cmd", + Lang: "golang", + PackageFile: filepath.Join(tempDir, "onlyput.tar.gz"), + Ctor: `{"Args":["init"]}`, + SignaturePolicy: `AND ('Org1MSP.member','Org2MSP.member')`, + Sequence: "1", + InitRequired: true, + Label: "my_onlyput_chaincode", + } + + network.VerifyMembership(network.PeersWithChannel("testchannel"), "testchannel") + + nwo.EnableCapabilities( + network, + "testchannel", + "Application", "V2_0", + orderer, + network.PeersWithChannel("testchannel")..., + ) + nwo.DeployChaincode(network, "testchannel", orderer, chaincode) + + By("run invoke where onli put state") + experiment := gmeasure.NewExperiment("Only PUT State " + desc) + AddReportEntry(experiment.Name, experiment) + + experiment.SampleDuration("invoke N-5 cycle-1", func(idx int) { + RunInvokeOnlyPutState(network, orderer, peer, "invoke", 1) + }, gmeasure.SamplingConfig{N: 5}) + + experiment.SampleDuration("invoke N-10 cycle-1000", func(idx int) { + RunInvokeOnlyPutState(network, orderer, peer, "invoke", 1000) + }, gmeasure.SamplingConfig{N: 10}) + + experiment.SampleDuration("invoke N-10 cycle-10000", func(idx int) { + RunInvokeOnlyPutState(network, orderer, peer, "invoke", 10000) + }, gmeasure.SamplingConfig{N: 10}) + }) + }, + Entry("without batch", "without batch", false), + Entry("with batch", "with batch", true), + ) +}) + +func RunInvokeOnlyPutState(n *nwo.Network, orderer *nwo.Orderer, peer *nwo.Peer, fn string, initial int) { + sess, err := n.PeerUserSession(peer, "User1", commands.ChaincodeInvoke{ + ChannelID: "testchannel", + Orderer: n.OrdererAddress(orderer, nwo.ListenPort), + Name: "mycc", + Ctor: `{"Args":["` + fn + `","` + fmt.Sprint(initial) + `"]}`, + PeerAddresses: []string{ + n.PeerAddress(n.Peer("Org1", "peer0"), nwo.ListenPort), + n.PeerAddress(n.Peer("Org2", "peer0"), nwo.ListenPort), + }, + WaitForEvent: true, + }) + Expect(err).NotTo(HaveOccurred()) + Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0)) + Expect(sess.Err).To(gbytes.Say("Chaincode invoke successful. result: status:200")) +} diff --git a/integration/nwo/network.go b/integration/nwo/network.go index cc0d888b07d..5b29d744582 100644 --- a/integration/nwo/network.go +++ b/integration/nwo/network.go @@ -160,6 +160,7 @@ type Network struct { GatewayEnabled bool OrdererReplicationPolicy string PeerDeliveryClientPolicy string + UsePutStateBatch bool PortsByOrdererID map[string]Ports PortsByPeerID map[string]Ports @@ -192,6 +193,7 @@ func New(c *Config, rootDir string, dockerClient *docker.Client, startPort int, PortsByOrdererID: map[string]Ports{}, PortsByPeerID: map[string]Ports{}, PeerDeliveryClientPolicy: "", + UsePutStateBatch: true, Organizations: c.Organizations, Consensus: c.Consensus, diff --git a/integration/nwo/template/core_template.go b/integration/nwo/template/core_template.go index 1747c49e196..cf398e8008f 100644 --- a/integration/nwo/template/core_template.go +++ b/integration/nwo/template/core_template.go @@ -187,6 +187,9 @@ chaincode: cscc: enable lscc: enable qscc: enable + additionalParams: + usePutStateBatch: {{ .UsePutStateBatch }} + maxSizePutStateBatch: 1000 logging: level: info shim: warning diff --git a/integration/pvtdatapurge/data_purge_test.go b/integration/pvtdatapurge/data_purge_test.go index fb416c92d7c..bb6cd27e838 100644 --- a/integration/pvtdatapurge/data_purge_test.go +++ b/integration/pvtdatapurge/data_purge_test.go @@ -164,7 +164,7 @@ var _ = Describe("Pvtdata purge", func() { WaitForEvent: true, } - marblechaincodeutil.AssertInvokeChaincodeFails(network, org2Peer0, purgeCommand, "Failed to purge state:PURGE_PRIVATE_DATA failed: transaction ID: [a-f0-9]{64}: purge private data is not enabled, channel application capability of V2_5 or later is required") + marblechaincodeutil.AssertInvokeChaincodeFails(network, org2Peer0, purgeCommand, "failed: transaction ID: [a-f0-9]{64}: purge private data is not enabled, channel application capability of V2_5 or later is required") }) }) diff --git a/internal/peer/node/start.go b/internal/peer/node/start.go index 719801fae5c..388739af3b4 100644 --- a/internal/peer/node/start.go +++ b/internal/peer/node/start.go @@ -693,6 +693,8 @@ func serve(args []string) error { BuiltinSCCs: builtinSCCs, TotalQueryLimit: chaincodeConfig.TotalQueryLimit, UserRunsCC: userRunsCC, + UsePutStateBatch: chaincodeConfig.UsePutStateBatch, + MaxSizePutStateBatch: chaincodeConfig.MaxSizePutStateBatch, } custodianLauncher := custodianLauncherAdapter{ diff --git a/sampleconfig/core.yaml b/sampleconfig/core.yaml index 5a721554d26..14683ba2fa3 100644 --- a/sampleconfig/core.yaml +++ b/sampleconfig/core.yaml @@ -669,6 +669,14 @@ chaincode: # Format for the chaincode container logs format: '%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}' + # AdditionalParams section for parameters that are passed to chaincode + # to specify additional operation modes in which the peer operates. + additionalParams: + # UsePutStateBatch an indication that the peer can accept changes from chaincode in batches + usePutStateBatch: true + # MaxSizePutStateBatch maximum batch size for the change segment + maxSizePutStateBatch: 1000 + ############################################################################### # # Ledger section - ledger configuration encompasses both the blockchain diff --git a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go index a465ae2639f..e7f0e40fcfe 100644 --- a/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go +++ b/vendor/github.com/hyperledger/fabric-chaincode-go/v2/shim/handler.go @@ -18,6 +18,10 @@ const ( created state = "created" // start state established state = "established" // connection established ready state = "ready" // ready for requests + + defaultMaxSizePutStateBatch = 100 + prefixMetaData = "m" + prefixStateData = "s" ) // PeerChaincodeStream is the common stream interface for Peer - chaincode communication. @@ -46,6 +50,11 @@ type Handler struct { cc Chaincode // state holds the current state of this handler. state state + // if you can send the changes in batches. + usePutStateBatch bool + maxSizePutStateBatch uint32 + stateDataMutex sync.RWMutex + stateData map[string]map[string]*peer.StateKV // Multiple queries (and one transaction) with different txids can be executing in parallel for this chaincode // responseChannels is the channel on which responses are communicated by the shim to the chaincodeStub. @@ -150,6 +159,7 @@ func newChaincodeHandler(peerChatStream PeerChaincodeStream, chaincode Chaincode cc: chaincode, responseChannels: map[string]chan *peer.ChaincodeMessage{}, state: created, + stateData: map[string]map[string]*peer.StateKV{}, } } @@ -188,6 +198,11 @@ func (h *Handler) handleInit(msg *peer.ChaincodeMessage) (*peer.ChaincodeMessage return nil, fmt.Errorf("failed to marshal response: %s", err) } + err = h.sendBatch(msg.ChannelId, msg.Txid) + if err != nil { + return nil, fmt.Errorf("failed send batch: %s", err) + } + return &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_COMPLETED, Payload: resBytes, Txid: msg.Txid, ChaincodeEvent: stub.chaincodeEvent, ChannelId: stub.ChannelID}, nil } @@ -214,6 +229,11 @@ func (h *Handler) handleTransaction(msg *peer.ChaincodeMessage) (*peer.Chaincode return nil, fmt.Errorf("failed to marshal response: %s", err) } + err = h.sendBatch(msg.ChannelId, msg.Txid) + if err != nil { + return nil, fmt.Errorf("failed send batch: %s", err) + } + return &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_COMPLETED, Payload: resBytes, Txid: msg.Txid, ChaincodeEvent: stub.chaincodeEvent, ChannelId: stub.ChannelID}, nil } @@ -312,6 +332,17 @@ func (h *Handler) handleGetStateMetadata(collection string, key string, channelI // handlePutState communicates with the peer to put state information into the ledger. func (h *Handler) handlePutState(collection string, key string, value []byte, channelID string, txid string) error { + if h.usePutStateBatch { + st := h.stateDataByID(channelID, txid) + st[prefixStateData+collection+key] = &peer.StateKV{ + Key: key, + Value: value, + Collection: collection, + Type: peer.StateKV_PUT_STATE, + } + return nil + } + // Construct payload for PUT_STATE payloadBytes := marshalOrPanic(&peer.PutState{Collection: collection, Key: key, Value: value}) @@ -340,6 +371,19 @@ func (h *Handler) handlePutState(collection string, key string, value []byte, ch func (h *Handler) handlePutStateMetadataEntry(collection string, key string, metakey string, metadata []byte, channelID string, txID string) error { // Construct payload for PUT_STATE_METADATA md := &peer.StateMetadata{Metakey: metakey, Value: metadata} + + if h.usePutStateBatch { + st := h.stateDataByID(channelID, txID) + st[prefixMetaData+collection+key] = &peer.StateKV{ + Key: key, + Collection: collection, + Metadata: md, + Type: peer.StateKV_PUT_STATE_METADATA, + } + + return nil + } + payloadBytes := marshalOrPanic(&peer.PutStateMetadata{Collection: collection, Key: key, Metadata: md}) msg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_PUT_STATE_METADATA, Payload: payloadBytes, Txid: txID, ChannelId: channelID} @@ -365,6 +409,16 @@ func (h *Handler) handlePutStateMetadataEntry(collection string, key string, met // handleDelState communicates with the peer to delete a key from the state in the ledger. func (h *Handler) handleDelState(collection string, key string, channelID string, txid string) error { + if h.usePutStateBatch { + st := h.stateDataByID(channelID, txid) + st[prefixStateData+collection+key] = &peer.StateKV{ + Key: key, + Collection: collection, + Type: peer.StateKV_DEL_STATE, + } + return nil + } + payloadBytes := marshalOrPanic(&peer.DelState{Collection: collection, Key: key}) msg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_DEL_STATE, Payload: payloadBytes, Txid: txid, ChannelId: channelID} // Execute the request and get response @@ -388,6 +442,16 @@ func (h *Handler) handleDelState(collection string, key string, channelID string // handlePurgeState communicates with the peer to purge a state from private data func (h *Handler) handlePurgeState(collection string, key string, channelID string, txid string) error { + if h.usePutStateBatch { + st := h.stateDataByID(channelID, txid) + st[prefixStateData+collection+key] = &peer.StateKV{ + Key: key, + Collection: collection, + Type: peer.StateKV_PURGE_PRIVATE_DATA, + } + return nil + } + payloadBytes := marshalOrPanic(&peer.DelState{Collection: collection, Key: key}) msg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_PURGE_PRIVATE_DATA, Payload: payloadBytes, Txid: txid, ChannelId: channelID} // Execute the request and get response @@ -409,6 +473,69 @@ func (h *Handler) handlePurgeState(collection string, key string, channelID stri return fmt.Errorf("[%s] incorrect chaincode message %s received. Expecting %s or %s", shorttxid(responseMsg.Txid), responseMsg.Type, peer.ChaincodeMessage_RESPONSE, peer.ChaincodeMessage_ERROR) } +// handlePutStateBatch communicates with the peer to put state as batch all changes information into the ledger. +func (h *Handler) handlePutStateBatch(batch *peer.ChangeStateBatch, channelID string, txid string) error { + // Construct payload for PUT_STATE_BATCH + payloadBytes := marshalOrPanic(batch) + + msg := &peer.ChaincodeMessage{Type: peer.ChaincodeMessage_CHANGE_STATE_BATCH, Payload: payloadBytes, Txid: txid, ChannelId: channelID} + + // Execute the request and get response + responseMsg, err := h.callPeerWithChaincodeMsg(msg, channelID, txid) + if err != nil { + return fmt.Errorf("[%s] error sending %s: %s", msg.Txid, peer.ChaincodeMessage_CHANGE_STATE_BATCH, err) + } + + if responseMsg.Type == peer.ChaincodeMessage_RESPONSE { + // Success response + return nil + } + + if responseMsg.Type == peer.ChaincodeMessage_ERROR { + // Error response + return fmt.Errorf("%s", responseMsg.Payload[:]) + } + + // Incorrect chaincode message received + return fmt.Errorf("[%s] incorrect chaincode message %s received. Expecting %s or %s", shorttxid(responseMsg.Txid), responseMsg.Type, peer.ChaincodeMessage_RESPONSE, peer.ChaincodeMessage_ERROR) +} + +func (h *Handler) sendBatch(channelID string, txid string) error { + if !h.usePutStateBatch { + return nil + } + + st := h.stateDataByID(channelID, txid) + txCtxID := transactionContextID(channelID, txid) + + defer func() { + h.stateDataMutex.Lock() + delete(h.stateData, txCtxID) + h.stateDataMutex.Unlock() + }() + + batch := &peer.ChangeStateBatch{} + for _, kv := range st { + batch.Kvs = append(batch.Kvs, kv) + if len(batch.Kvs) >= int(h.maxSizePutStateBatch) { + err := h.handlePutStateBatch(batch, channelID, txid) + if err != nil { + return fmt.Errorf("failed send state batch: %s", err) + } + batch.Kvs = batch.Kvs[:0] + } + } + + if len(batch.Kvs) != 0 { + err := h.handlePutStateBatch(batch, channelID, txid) + if err != nil { + return fmt.Errorf("failed send state batch: %s", err) + } + } + + return nil +} + func (h *Handler) handleGetStateByRange(collection, startKey, endKey string, metadata []byte, channelID string, txid string) (*peer.QueryResponse, error) { // Send GET_STATE_BY_RANGE message to peer chaincode support @@ -655,6 +782,23 @@ func (h *Handler) handleEstablished(msg *peer.ChaincodeMessage) error { } h.state = ready + if len(msg.Payload) == 0 { + return nil + } + + ccAdditionalParams := &peer.ChaincodeAdditionalParams{} + err := proto.Unmarshal(msg.Payload, ccAdditionalParams) + if err != nil { + return nil + } + + h.usePutStateBatch = ccAdditionalParams.UsePutStateBatch + h.maxSizePutStateBatch = ccAdditionalParams.MaxSizePutStateBatch + + if h.usePutStateBatch && h.maxSizePutStateBatch < defaultMaxSizePutStateBatch { + h.maxSizePutStateBatch = defaultMaxSizePutStateBatch + } + return nil } @@ -697,6 +841,28 @@ func (h *Handler) handleMessage(msg *peer.ChaincodeMessage, errc chan error) err return nil } +func (h *Handler) stateDataByID(channelID string, txID string) map[string]*peer.StateKV { + txCtxID := transactionContextID(channelID, txID) + + h.stateDataMutex.RLock() + st, ok := h.stateData[txCtxID] + h.stateDataMutex.RUnlock() + if ok { + return st + } + + h.stateDataMutex.Lock() + defer h.stateDataMutex.Unlock() + st, ok = h.stateData[txCtxID] + if ok { + return st + } + + st = make(map[string]*peer.StateKV) + h.stateData[txCtxID] = st + return st +} + // marshalOrPanic attempts to marshal the provided protobbuf message but will panic // when marshaling fails instead of returning an error. func marshalOrPanic(msg proto.Message) []byte { diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/collection.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/collection.pb.go index 04ad009ad09..73e0f2a9993 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/collection.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/collection.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: common/collection.proto @@ -432,7 +432,7 @@ func file_common_collection_proto_rawDescGZIP() []byte { } var file_common_collection_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_common_collection_proto_goTypes = []any{ +var file_common_collection_proto_goTypes = []interface{}{ (*CollectionConfigPackage)(nil), // 0: common.CollectionConfigPackage (*CollectionConfig)(nil), // 1: common.CollectionConfig (*StaticCollectionConfig)(nil), // 2: common.StaticCollectionConfig @@ -460,7 +460,7 @@ func file_common_collection_proto_init() { } file_common_policies_proto_init() if !protoimpl.UnsafeEnabled { - file_common_collection_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_collection_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionConfigPackage); i { case 0: return &v.state @@ -472,7 +472,7 @@ func file_common_collection_proto_init() { return nil } } - file_common_collection_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_collection_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionConfig); i { case 0: return &v.state @@ -484,7 +484,7 @@ func file_common_collection_proto_init() { return nil } } - file_common_collection_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_common_collection_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StaticCollectionConfig); i { case 0: return &v.state @@ -496,7 +496,7 @@ func file_common_collection_proto_init() { return nil } } - file_common_collection_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_common_collection_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionPolicyConfig); i { case 0: return &v.state @@ -509,10 +509,10 @@ func file_common_collection_proto_init() { } } } - file_common_collection_proto_msgTypes[1].OneofWrappers = []any{ + file_common_collection_proto_msgTypes[1].OneofWrappers = []interface{}{ (*CollectionConfig_StaticCollectionConfig)(nil), } - file_common_collection_proto_msgTypes[3].OneofWrappers = []any{ + file_common_collection_proto_msgTypes[3].OneofWrappers = []interface{}{ (*CollectionPolicyConfig_SignaturePolicy)(nil), } type x struct{} diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/common.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/common.pb.go index 4718005d7ed..9cf7b419fb7 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/common.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/common.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: common/common.proto @@ -1224,7 +1224,7 @@ func file_common_common_proto_rawDescGZIP() []byte { var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 14) -var file_common_common_proto_goTypes = []any{ +var file_common_common_proto_goTypes = []interface{}{ (Status)(0), // 0: common.Status (HeaderType)(0), // 1: common.HeaderType (BlockMetadataIndex)(0), // 2: common.BlockMetadataIndex @@ -1265,7 +1265,7 @@ func file_common_common_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_common_common_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LastConfig); i { case 0: return &v.state @@ -1277,7 +1277,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Metadata); i { case 0: return &v.state @@ -1289,7 +1289,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MetadataSignature); i { case 0: return &v.state @@ -1301,7 +1301,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IdentifierHeader); i { case 0: return &v.state @@ -1313,7 +1313,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Header); i { case 0: return &v.state @@ -1325,7 +1325,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChannelHeader); i { case 0: return &v.state @@ -1337,7 +1337,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignatureHeader); i { case 0: return &v.state @@ -1349,7 +1349,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Payload); i { case 0: return &v.state @@ -1361,7 +1361,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Envelope); i { case 0: return &v.state @@ -1373,7 +1373,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Block); i { case 0: return &v.state @@ -1385,7 +1385,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockHeader); i { case 0: return &v.state @@ -1397,7 +1397,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockData); i { case 0: return &v.state @@ -1409,7 +1409,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockMetadata); i { case 0: return &v.state @@ -1421,7 +1421,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OrdererBlockMetadata); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configtx.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configtx.pb.go index cdbf40d9e54..b4ad11d2151 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configtx.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configtx.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: common/configtx.proto @@ -676,7 +676,7 @@ func file_common_configtx_proto_rawDescGZIP() []byte { } var file_common_configtx_proto_msgTypes = make([]protoimpl.MessageInfo, 12) -var file_common_configtx_proto_goTypes = []any{ +var file_common_configtx_proto_goTypes = []interface{}{ (*ConfigEnvelope)(nil), // 0: common.ConfigEnvelope (*Config)(nil), // 1: common.Config (*ConfigUpdateEnvelope)(nil), // 2: common.ConfigUpdateEnvelope @@ -722,7 +722,7 @@ func file_common_configtx_proto_init() { file_common_common_proto_init() file_common_policies_proto_init() if !protoimpl.UnsafeEnabled { - file_common_configtx_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigEnvelope); i { case 0: return &v.state @@ -734,7 +734,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Config); i { case 0: return &v.state @@ -746,7 +746,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigUpdateEnvelope); i { case 0: return &v.state @@ -758,7 +758,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigUpdate); i { case 0: return &v.state @@ -770,7 +770,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigGroup); i { case 0: return &v.state @@ -782,7 +782,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigValue); i { case 0: return &v.state @@ -794,7 +794,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigPolicy); i { case 0: return &v.state @@ -806,7 +806,7 @@ func file_common_configtx_proto_init() { return nil } } - file_common_configtx_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_common_configtx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigSignature); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configuration.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configuration.pb.go index 103779a2c16..62d28549f93 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configuration.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/configuration.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: common/configuration.proto @@ -559,7 +559,7 @@ func file_common_configuration_proto_rawDescGZIP() []byte { } var file_common_configuration_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_common_configuration_proto_goTypes = []any{ +var file_common_configuration_proto_goTypes = []interface{}{ (*HashingAlgorithm)(nil), // 0: common.HashingAlgorithm (*BlockDataHashingStructure)(nil), // 1: common.BlockDataHashingStructure (*OrdererAddresses)(nil), // 2: common.OrdererAddresses @@ -587,7 +587,7 @@ func file_common_configuration_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_common_configuration_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HashingAlgorithm); i { case 0: return &v.state @@ -599,7 +599,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockDataHashingStructure); i { case 0: return &v.state @@ -611,7 +611,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OrdererAddresses); i { case 0: return &v.state @@ -623,7 +623,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Consenter); i { case 0: return &v.state @@ -635,7 +635,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Orderers); i { case 0: return &v.state @@ -647,7 +647,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Consortium); i { case 0: return &v.state @@ -659,7 +659,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Capabilities); i { case 0: return &v.state @@ -671,7 +671,7 @@ func file_common_configuration_proto_init() { return nil } } - file_common_configuration_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_common_configuration_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Capability); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/ledger.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/ledger.pb.go index 2a243d13468..5a0e64db346 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/ledger.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/ledger.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: common/ledger.proto @@ -197,7 +197,7 @@ func file_common_ledger_proto_rawDescGZIP() []byte { } var file_common_ledger_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_common_ledger_proto_goTypes = []any{ +var file_common_ledger_proto_goTypes = []interface{}{ (*BlockchainInfo)(nil), // 0: common.BlockchainInfo (*BootstrappingSnapshotInfo)(nil), // 1: common.BootstrappingSnapshotInfo } @@ -216,7 +216,7 @@ func file_common_ledger_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_common_ledger_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_ledger_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockchainInfo); i { case 0: return &v.state @@ -228,7 +228,7 @@ func file_common_ledger_proto_init() { return nil } } - file_common_ledger_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_ledger_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BootstrappingSnapshotInfo); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/policies.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/policies.pb.go index 4cb39e3d274..0cce1cf6bd6 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/policies.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/common/policies.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: common/policies.proto @@ -627,7 +627,7 @@ func file_common_policies_proto_rawDescGZIP() []byte { var file_common_policies_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_common_policies_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_common_policies_proto_goTypes = []any{ +var file_common_policies_proto_goTypes = []interface{}{ (Policy_PolicyType)(0), // 0: common.Policy.PolicyType (ImplicitMetaPolicy_Rule)(0), // 1: common.ImplicitMetaPolicy.Rule (*Policy)(nil), // 2: common.Policy @@ -658,7 +658,7 @@ func file_common_policies_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_common_policies_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_policies_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Policy); i { case 0: return &v.state @@ -670,7 +670,7 @@ func file_common_policies_proto_init() { return nil } } - file_common_policies_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_policies_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignaturePolicyEnvelope); i { case 0: return &v.state @@ -682,7 +682,7 @@ func file_common_policies_proto_init() { return nil } } - file_common_policies_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_common_policies_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignaturePolicy); i { case 0: return &v.state @@ -694,7 +694,7 @@ func file_common_policies_proto_init() { return nil } } - file_common_policies_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_common_policies_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ImplicitMetaPolicy); i { case 0: return &v.state @@ -706,7 +706,7 @@ func file_common_policies_proto_init() { return nil } } - file_common_policies_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_common_policies_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ApplicationPolicy); i { case 0: return &v.state @@ -718,7 +718,7 @@ func file_common_policies_proto_init() { return nil } } - file_common_policies_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_common_policies_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignaturePolicy_NOutOf); i { case 0: return &v.state @@ -731,11 +731,11 @@ func file_common_policies_proto_init() { } } } - file_common_policies_proto_msgTypes[2].OneofWrappers = []any{ + file_common_policies_proto_msgTypes[2].OneofWrappers = []interface{}{ (*SignaturePolicy_SignedBy)(nil), (*SignaturePolicy_NOutOf_)(nil), } - file_common_policies_proto_msgTypes[4].OneofWrappers = []any{ + file_common_policies_proto_msgTypes[4].OneofWrappers = []interface{}{ (*ApplicationPolicy_SignaturePolicy)(nil), (*ApplicationPolicy_ChannelConfigPolicyReference)(nil), } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol.pb.go index 6414746c1b2..7587b616d60 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: discovery/protocol.proto @@ -1440,7 +1440,7 @@ func file_discovery_protocol_proto_rawDescGZIP() []byte { } var file_discovery_protocol_proto_msgTypes = make([]protoimpl.MessageInfo, 25) -var file_discovery_protocol_proto_goTypes = []any{ +var file_discovery_protocol_proto_goTypes = []interface{}{ (*SignedRequest)(nil), // 0: discovery.SignedRequest (*Request)(nil), // 1: discovery.Request (*Response)(nil), // 2: discovery.Response @@ -1514,7 +1514,7 @@ func file_discovery_protocol_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_discovery_protocol_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignedRequest); i { case 0: return &v.state @@ -1526,7 +1526,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Request); i { case 0: return &v.state @@ -1538,7 +1538,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Response); i { case 0: return &v.state @@ -1550,7 +1550,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AuthInfo); i { case 0: return &v.state @@ -1562,7 +1562,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Query); i { case 0: return &v.state @@ -1574,7 +1574,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryResult); i { case 0: return &v.state @@ -1586,7 +1586,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigQuery); i { case 0: return &v.state @@ -1598,7 +1598,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigResult); i { case 0: return &v.state @@ -1610,7 +1610,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerMembershipQuery); i { case 0: return &v.state @@ -1622,7 +1622,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerMembershipResult); i { case 0: return &v.state @@ -1634,7 +1634,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeQuery); i { case 0: return &v.state @@ -1646,7 +1646,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeQueryResult); i { case 0: return &v.state @@ -1658,7 +1658,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LocalPeerQuery); i { case 0: return &v.state @@ -1670,7 +1670,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EndorsementDescriptor); i { case 0: return &v.state @@ -1682,7 +1682,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[14].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Layout); i { case 0: return &v.state @@ -1694,7 +1694,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[15].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Peers); i { case 0: return &v.state @@ -1706,7 +1706,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[16].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Peer); i { case 0: return &v.state @@ -1718,7 +1718,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[17].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Error); i { case 0: return &v.state @@ -1730,7 +1730,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[18].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Endpoints); i { case 0: return &v.state @@ -1742,7 +1742,7 @@ func file_discovery_protocol_proto_init() { return nil } } - file_discovery_protocol_proto_msgTypes[19].Exporter = func(v any, i int) any { + file_discovery_protocol_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Endpoint); i { case 0: return &v.state @@ -1755,13 +1755,13 @@ func file_discovery_protocol_proto_init() { } } } - file_discovery_protocol_proto_msgTypes[4].OneofWrappers = []any{ + file_discovery_protocol_proto_msgTypes[4].OneofWrappers = []interface{}{ (*Query_ConfigQuery)(nil), (*Query_PeerQuery)(nil), (*Query_CcQuery)(nil), (*Query_LocalPeers)(nil), } - file_discovery_protocol_proto_msgTypes[5].OneofWrappers = []any{ + file_discovery_protocol_proto_msgTypes[5].OneofWrappers = []interface{}{ (*QueryResult_Error)(nil), (*QueryResult_ConfigResult)(nil), (*QueryResult_CcQueryRes)(nil), diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol_grpc.pb.go index 68fd879aca0..387942cd82c 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/discovery/protocol_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: discovery/protocol.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Discovery_Discover_FullMethodName = "/discovery.Discovery/Discover" @@ -29,9 +29,6 @@ const ( // DiscoveryClient is the client API for Discovery service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Discovery defines a service that serves information about the fabric network -// like which peers, orderers, chaincodes, etc. type DiscoveryClient interface { // Discover receives a signed request, and returns a response. Discover(ctx context.Context, in *SignedRequest, opts ...grpc.CallOption) (*Response, error) @@ -46,9 +43,8 @@ func NewDiscoveryClient(cc grpc.ClientConnInterface) DiscoveryClient { } func (c *discoveryClient) Discover(ctx context.Context, in *SignedRequest, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Response) - err := c.cc.Invoke(ctx, Discovery_Discover_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Discovery_Discover_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -57,26 +53,19 @@ func (c *discoveryClient) Discover(ctx context.Context, in *SignedRequest, opts // DiscoveryServer is the server API for Discovery service. // All implementations should embed UnimplementedDiscoveryServer -// for forward compatibility. -// -// Discovery defines a service that serves information about the fabric network -// like which peers, orderers, chaincodes, etc. +// for forward compatibility type DiscoveryServer interface { // Discover receives a signed request, and returns a response. Discover(context.Context, *SignedRequest) (*Response, error) } -// UnimplementedDiscoveryServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedDiscoveryServer struct{} +// UnimplementedDiscoveryServer should be embedded to have forward compatible implementations. +type UnimplementedDiscoveryServer struct { +} func (UnimplementedDiscoveryServer) Discover(context.Context, *SignedRequest) (*Response, error) { return nil, status.Errorf(codes.Unimplemented, "method Discover not implemented") } -func (UnimplementedDiscoveryServer) testEmbeddedByValue() {} // UnsafeDiscoveryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DiscoveryServer will @@ -86,13 +75,6 @@ type UnsafeDiscoveryServer interface { } func RegisterDiscoveryServer(s grpc.ServiceRegistrar, srv DiscoveryServer) { - // If the following call pancis, it indicates UnimplementedDiscoveryServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Discovery_ServiceDesc, srv) } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway.pb.go index 532e7b14418..48063a42faa 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: gateway/gateway.proto @@ -1157,7 +1157,7 @@ func file_gateway_gateway_proto_rawDescGZIP() []byte { } var file_gateway_gateway_proto_msgTypes = make([]protoimpl.MessageInfo, 15) -var file_gateway_gateway_proto_goTypes = []any{ +var file_gateway_gateway_proto_goTypes = []interface{}{ (*EndorseRequest)(nil), // 0: gateway.EndorseRequest (*EndorseResponse)(nil), // 1: gateway.EndorseResponse (*SubmitRequest)(nil), // 2: gateway.SubmitRequest @@ -1214,7 +1214,7 @@ func file_gateway_gateway_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_gateway_gateway_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EndorseRequest); i { case 0: return &v.state @@ -1226,7 +1226,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EndorseResponse); i { case 0: return &v.state @@ -1238,7 +1238,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SubmitRequest); i { case 0: return &v.state @@ -1250,7 +1250,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SubmitResponse); i { case 0: return &v.state @@ -1262,7 +1262,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignedCommitStatusRequest); i { case 0: return &v.state @@ -1274,7 +1274,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CommitStatusRequest); i { case 0: return &v.state @@ -1286,7 +1286,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CommitStatusResponse); i { case 0: return &v.state @@ -1298,7 +1298,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EvaluateRequest); i { case 0: return &v.state @@ -1310,7 +1310,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EvaluateResponse); i { case 0: return &v.state @@ -1322,7 +1322,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignedChaincodeEventsRequest); i { case 0: return &v.state @@ -1334,7 +1334,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeEventsRequest); i { case 0: return &v.state @@ -1346,7 +1346,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeEventsResponse); i { case 0: return &v.state @@ -1358,7 +1358,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ErrorDetail); i { case 0: return &v.state @@ -1370,7 +1370,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ProposedTransaction); i { case 0: return &v.state @@ -1382,7 +1382,7 @@ func file_gateway_gateway_proto_init() { return nil } } - file_gateway_gateway_proto_msgTypes[14].Exporter = func(v any, i int) any { + file_gateway_gateway_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PreparedTransaction); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway_grpc.pb.go index 48c62956ecd..102c58ee642 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gateway/gateway_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: gateway/gateway.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Gateway_Endorse_FullMethodName = "/gateway.Gateway/Endorse" @@ -33,13 +33,6 @@ const ( // GatewayClient is the client API for Gateway service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// The Gateway API for evaluating and submitting transactions via the gateway. -// Transaction evaluation (query) requires the invocation of the Evaluate service -// Transaction submission (ledger updates) is a two step process invoking Endorse -// followed by Submit. A third step, invoking CommitStatus, is required if the -// clients wish to wait for a Transaction to be committed. -// The proposal and transaction must be signed by the client before each step. type GatewayClient interface { // The Endorse service passes a proposed transaction to the gateway in order to // obtain sufficient endorsement. @@ -66,7 +59,7 @@ type GatewayClient interface { // requested chaincode for a specific block. The streamed responses are ordered by ascending block number. Responses // are only returned for blocks that contain the requested events, while blocks not containing any of the requested // events are skipped. - ChaincodeEvents(ctx context.Context, in *SignedChaincodeEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ChaincodeEventsResponse], error) + ChaincodeEvents(ctx context.Context, in *SignedChaincodeEventsRequest, opts ...grpc.CallOption) (Gateway_ChaincodeEventsClient, error) } type gatewayClient struct { @@ -78,9 +71,8 @@ func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient { } func (c *gatewayClient) Endorse(ctx context.Context, in *EndorseRequest, opts ...grpc.CallOption) (*EndorseResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(EndorseResponse) - err := c.cc.Invoke(ctx, Gateway_Endorse_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Gateway_Endorse_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -88,9 +80,8 @@ func (c *gatewayClient) Endorse(ctx context.Context, in *EndorseRequest, opts .. } func (c *gatewayClient) Submit(ctx context.Context, in *SubmitRequest, opts ...grpc.CallOption) (*SubmitResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(SubmitResponse) - err := c.cc.Invoke(ctx, Gateway_Submit_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Gateway_Submit_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -98,9 +89,8 @@ func (c *gatewayClient) Submit(ctx context.Context, in *SubmitRequest, opts ...g } func (c *gatewayClient) CommitStatus(ctx context.Context, in *SignedCommitStatusRequest, opts ...grpc.CallOption) (*CommitStatusResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CommitStatusResponse) - err := c.cc.Invoke(ctx, Gateway_CommitStatus_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Gateway_CommitStatus_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -108,22 +98,20 @@ func (c *gatewayClient) CommitStatus(ctx context.Context, in *SignedCommitStatus } func (c *gatewayClient) Evaluate(ctx context.Context, in *EvaluateRequest, opts ...grpc.CallOption) (*EvaluateResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(EvaluateResponse) - err := c.cc.Invoke(ctx, Gateway_Evaluate_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Gateway_Evaluate_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *gatewayClient) ChaincodeEvents(ctx context.Context, in *SignedChaincodeEventsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ChaincodeEventsResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Gateway_ServiceDesc.Streams[0], Gateway_ChaincodeEvents_FullMethodName, cOpts...) +func (c *gatewayClient) ChaincodeEvents(ctx context.Context, in *SignedChaincodeEventsRequest, opts ...grpc.CallOption) (Gateway_ChaincodeEventsClient, error) { + stream, err := c.cc.NewStream(ctx, &Gateway_ServiceDesc.Streams[0], Gateway_ChaincodeEvents_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[SignedChaincodeEventsRequest, ChaincodeEventsResponse]{ClientStream: stream} + x := &gatewayChaincodeEventsClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -133,19 +121,26 @@ func (c *gatewayClient) ChaincodeEvents(ctx context.Context, in *SignedChaincode return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Gateway_ChaincodeEventsClient = grpc.ServerStreamingClient[ChaincodeEventsResponse] +type Gateway_ChaincodeEventsClient interface { + Recv() (*ChaincodeEventsResponse, error) + grpc.ClientStream +} + +type gatewayChaincodeEventsClient struct { + grpc.ClientStream +} + +func (x *gatewayChaincodeEventsClient) Recv() (*ChaincodeEventsResponse, error) { + m := new(ChaincodeEventsResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // GatewayServer is the server API for Gateway service. // All implementations should embed UnimplementedGatewayServer -// for forward compatibility. -// -// The Gateway API for evaluating and submitting transactions via the gateway. -// Transaction evaluation (query) requires the invocation of the Evaluate service -// Transaction submission (ledger updates) is a two step process invoking Endorse -// followed by Submit. A third step, invoking CommitStatus, is required if the -// clients wish to wait for a Transaction to be committed. -// The proposal and transaction must be signed by the client before each step. +// for forward compatibility type GatewayServer interface { // The Endorse service passes a proposed transaction to the gateway in order to // obtain sufficient endorsement. @@ -172,15 +167,12 @@ type GatewayServer interface { // requested chaincode for a specific block. The streamed responses are ordered by ascending block number. Responses // are only returned for blocks that contain the requested events, while blocks not containing any of the requested // events are skipped. - ChaincodeEvents(*SignedChaincodeEventsRequest, grpc.ServerStreamingServer[ChaincodeEventsResponse]) error + ChaincodeEvents(*SignedChaincodeEventsRequest, Gateway_ChaincodeEventsServer) error } -// UnimplementedGatewayServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedGatewayServer struct{} +// UnimplementedGatewayServer should be embedded to have forward compatible implementations. +type UnimplementedGatewayServer struct { +} func (UnimplementedGatewayServer) Endorse(context.Context, *EndorseRequest) (*EndorseResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Endorse not implemented") @@ -194,10 +186,9 @@ func (UnimplementedGatewayServer) CommitStatus(context.Context, *SignedCommitSta func (UnimplementedGatewayServer) Evaluate(context.Context, *EvaluateRequest) (*EvaluateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Evaluate not implemented") } -func (UnimplementedGatewayServer) ChaincodeEvents(*SignedChaincodeEventsRequest, grpc.ServerStreamingServer[ChaincodeEventsResponse]) error { +func (UnimplementedGatewayServer) ChaincodeEvents(*SignedChaincodeEventsRequest, Gateway_ChaincodeEventsServer) error { return status.Errorf(codes.Unimplemented, "method ChaincodeEvents not implemented") } -func (UnimplementedGatewayServer) testEmbeddedByValue() {} // UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to GatewayServer will @@ -207,13 +198,6 @@ type UnsafeGatewayServer interface { } func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) { - // If the following call pancis, it indicates UnimplementedGatewayServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Gateway_ServiceDesc, srv) } @@ -294,11 +278,21 @@ func _Gateway_ChaincodeEvents_Handler(srv interface{}, stream grpc.ServerStream) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(GatewayServer).ChaincodeEvents(m, &grpc.GenericServerStream[SignedChaincodeEventsRequest, ChaincodeEventsResponse]{ServerStream: stream}) + return srv.(GatewayServer).ChaincodeEvents(m, &gatewayChaincodeEventsServer{stream}) +} + +type Gateway_ChaincodeEventsServer interface { + Send(*ChaincodeEventsResponse) error + grpc.ServerStream +} + +type gatewayChaincodeEventsServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Gateway_ChaincodeEventsServer = grpc.ServerStreamingServer[ChaincodeEventsResponse] +func (x *gatewayChaincodeEventsServer) Send(m *ChaincodeEventsResponse) error { + return x.ServerStream.SendMsg(m) +} // Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message.pb.go index e29bfcc5902..c2a60197b60 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: gossip/message.proto @@ -2868,7 +2868,7 @@ func file_gossip_message_proto_rawDescGZIP() []byte { var file_gossip_message_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_gossip_message_proto_msgTypes = make([]protoimpl.MessageInfo, 34) -var file_gossip_message_proto_goTypes = []any{ +var file_gossip_message_proto_goTypes = []interface{}{ (PullMsgType)(0), // 0: gossip.PullMsgType (GossipMessage_Tag)(0), // 1: gossip.GossipMessage.Tag (*Envelope)(nil), // 2: gossip.Envelope @@ -2970,7 +2970,7 @@ func file_gossip_message_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_gossip_message_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Envelope); i { case 0: return &v.state @@ -2982,7 +2982,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SecretEnvelope); i { case 0: return &v.state @@ -2994,7 +2994,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Secret); i { case 0: return &v.state @@ -3006,7 +3006,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GossipMessage); i { case 0: return &v.state @@ -3018,7 +3018,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateInfo); i { case 0: return &v.state @@ -3030,7 +3030,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Properties); i { case 0: return &v.state @@ -3042,7 +3042,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateInfoSnapshot); i { case 0: return &v.state @@ -3054,7 +3054,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateInfoPullRequest); i { case 0: return &v.state @@ -3066,7 +3066,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConnEstablish); i { case 0: return &v.state @@ -3078,7 +3078,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerIdentity); i { case 0: return &v.state @@ -3090,7 +3090,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataRequest); i { case 0: return &v.state @@ -3102,7 +3102,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GossipHello); i { case 0: return &v.state @@ -3114,7 +3114,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataUpdate); i { case 0: return &v.state @@ -3126,7 +3126,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataDigest); i { case 0: return &v.state @@ -3138,7 +3138,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[14].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataMessage); i { case 0: return &v.state @@ -3150,7 +3150,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[15].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PrivateDataMessage); i { case 0: return &v.state @@ -3162,7 +3162,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[16].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Payload); i { case 0: return &v.state @@ -3174,7 +3174,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[17].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PrivatePayload); i { case 0: return &v.state @@ -3186,7 +3186,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[18].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AliveMessage); i { case 0: return &v.state @@ -3198,7 +3198,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[19].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LeadershipMessage); i { case 0: return &v.state @@ -3210,7 +3210,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[20].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PeerTime); i { case 0: return &v.state @@ -3222,7 +3222,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[21].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MembershipRequest); i { case 0: return &v.state @@ -3234,7 +3234,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[22].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MembershipResponse); i { case 0: return &v.state @@ -3246,7 +3246,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[23].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Member); i { case 0: return &v.state @@ -3258,7 +3258,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[24].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Empty); i { case 0: return &v.state @@ -3270,7 +3270,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[25].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoteStateRequest); i { case 0: return &v.state @@ -3282,7 +3282,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[26].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemoteStateResponse); i { case 0: return &v.state @@ -3294,7 +3294,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[27].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemotePvtDataRequest); i { case 0: return &v.state @@ -3306,7 +3306,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[28].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PvtDataDigest); i { case 0: return &v.state @@ -3318,7 +3318,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[29].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RemotePvtDataResponse); i { case 0: return &v.state @@ -3330,7 +3330,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[30].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PvtDataElement); i { case 0: return &v.state @@ -3342,7 +3342,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[31].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PvtDataPayload); i { case 0: return &v.state @@ -3354,7 +3354,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[32].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Acknowledgement); i { case 0: return &v.state @@ -3366,7 +3366,7 @@ func file_gossip_message_proto_init() { return nil } } - file_gossip_message_proto_msgTypes[33].Exporter = func(v any, i int) any { + file_gossip_message_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Chaincode); i { case 0: return &v.state @@ -3379,10 +3379,10 @@ func file_gossip_message_proto_init() { } } } - file_gossip_message_proto_msgTypes[2].OneofWrappers = []any{ + file_gossip_message_proto_msgTypes[2].OneofWrappers = []interface{}{ (*Secret_InternalEndpoint)(nil), } - file_gossip_message_proto_msgTypes[3].OneofWrappers = []any{ + file_gossip_message_proto_msgTypes[3].OneofWrappers = []interface{}{ (*GossipMessage_AliveMsg)(nil), (*GossipMessage_MemReq)(nil), (*GossipMessage_MemRes)(nil), diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message_grpc.pb.go index 84ecf408d81..9930cbdf5da 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/gossip/message_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: gossip/message.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Gossip_GossipStream_FullMethodName = "/gossip.Gossip/GossipStream" @@ -30,11 +30,9 @@ const ( // GossipClient is the client API for Gossip service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Gossip type GossipClient interface { // GossipStream is the gRPC stream used for sending and receiving messages - GossipStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Envelope, Envelope], error) + GossipStream(ctx context.Context, opts ...grpc.CallOption) (Gossip_GossipStreamClient, error) // Ping is used to probe a remote peer's aliveness Ping(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) } @@ -47,23 +45,40 @@ func NewGossipClient(cc grpc.ClientConnInterface) GossipClient { return &gossipClient{cc} } -func (c *gossipClient) GossipStream(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Envelope, Envelope], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Gossip_ServiceDesc.Streams[0], Gossip_GossipStream_FullMethodName, cOpts...) +func (c *gossipClient) GossipStream(ctx context.Context, opts ...grpc.CallOption) (Gossip_GossipStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &Gossip_ServiceDesc.Streams[0], Gossip_GossipStream_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[Envelope, Envelope]{ClientStream: stream} + x := &gossipGossipStreamClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Gossip_GossipStreamClient = grpc.BidiStreamingClient[Envelope, Envelope] +type Gossip_GossipStreamClient interface { + Send(*Envelope) error + Recv() (*Envelope, error) + grpc.ClientStream +} + +type gossipGossipStreamClient struct { + grpc.ClientStream +} + +func (x *gossipGossipStreamClient) Send(m *Envelope) error { + return x.ClientStream.SendMsg(m) +} + +func (x *gossipGossipStreamClient) Recv() (*Envelope, error) { + m := new(Envelope) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func (c *gossipClient) Ping(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(Empty) - err := c.cc.Invoke(ctx, Gossip_Ping_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Gossip_Ping_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -72,30 +87,24 @@ func (c *gossipClient) Ping(ctx context.Context, in *Empty, opts ...grpc.CallOpt // GossipServer is the server API for Gossip service. // All implementations should embed UnimplementedGossipServer -// for forward compatibility. -// -// Gossip +// for forward compatibility type GossipServer interface { // GossipStream is the gRPC stream used for sending and receiving messages - GossipStream(grpc.BidiStreamingServer[Envelope, Envelope]) error + GossipStream(Gossip_GossipStreamServer) error // Ping is used to probe a remote peer's aliveness Ping(context.Context, *Empty) (*Empty, error) } -// UnimplementedGossipServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedGossipServer struct{} +// UnimplementedGossipServer should be embedded to have forward compatible implementations. +type UnimplementedGossipServer struct { +} -func (UnimplementedGossipServer) GossipStream(grpc.BidiStreamingServer[Envelope, Envelope]) error { +func (UnimplementedGossipServer) GossipStream(Gossip_GossipStreamServer) error { return status.Errorf(codes.Unimplemented, "method GossipStream not implemented") } func (UnimplementedGossipServer) Ping(context.Context, *Empty) (*Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") } -func (UnimplementedGossipServer) testEmbeddedByValue() {} // UnsafeGossipServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to GossipServer will @@ -105,22 +114,34 @@ type UnsafeGossipServer interface { } func RegisterGossipServer(s grpc.ServiceRegistrar, srv GossipServer) { - // If the following call pancis, it indicates UnimplementedGossipServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Gossip_ServiceDesc, srv) } func _Gossip_GossipStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(GossipServer).GossipStream(&grpc.GenericServerStream[Envelope, Envelope]{ServerStream: stream}) + return srv.(GossipServer).GossipStream(&gossipGossipStreamServer{stream}) +} + +type Gossip_GossipStreamServer interface { + Send(*Envelope) error + Recv() (*Envelope, error) + grpc.ServerStream +} + +type gossipGossipStreamServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Gossip_GossipStreamServer = grpc.BidiStreamingServer[Envelope, Envelope] +func (x *gossipGossipStreamServer) Send(m *Envelope) error { + return x.ServerStream.SendMsg(m) +} + +func (x *gossipGossipStreamServer) Recv() (*Envelope, error) { + m := new(Envelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func _Gossip_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(Empty) diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult/kv_query_result.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult/kv_query_result.pb.go index 4b2e5485a35..4d3b3dd3121 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult/kv_query_result.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult/kv_query_result.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: ledger/queryresult/kv_query_result.proto @@ -214,7 +214,7 @@ func file_ledger_queryresult_kv_query_result_proto_rawDescGZIP() []byte { } var file_ledger_queryresult_kv_query_result_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_ledger_queryresult_kv_query_result_proto_goTypes = []any{ +var file_ledger_queryresult_kv_query_result_proto_goTypes = []interface{}{ (*KV)(nil), // 0: queryresult.KV (*KeyModification)(nil), // 1: queryresult.KeyModification (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp @@ -234,7 +234,7 @@ func file_ledger_queryresult_kv_query_result_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_ledger_queryresult_kv_query_result_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_ledger_queryresult_kv_query_result_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KV); i { case 0: return &v.state @@ -246,7 +246,7 @@ func file_ledger_queryresult_kv_query_result_proto_init() { return nil } } - file_ledger_queryresult_kv_query_result_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_ledger_queryresult_kv_query_result_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KeyModification); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/kvrwset/kv_rwset.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/kvrwset/kv_rwset.pb.go index 49e885ce045..1e57e454308 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/kvrwset/kv_rwset.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/kvrwset/kv_rwset.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: ledger/rwset/kvrwset/kv_rwset.proto @@ -998,7 +998,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_rawDescGZIP() []byte { } var file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_ledger_rwset_kvrwset_kv_rwset_proto_goTypes = []any{ +var file_ledger_rwset_kvrwset_kv_rwset_proto_goTypes = []interface{}{ (*KVRWSet)(nil), // 0: kvrwset.KVRWSet (*HashedRWSet)(nil), // 1: kvrwset.HashedRWSet (*KVRead)(nil), // 2: kvrwset.KVRead @@ -1041,7 +1041,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVRWSet); i { case 0: return &v.state @@ -1053,7 +1053,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HashedRWSet); i { case 0: return &v.state @@ -1065,7 +1065,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVRead); i { case 0: return &v.state @@ -1077,7 +1077,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVWrite); i { case 0: return &v.state @@ -1089,7 +1089,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVMetadataWrite); i { case 0: return &v.state @@ -1101,7 +1101,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVReadHash); i { case 0: return &v.state @@ -1113,7 +1113,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVWriteHash); i { case 0: return &v.state @@ -1125,7 +1125,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVMetadataWriteHash); i { case 0: return &v.state @@ -1137,7 +1137,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KVMetadataEntry); i { case 0: return &v.state @@ -1149,7 +1149,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Version); i { case 0: return &v.state @@ -1161,7 +1161,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RangeQueryInfo); i { case 0: return &v.state @@ -1173,7 +1173,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryReads); i { case 0: return &v.state @@ -1185,7 +1185,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { return nil } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryReadsMerkleSummary); i { case 0: return &v.state @@ -1198,7 +1198,7 @@ func file_ledger_rwset_kvrwset_kv_rwset_proto_init() { } } } - file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[10].OneofWrappers = []any{ + file_ledger_rwset_kvrwset_kv_rwset_proto_msgTypes[10].OneofWrappers = []interface{}{ (*RangeQueryInfo_RawReads)(nil), (*RangeQueryInfo_ReadsMerkleHashes)(nil), } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/rwset.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/rwset.pb.go index e67b19cbc79..3cf936e1369 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/rwset.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/ledger/rwset/rwset.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: ledger/rwset/rwset.proto @@ -506,7 +506,7 @@ func file_ledger_rwset_rwset_proto_rawDescGZIP() []byte { var file_ledger_rwset_rwset_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_ledger_rwset_rwset_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_ledger_rwset_rwset_proto_goTypes = []any{ +var file_ledger_rwset_rwset_proto_goTypes = []interface{}{ (TxReadWriteSet_DataModel)(0), // 0: rwset.TxReadWriteSet.DataModel (*TxReadWriteSet)(nil), // 1: rwset.TxReadWriteSet (*NsReadWriteSet)(nil), // 2: rwset.NsReadWriteSet @@ -535,7 +535,7 @@ func file_ledger_rwset_rwset_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_ledger_rwset_rwset_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_ledger_rwset_rwset_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TxReadWriteSet); i { case 0: return &v.state @@ -547,7 +547,7 @@ func file_ledger_rwset_rwset_proto_init() { return nil } } - file_ledger_rwset_rwset_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_ledger_rwset_rwset_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NsReadWriteSet); i { case 0: return &v.state @@ -559,7 +559,7 @@ func file_ledger_rwset_rwset_proto_init() { return nil } } - file_ledger_rwset_rwset_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_ledger_rwset_rwset_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionHashedReadWriteSet); i { case 0: return &v.state @@ -571,7 +571,7 @@ func file_ledger_rwset_rwset_proto_init() { return nil } } - file_ledger_rwset_rwset_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_ledger_rwset_rwset_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TxPvtReadWriteSet); i { case 0: return &v.state @@ -583,7 +583,7 @@ func file_ledger_rwset_rwset_proto_init() { return nil } } - file_ledger_rwset_rwset_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_ledger_rwset_rwset_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NsPvtReadWriteSet); i { case 0: return &v.state @@ -595,7 +595,7 @@ func file_ledger_rwset_rwset_proto_init() { return nil } } - file_ledger_rwset_rwset_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_ledger_rwset_rwset_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionPvtReadWriteSet); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/identities.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/identities.pb.go index d06aece04b0..f1748959679 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/identities.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/identities.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: msp/identities.proto @@ -218,7 +218,7 @@ func file_msp_identities_proto_rawDescGZIP() []byte { } var file_msp_identities_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_msp_identities_proto_goTypes = []any{ +var file_msp_identities_proto_goTypes = []interface{}{ (*SerializedIdentity)(nil), // 0: msp.SerializedIdentity (*SerializedIdemixIdentity)(nil), // 1: msp.SerializedIdemixIdentity } @@ -236,7 +236,7 @@ func file_msp_identities_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_msp_identities_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_msp_identities_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SerializedIdentity); i { case 0: return &v.state @@ -248,7 +248,7 @@ func file_msp_identities_proto_init() { return nil } } - file_msp_identities_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_msp_identities_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SerializedIdemixIdentity); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_config.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_config.pb.go index f0eb5b7dac2..ae9b136295c 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_config.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_config.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: msp/msp_config.proto @@ -923,7 +923,7 @@ func file_msp_msp_config_proto_rawDescGZIP() []byte { } var file_msp_msp_config_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_msp_msp_config_proto_goTypes = []any{ +var file_msp_msp_config_proto_goTypes = []interface{}{ (*MSPConfig)(nil), // 0: msp.MSPConfig (*FabricMSPConfig)(nil), // 1: msp.FabricMSPConfig (*FabricCryptoConfig)(nil), // 2: msp.FabricCryptoConfig @@ -958,7 +958,7 @@ func file_msp_msp_config_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_msp_msp_config_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MSPConfig); i { case 0: return &v.state @@ -970,7 +970,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FabricMSPConfig); i { case 0: return &v.state @@ -982,7 +982,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FabricCryptoConfig); i { case 0: return &v.state @@ -994,7 +994,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IdemixMSPConfig); i { case 0: return &v.state @@ -1006,7 +1006,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IdemixMSPSignerConfig); i { case 0: return &v.state @@ -1018,7 +1018,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SigningIdentityInfo); i { case 0: return &v.state @@ -1030,7 +1030,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KeyInfo); i { case 0: return &v.state @@ -1042,7 +1042,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FabricOUIdentifier); i { case 0: return &v.state @@ -1054,7 +1054,7 @@ func file_msp_msp_config_proto_init() { return nil } } - file_msp_msp_config_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_msp_msp_config_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FabricNodeOUs); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_principal.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_principal.pb.go index d9ca77e3d27..b7b34c2b00c 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_principal.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/msp/msp_principal.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: msp/msp_principal.proto @@ -593,7 +593,7 @@ func file_msp_msp_principal_proto_rawDescGZIP() []byte { var file_msp_msp_principal_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_msp_msp_principal_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_msp_msp_principal_proto_goTypes = []any{ +var file_msp_msp_principal_proto_goTypes = []interface{}{ (MSPPrincipal_Classification)(0), // 0: common.MSPPrincipal.Classification (MSPRole_MSPRoleType)(0), // 1: common.MSPRole.MSPRoleType (MSPIdentityAnonymity_MSPIdentityAnonymityType)(0), // 2: common.MSPIdentityAnonymity.MSPIdentityAnonymityType @@ -621,7 +621,7 @@ func file_msp_msp_principal_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_msp_msp_principal_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_msp_msp_principal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MSPPrincipal); i { case 0: return &v.state @@ -633,7 +633,7 @@ func file_msp_msp_principal_proto_init() { return nil } } - file_msp_msp_principal_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_msp_msp_principal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OrganizationUnit); i { case 0: return &v.state @@ -645,7 +645,7 @@ func file_msp_msp_principal_proto_init() { return nil } } - file_msp_msp_principal_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_msp_msp_principal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MSPRole); i { case 0: return &v.state @@ -657,7 +657,7 @@ func file_msp_msp_principal_proto_init() { return nil } } - file_msp_msp_principal_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_msp_msp_principal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MSPIdentityAnonymity); i { case 0: return &v.state @@ -669,7 +669,7 @@ func file_msp_msp_principal_proto_init() { return nil } } - file_msp_msp_principal_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_msp_msp_principal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CombinedPrincipal); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab.pb.go index 7ce79093367..0f04d2af92c 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/ab.proto @@ -775,7 +775,7 @@ func file_orderer_ab_proto_rawDescGZIP() []byte { var file_orderer_ab_proto_enumTypes = make([]protoimpl.EnumInfo, 3) var file_orderer_ab_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_orderer_ab_proto_goTypes = []any{ +var file_orderer_ab_proto_goTypes = []interface{}{ (SeekInfo_SeekBehavior)(0), // 0: orderer.SeekInfo.SeekBehavior (SeekInfo_SeekErrorResponse)(0), // 1: orderer.SeekInfo.SeekErrorResponse (SeekInfo_SeekContentType)(0), // 2: orderer.SeekInfo.SeekContentType @@ -821,7 +821,7 @@ func file_orderer_ab_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_ab_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BroadcastResponse); i { case 0: return &v.state @@ -833,7 +833,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SeekNewest); i { case 0: return &v.state @@ -845,7 +845,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SeekOldest); i { case 0: return &v.state @@ -857,7 +857,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SeekSpecified); i { case 0: return &v.state @@ -869,7 +869,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SeekNextCommit); i { case 0: return &v.state @@ -881,7 +881,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SeekPosition); i { case 0: return &v.state @@ -893,7 +893,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SeekInfo); i { case 0: return &v.state @@ -905,7 +905,7 @@ func file_orderer_ab_proto_init() { return nil } } - file_orderer_ab_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_orderer_ab_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeliverResponse); i { case 0: return &v.state @@ -918,13 +918,13 @@ func file_orderer_ab_proto_init() { } } } - file_orderer_ab_proto_msgTypes[5].OneofWrappers = []any{ + file_orderer_ab_proto_msgTypes[5].OneofWrappers = []interface{}{ (*SeekPosition_Newest)(nil), (*SeekPosition_Oldest)(nil), (*SeekPosition_Specified)(nil), (*SeekPosition_NextCommit)(nil), } - file_orderer_ab_proto_msgTypes[7].OneofWrappers = []any{ + file_orderer_ab_proto_msgTypes[7].OneofWrappers = []interface{}{ (*DeliverResponse_Status)(nil), (*DeliverResponse_Block)(nil), } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab_grpc.pb.go index ae4de726c75..6ceea60b175 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/ab_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: orderer/ab.proto @@ -20,8 +20,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( AtomicBroadcast_Broadcast_FullMethodName = "/orderer.AtomicBroadcast/Broadcast" @@ -33,9 +33,9 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AtomicBroadcastClient interface { // broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure - Broadcast(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, BroadcastResponse], error) + Broadcast(ctx context.Context, opts ...grpc.CallOption) (AtomicBroadcast_BroadcastClient, error) // deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received. - Deliver(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) + Deliver(ctx context.Context, opts ...grpc.CallOption) (AtomicBroadcast_DeliverClient, error) } type atomicBroadcastClient struct { @@ -46,56 +46,88 @@ func NewAtomicBroadcastClient(cc grpc.ClientConnInterface) AtomicBroadcastClient return &atomicBroadcastClient{cc} } -func (c *atomicBroadcastClient) Broadcast(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, BroadcastResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &AtomicBroadcast_ServiceDesc.Streams[0], AtomicBroadcast_Broadcast_FullMethodName, cOpts...) +func (c *atomicBroadcastClient) Broadcast(ctx context.Context, opts ...grpc.CallOption) (AtomicBroadcast_BroadcastClient, error) { + stream, err := c.cc.NewStream(ctx, &AtomicBroadcast_ServiceDesc.Streams[0], AtomicBroadcast_Broadcast_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[common.Envelope, BroadcastResponse]{ClientStream: stream} + x := &atomicBroadcastBroadcastClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type AtomicBroadcast_BroadcastClient = grpc.BidiStreamingClient[common.Envelope, BroadcastResponse] +type AtomicBroadcast_BroadcastClient interface { + Send(*common.Envelope) error + Recv() (*BroadcastResponse, error) + grpc.ClientStream +} + +type atomicBroadcastBroadcastClient struct { + grpc.ClientStream +} + +func (x *atomicBroadcastBroadcastClient) Send(m *common.Envelope) error { + return x.ClientStream.SendMsg(m) +} -func (c *atomicBroadcastClient) Deliver(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &AtomicBroadcast_ServiceDesc.Streams[1], AtomicBroadcast_Deliver_FullMethodName, cOpts...) +func (x *atomicBroadcastBroadcastClient) Recv() (*BroadcastResponse, error) { + m := new(BroadcastResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *atomicBroadcastClient) Deliver(ctx context.Context, opts ...grpc.CallOption) (AtomicBroadcast_DeliverClient, error) { + stream, err := c.cc.NewStream(ctx, &AtomicBroadcast_ServiceDesc.Streams[1], AtomicBroadcast_Deliver_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[common.Envelope, DeliverResponse]{ClientStream: stream} + x := &atomicBroadcastDeliverClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type AtomicBroadcast_DeliverClient = grpc.BidiStreamingClient[common.Envelope, DeliverResponse] +type AtomicBroadcast_DeliverClient interface { + Send(*common.Envelope) error + Recv() (*DeliverResponse, error) + grpc.ClientStream +} + +type atomicBroadcastDeliverClient struct { + grpc.ClientStream +} + +func (x *atomicBroadcastDeliverClient) Send(m *common.Envelope) error { + return x.ClientStream.SendMsg(m) +} + +func (x *atomicBroadcastDeliverClient) Recv() (*DeliverResponse, error) { + m := new(DeliverResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // AtomicBroadcastServer is the server API for AtomicBroadcast service. // All implementations should embed UnimplementedAtomicBroadcastServer -// for forward compatibility. +// for forward compatibility type AtomicBroadcastServer interface { // broadcast receives a reply of Acknowledgement for each common.Envelope in order, indicating success or type of failure - Broadcast(grpc.BidiStreamingServer[common.Envelope, BroadcastResponse]) error + Broadcast(AtomicBroadcast_BroadcastServer) error // deliver first requires an Envelope of type DELIVER_SEEK_INFO with Payload data as a mashaled SeekInfo message, then a stream of block replies is received. - Deliver(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error + Deliver(AtomicBroadcast_DeliverServer) error } -// UnimplementedAtomicBroadcastServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedAtomicBroadcastServer struct{} +// UnimplementedAtomicBroadcastServer should be embedded to have forward compatible implementations. +type UnimplementedAtomicBroadcastServer struct { +} -func (UnimplementedAtomicBroadcastServer) Broadcast(grpc.BidiStreamingServer[common.Envelope, BroadcastResponse]) error { +func (UnimplementedAtomicBroadcastServer) Broadcast(AtomicBroadcast_BroadcastServer) error { return status.Errorf(codes.Unimplemented, "method Broadcast not implemented") } -func (UnimplementedAtomicBroadcastServer) Deliver(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error { +func (UnimplementedAtomicBroadcastServer) Deliver(AtomicBroadcast_DeliverServer) error { return status.Errorf(codes.Unimplemented, "method Deliver not implemented") } -func (UnimplementedAtomicBroadcastServer) testEmbeddedByValue() {} // UnsafeAtomicBroadcastServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to AtomicBroadcastServer will @@ -105,29 +137,60 @@ type UnsafeAtomicBroadcastServer interface { } func RegisterAtomicBroadcastServer(s grpc.ServiceRegistrar, srv AtomicBroadcastServer) { - // If the following call pancis, it indicates UnimplementedAtomicBroadcastServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&AtomicBroadcast_ServiceDesc, srv) } func _AtomicBroadcast_Broadcast_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AtomicBroadcastServer).Broadcast(&grpc.GenericServerStream[common.Envelope, BroadcastResponse]{ServerStream: stream}) + return srv.(AtomicBroadcastServer).Broadcast(&atomicBroadcastBroadcastServer{stream}) +} + +type AtomicBroadcast_BroadcastServer interface { + Send(*BroadcastResponse) error + Recv() (*common.Envelope, error) + grpc.ServerStream +} + +type atomicBroadcastBroadcastServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type AtomicBroadcast_BroadcastServer = grpc.BidiStreamingServer[common.Envelope, BroadcastResponse] +func (x *atomicBroadcastBroadcastServer) Send(m *BroadcastResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *atomicBroadcastBroadcastServer) Recv() (*common.Envelope, error) { + m := new(common.Envelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func _AtomicBroadcast_Deliver_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(AtomicBroadcastServer).Deliver(&grpc.GenericServerStream[common.Envelope, DeliverResponse]{ServerStream: stream}) + return srv.(AtomicBroadcastServer).Deliver(&atomicBroadcastDeliverServer{stream}) } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type AtomicBroadcast_DeliverServer = grpc.BidiStreamingServer[common.Envelope, DeliverResponse] +type AtomicBroadcast_DeliverServer interface { + Send(*DeliverResponse) error + Recv() (*common.Envelope, error) + grpc.ServerStream +} + +type atomicBroadcastDeliverServer struct { + grpc.ServerStream +} + +func (x *atomicBroadcastDeliverServer) Send(m *DeliverResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *atomicBroadcastDeliverServer) Recv() (*common.Envelope, error) { + m := new(common.Envelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // AtomicBroadcast_ServiceDesc is the grpc.ServiceDesc for AtomicBroadcast service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation.pb.go index bd6c9b62625..416eeaea193 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/blockattestation.proto @@ -218,7 +218,7 @@ func file_orderer_blockattestation_proto_rawDescGZIP() []byte { } var file_orderer_blockattestation_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_orderer_blockattestation_proto_goTypes = []any{ +var file_orderer_blockattestation_proto_goTypes = []interface{}{ (*BlockAttestation)(nil), // 0: orderer.BlockAttestation (*BlockAttestationResponse)(nil), // 1: orderer.BlockAttestationResponse (*common.BlockHeader)(nil), // 2: common.BlockHeader @@ -246,7 +246,7 @@ func file_orderer_blockattestation_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_blockattestation_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_blockattestation_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockAttestation); i { case 0: return &v.state @@ -258,7 +258,7 @@ func file_orderer_blockattestation_proto_init() { return nil } } - file_orderer_blockattestation_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_blockattestation_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockAttestationResponse); i { case 0: return &v.state @@ -271,7 +271,7 @@ func file_orderer_blockattestation_proto_init() { } } } - file_orderer_blockattestation_proto_msgTypes[1].OneofWrappers = []any{ + file_orderer_blockattestation_proto_msgTypes[1].OneofWrappers = []interface{}{ (*BlockAttestationResponse_Status)(nil), (*BlockAttestationResponse_BlockAttestation)(nil), } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation_grpc.pb.go index 7e245d7f0db..f79406a70bc 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/blockattestation_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: orderer/blockattestation.proto @@ -20,8 +20,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( BlockAttestations_BlockAttestations_FullMethodName = "/orderer.BlockAttestations/BlockAttestations" @@ -32,7 +32,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type BlockAttestationsClient interface { // BlockAttestations receives an Envelope of type DELIVER_SEEK_INFO , then sends back a stream of BlockAttestations. - BlockAttestations(ctx context.Context, in *common.Envelope, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BlockAttestationResponse], error) + BlockAttestations(ctx context.Context, in *common.Envelope, opts ...grpc.CallOption) (BlockAttestations_BlockAttestationsClient, error) } type blockAttestationsClient struct { @@ -43,13 +43,12 @@ func NewBlockAttestationsClient(cc grpc.ClientConnInterface) BlockAttestationsCl return &blockAttestationsClient{cc} } -func (c *blockAttestationsClient) BlockAttestations(ctx context.Context, in *common.Envelope, opts ...grpc.CallOption) (grpc.ServerStreamingClient[BlockAttestationResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &BlockAttestations_ServiceDesc.Streams[0], BlockAttestations_BlockAttestations_FullMethodName, cOpts...) +func (c *blockAttestationsClient) BlockAttestations(ctx context.Context, in *common.Envelope, opts ...grpc.CallOption) (BlockAttestations_BlockAttestationsClient, error) { + stream, err := c.cc.NewStream(ctx, &BlockAttestations_ServiceDesc.Streams[0], BlockAttestations_BlockAttestations_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[common.Envelope, BlockAttestationResponse]{ClientStream: stream} + x := &blockAttestationsBlockAttestationsClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -59,28 +58,38 @@ func (c *blockAttestationsClient) BlockAttestations(ctx context.Context, in *com return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type BlockAttestations_BlockAttestationsClient = grpc.ServerStreamingClient[BlockAttestationResponse] +type BlockAttestations_BlockAttestationsClient interface { + Recv() (*BlockAttestationResponse, error) + grpc.ClientStream +} + +type blockAttestationsBlockAttestationsClient struct { + grpc.ClientStream +} + +func (x *blockAttestationsBlockAttestationsClient) Recv() (*BlockAttestationResponse, error) { + m := new(BlockAttestationResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // BlockAttestationsServer is the server API for BlockAttestations service. // All implementations should embed UnimplementedBlockAttestationsServer -// for forward compatibility. +// for forward compatibility type BlockAttestationsServer interface { // BlockAttestations receives an Envelope of type DELIVER_SEEK_INFO , then sends back a stream of BlockAttestations. - BlockAttestations(*common.Envelope, grpc.ServerStreamingServer[BlockAttestationResponse]) error + BlockAttestations(*common.Envelope, BlockAttestations_BlockAttestationsServer) error } -// UnimplementedBlockAttestationsServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedBlockAttestationsServer struct{} +// UnimplementedBlockAttestationsServer should be embedded to have forward compatible implementations. +type UnimplementedBlockAttestationsServer struct { +} -func (UnimplementedBlockAttestationsServer) BlockAttestations(*common.Envelope, grpc.ServerStreamingServer[BlockAttestationResponse]) error { +func (UnimplementedBlockAttestationsServer) BlockAttestations(*common.Envelope, BlockAttestations_BlockAttestationsServer) error { return status.Errorf(codes.Unimplemented, "method BlockAttestations not implemented") } -func (UnimplementedBlockAttestationsServer) testEmbeddedByValue() {} // UnsafeBlockAttestationsServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BlockAttestationsServer will @@ -90,13 +99,6 @@ type UnsafeBlockAttestationsServer interface { } func RegisterBlockAttestationsServer(s grpc.ServiceRegistrar, srv BlockAttestationsServer) { - // If the following call pancis, it indicates UnimplementedBlockAttestationsServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&BlockAttestations_ServiceDesc, srv) } @@ -105,11 +107,21 @@ func _BlockAttestations_BlockAttestations_Handler(srv interface{}, stream grpc.S if err := stream.RecvMsg(m); err != nil { return err } - return srv.(BlockAttestationsServer).BlockAttestations(m, &grpc.GenericServerStream[common.Envelope, BlockAttestationResponse]{ServerStream: stream}) + return srv.(BlockAttestationsServer).BlockAttestations(m, &blockAttestationsBlockAttestationsServer{stream}) +} + +type BlockAttestations_BlockAttestationsServer interface { + Send(*BlockAttestationResponse) error + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type BlockAttestations_BlockAttestationsServer = grpc.ServerStreamingServer[BlockAttestationResponse] +type blockAttestationsBlockAttestationsServer struct { + grpc.ServerStream +} + +func (x *blockAttestationsBlockAttestationsServer) Send(m *BlockAttestationResponse) error { + return x.ServerStream.SendMsg(m) +} // BlockAttestations_ServiceDesc is the grpc.ServiceDesc for BlockAttestations service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster.pb.go index 01b6ddc8c72..7fb5a76a407 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/cluster.proto @@ -451,7 +451,7 @@ func file_orderer_cluster_proto_rawDescGZIP() []byte { } var file_orderer_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_orderer_cluster_proto_goTypes = []any{ +var file_orderer_cluster_proto_goTypes = []interface{}{ (*StepRequest)(nil), // 0: orderer.StepRequest (*StepResponse)(nil), // 1: orderer.StepResponse (*ConsensusRequest)(nil), // 2: orderer.ConsensusRequest @@ -481,7 +481,7 @@ func file_orderer_cluster_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_cluster_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_cluster_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StepRequest); i { case 0: return &v.state @@ -493,7 +493,7 @@ func file_orderer_cluster_proto_init() { return nil } } - file_orderer_cluster_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_cluster_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StepResponse); i { case 0: return &v.state @@ -505,7 +505,7 @@ func file_orderer_cluster_proto_init() { return nil } } - file_orderer_cluster_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_orderer_cluster_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConsensusRequest); i { case 0: return &v.state @@ -517,7 +517,7 @@ func file_orderer_cluster_proto_init() { return nil } } - file_orderer_cluster_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_orderer_cluster_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SubmitRequest); i { case 0: return &v.state @@ -529,7 +529,7 @@ func file_orderer_cluster_proto_init() { return nil } } - file_orderer_cluster_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_orderer_cluster_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SubmitResponse); i { case 0: return &v.state @@ -542,11 +542,11 @@ func file_orderer_cluster_proto_init() { } } } - file_orderer_cluster_proto_msgTypes[0].OneofWrappers = []any{ + file_orderer_cluster_proto_msgTypes[0].OneofWrappers = []interface{}{ (*StepRequest_ConsensusRequest)(nil), (*StepRequest_SubmitRequest)(nil), } - file_orderer_cluster_proto_msgTypes[1].OneofWrappers = []any{ + file_orderer_cluster_proto_msgTypes[1].OneofWrappers = []interface{}{ (*StepResponse_SubmitRes)(nil), } type x struct{} diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster_grpc.pb.go index cef1af28bf5..1b62225dfe6 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/cluster_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: orderer/cluster.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Cluster_Step_FullMethodName = "/orderer.Cluster/Step" @@ -29,11 +29,9 @@ const ( // ClusterClient is the client API for Cluster service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Cluster defines communication between cluster members. type ClusterClient interface { // Step passes an implementation-specific message to another cluster member. - Step(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StepRequest, StepResponse], error) + Step(ctx context.Context, opts ...grpc.CallOption) (Cluster_StepClient, error) } type clusterClient struct { @@ -44,40 +42,52 @@ func NewClusterClient(cc grpc.ClientConnInterface) ClusterClient { return &clusterClient{cc} } -func (c *clusterClient) Step(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StepRequest, StepResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Cluster_ServiceDesc.Streams[0], Cluster_Step_FullMethodName, cOpts...) +func (c *clusterClient) Step(ctx context.Context, opts ...grpc.CallOption) (Cluster_StepClient, error) { + stream, err := c.cc.NewStream(ctx, &Cluster_ServiceDesc.Streams[0], Cluster_Step_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[StepRequest, StepResponse]{ClientStream: stream} + x := &clusterStepClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Cluster_StepClient = grpc.BidiStreamingClient[StepRequest, StepResponse] +type Cluster_StepClient interface { + Send(*StepRequest) error + Recv() (*StepResponse, error) + grpc.ClientStream +} + +type clusterStepClient struct { + grpc.ClientStream +} + +func (x *clusterStepClient) Send(m *StepRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *clusterStepClient) Recv() (*StepResponse, error) { + m := new(StepResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ClusterServer is the server API for Cluster service. // All implementations should embed UnimplementedClusterServer -// for forward compatibility. -// -// Cluster defines communication between cluster members. +// for forward compatibility type ClusterServer interface { // Step passes an implementation-specific message to another cluster member. - Step(grpc.BidiStreamingServer[StepRequest, StepResponse]) error + Step(Cluster_StepServer) error } -// UnimplementedClusterServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedClusterServer struct{} +// UnimplementedClusterServer should be embedded to have forward compatible implementations. +type UnimplementedClusterServer struct { +} -func (UnimplementedClusterServer) Step(grpc.BidiStreamingServer[StepRequest, StepResponse]) error { +func (UnimplementedClusterServer) Step(Cluster_StepServer) error { return status.Errorf(codes.Unimplemented, "method Step not implemented") } -func (UnimplementedClusterServer) testEmbeddedByValue() {} // UnsafeClusterServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ClusterServer will @@ -87,22 +97,34 @@ type UnsafeClusterServer interface { } func RegisterClusterServer(s grpc.ServiceRegistrar, srv ClusterServer) { - // If the following call pancis, it indicates UnimplementedClusterServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Cluster_ServiceDesc, srv) } func _Cluster_Step_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClusterServer).Step(&grpc.GenericServerStream[StepRequest, StepResponse]{ServerStream: stream}) + return srv.(ClusterServer).Step(&clusterStepServer{stream}) +} + +type Cluster_StepServer interface { + Send(*StepResponse) error + Recv() (*StepRequest, error) + grpc.ServerStream +} + +type clusterStepServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Cluster_StepServer = grpc.BidiStreamingServer[StepRequest, StepResponse] +func (x *clusterStepServer) Send(m *StepResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *clusterStepServer) Recv() (*StepRequest, error) { + m := new(StepRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // Cluster_ServiceDesc is the grpc.ServiceDesc for Cluster service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver.pb.go index eb75a832785..2f6ca13febb 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/clusterserver.proto @@ -592,7 +592,7 @@ func file_orderer_clusterserver_proto_rawDescGZIP() []byte { } var file_orderer_clusterserver_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_orderer_clusterserver_proto_goTypes = []any{ +var file_orderer_clusterserver_proto_goTypes = []interface{}{ (*ClusterNodeServiceStepRequest)(nil), // 0: orderer.ClusterNodeServiceStepRequest (*ClusterNodeServiceStepResponse)(nil), // 1: orderer.ClusterNodeServiceStepResponse (*NodeConsensusRequest)(nil), // 2: orderer.NodeConsensusRequest @@ -626,7 +626,7 @@ func file_orderer_clusterserver_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_clusterserver_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_clusterserver_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ClusterNodeServiceStepRequest); i { case 0: return &v.state @@ -638,7 +638,7 @@ func file_orderer_clusterserver_proto_init() { return nil } } - file_orderer_clusterserver_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_clusterserver_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ClusterNodeServiceStepResponse); i { case 0: return &v.state @@ -650,7 +650,7 @@ func file_orderer_clusterserver_proto_init() { return nil } } - file_orderer_clusterserver_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_orderer_clusterserver_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeConsensusRequest); i { case 0: return &v.state @@ -662,7 +662,7 @@ func file_orderer_clusterserver_proto_init() { return nil } } - file_orderer_clusterserver_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_orderer_clusterserver_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeTransactionOrderRequest); i { case 0: return &v.state @@ -674,7 +674,7 @@ func file_orderer_clusterserver_proto_init() { return nil } } - file_orderer_clusterserver_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_orderer_clusterserver_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TransactionOrderResponse); i { case 0: return &v.state @@ -686,7 +686,7 @@ func file_orderer_clusterserver_proto_init() { return nil } } - file_orderer_clusterserver_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_orderer_clusterserver_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NodeAuthRequest); i { case 0: return &v.state @@ -699,12 +699,12 @@ func file_orderer_clusterserver_proto_init() { } } } - file_orderer_clusterserver_proto_msgTypes[0].OneofWrappers = []any{ + file_orderer_clusterserver_proto_msgTypes[0].OneofWrappers = []interface{}{ (*ClusterNodeServiceStepRequest_NodeConrequest)(nil), (*ClusterNodeServiceStepRequest_NodeTranrequest)(nil), (*ClusterNodeServiceStepRequest_NodeAuthrequest)(nil), } - file_orderer_clusterserver_proto_msgTypes[1].OneofWrappers = []any{ + file_orderer_clusterserver_proto_msgTypes[1].OneofWrappers = []interface{}{ (*ClusterNodeServiceStepResponse_TranorderRes)(nil), } type x struct{} diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver_grpc.pb.go index bb2ac2e3010..d4c8fa58644 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/clusterserver_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: orderer/clusterserver.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( ClusterNodeService_Step_FullMethodName = "/orderer.ClusterNodeService/Step" @@ -29,11 +29,9 @@ const ( // ClusterNodeServiceClient is the client API for ClusterNodeService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Service ClusterNodeService defines communication between cluster members. type ClusterNodeServiceClient interface { // Step passes an implementation-specific message to another cluster member. - Step(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse], error) + Step(ctx context.Context, opts ...grpc.CallOption) (ClusterNodeService_StepClient, error) } type clusterNodeServiceClient struct { @@ -44,40 +42,52 @@ func NewClusterNodeServiceClient(cc grpc.ClientConnInterface) ClusterNodeService return &clusterNodeServiceClient{cc} } -func (c *clusterNodeServiceClient) Step(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &ClusterNodeService_ServiceDesc.Streams[0], ClusterNodeService_Step_FullMethodName, cOpts...) +func (c *clusterNodeServiceClient) Step(ctx context.Context, opts ...grpc.CallOption) (ClusterNodeService_StepClient, error) { + stream, err := c.cc.NewStream(ctx, &ClusterNodeService_ServiceDesc.Streams[0], ClusterNodeService_Step_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse]{ClientStream: stream} + x := &clusterNodeServiceStepClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ClusterNodeService_StepClient = grpc.BidiStreamingClient[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse] +type ClusterNodeService_StepClient interface { + Send(*ClusterNodeServiceStepRequest) error + Recv() (*ClusterNodeServiceStepResponse, error) + grpc.ClientStream +} + +type clusterNodeServiceStepClient struct { + grpc.ClientStream +} + +func (x *clusterNodeServiceStepClient) Send(m *ClusterNodeServiceStepRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *clusterNodeServiceStepClient) Recv() (*ClusterNodeServiceStepResponse, error) { + m := new(ClusterNodeServiceStepResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ClusterNodeServiceServer is the server API for ClusterNodeService service. // All implementations should embed UnimplementedClusterNodeServiceServer -// for forward compatibility. -// -// Service ClusterNodeService defines communication between cluster members. +// for forward compatibility type ClusterNodeServiceServer interface { // Step passes an implementation-specific message to another cluster member. - Step(grpc.BidiStreamingServer[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse]) error + Step(ClusterNodeService_StepServer) error } -// UnimplementedClusterNodeServiceServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedClusterNodeServiceServer struct{} +// UnimplementedClusterNodeServiceServer should be embedded to have forward compatible implementations. +type UnimplementedClusterNodeServiceServer struct { +} -func (UnimplementedClusterNodeServiceServer) Step(grpc.BidiStreamingServer[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse]) error { +func (UnimplementedClusterNodeServiceServer) Step(ClusterNodeService_StepServer) error { return status.Errorf(codes.Unimplemented, "method Step not implemented") } -func (UnimplementedClusterNodeServiceServer) testEmbeddedByValue() {} // UnsafeClusterNodeServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ClusterNodeServiceServer will @@ -87,22 +97,34 @@ type UnsafeClusterNodeServiceServer interface { } func RegisterClusterNodeServiceServer(s grpc.ServiceRegistrar, srv ClusterNodeServiceServer) { - // If the following call pancis, it indicates UnimplementedClusterNodeServiceServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&ClusterNodeService_ServiceDesc, srv) } func _ClusterNodeService_Step_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ClusterNodeServiceServer).Step(&grpc.GenericServerStream[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse]{ServerStream: stream}) + return srv.(ClusterNodeServiceServer).Step(&clusterNodeServiceStepServer{stream}) +} + +type ClusterNodeService_StepServer interface { + Send(*ClusterNodeServiceStepResponse) error + Recv() (*ClusterNodeServiceStepRequest, error) + grpc.ServerStream +} + +type clusterNodeServiceStepServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ClusterNodeService_StepServer = grpc.BidiStreamingServer[ClusterNodeServiceStepRequest, ClusterNodeServiceStepResponse] +func (x *clusterNodeServiceStepServer) Send(m *ClusterNodeServiceStepResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *clusterNodeServiceStepServer) Recv() (*ClusterNodeServiceStepRequest, error) { + m := new(ClusterNodeServiceStepRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ClusterNodeService_ServiceDesc is the grpc.ServiceDesc for ClusterNodeService service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/configuration.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/configuration.pb.go index f35e688c9ca..060718e6b3d 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/configuration.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/configuration.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/configuration.proto @@ -420,7 +420,7 @@ func file_orderer_configuration_proto_rawDescGZIP() []byte { var file_orderer_configuration_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_orderer_configuration_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_orderer_configuration_proto_goTypes = []any{ +var file_orderer_configuration_proto_goTypes = []interface{}{ (ConsensusType_State)(0), // 0: orderer.ConsensusType.State (*ConsensusType)(nil), // 1: orderer.ConsensusType (*BatchSize)(nil), // 2: orderer.BatchSize @@ -443,7 +443,7 @@ func file_orderer_configuration_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_configuration_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_configuration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConsensusType); i { case 0: return &v.state @@ -455,7 +455,7 @@ func file_orderer_configuration_proto_init() { return nil } } - file_orderer_configuration_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_configuration_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BatchSize); i { case 0: return &v.state @@ -467,7 +467,7 @@ func file_orderer_configuration_proto_init() { return nil } } - file_orderer_configuration_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_orderer_configuration_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BatchTimeout); i { case 0: return &v.state @@ -479,7 +479,7 @@ func file_orderer_configuration_proto_init() { return nil } } - file_orderer_configuration_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_orderer_configuration_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*KafkaBrokers); i { case 0: return &v.state @@ -491,7 +491,7 @@ func file_orderer_configuration_proto_init() { return nil } } - file_orderer_configuration_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_orderer_configuration_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChannelRestrictions); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/configuration.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/configuration.pb.go index c64f3d4e03f..98d567d313c 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/configuration.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/configuration.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/etcdraft/configuration.proto @@ -299,7 +299,7 @@ func file_orderer_etcdraft_configuration_proto_rawDescGZIP() []byte { } var file_orderer_etcdraft_configuration_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_orderer_etcdraft_configuration_proto_goTypes = []any{ +var file_orderer_etcdraft_configuration_proto_goTypes = []interface{}{ (*ConfigMetadata)(nil), // 0: etcdraft.ConfigMetadata (*Consenter)(nil), // 1: etcdraft.Consenter (*Options)(nil), // 2: etcdraft.Options @@ -320,7 +320,7 @@ func file_orderer_etcdraft_configuration_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_etcdraft_configuration_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_etcdraft_configuration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigMetadata); i { case 0: return &v.state @@ -332,7 +332,7 @@ func file_orderer_etcdraft_configuration_proto_init() { return nil } } - file_orderer_etcdraft_configuration_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_etcdraft_configuration_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Consenter); i { case 0: return &v.state @@ -344,7 +344,7 @@ func file_orderer_etcdraft_configuration_proto_init() { return nil } } - file_orderer_etcdraft_configuration_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_orderer_etcdraft_configuration_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Options); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/metadata.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/metadata.pb.go index 75dc9ba6986..3087ac0c5e7 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/metadata.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft/metadata.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/etcdraft/metadata.proto @@ -189,7 +189,7 @@ func file_orderer_etcdraft_metadata_proto_rawDescGZIP() []byte { } var file_orderer_etcdraft_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_orderer_etcdraft_metadata_proto_goTypes = []any{ +var file_orderer_etcdraft_metadata_proto_goTypes = []interface{}{ (*BlockMetadata)(nil), // 0: etcdraft.BlockMetadata (*ClusterMetadata)(nil), // 1: etcdraft.ClusterMetadata } @@ -207,7 +207,7 @@ func file_orderer_etcdraft_metadata_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_etcdraft_metadata_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_etcdraft_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockMetadata); i { case 0: return &v.state @@ -219,7 +219,7 @@ func file_orderer_etcdraft_metadata_proto_init() { return nil } } - file_orderer_etcdraft_metadata_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_orderer_etcdraft_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ClusterMetadata); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/smartbft/configuration.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/smartbft/configuration.pb.go index 1f6d0b94281..1ed8b1bfebf 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/smartbft/configuration.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/orderer/smartbft/configuration.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: orderer/smartbft/configuration.proto @@ -362,7 +362,7 @@ func file_orderer_smartbft_configuration_proto_rawDescGZIP() []byte { var file_orderer_smartbft_configuration_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_orderer_smartbft_configuration_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_orderer_smartbft_configuration_proto_goTypes = []any{ +var file_orderer_smartbft_configuration_proto_goTypes = []interface{}{ (Options_Rotation)(0), // 0: orderer.smartbft.Options.Rotation (*Options)(nil), // 1: orderer.smartbft.Options } @@ -381,7 +381,7 @@ func file_orderer_smartbft_configuration_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_orderer_smartbft_configuration_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_orderer_smartbft_configuration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Options); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode.pb.go index 80ec7aab1c4..c4a28b74455 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/chaincode.proto @@ -623,6 +623,62 @@ func (x *ChaincodeData) GetInstantiationPolicy() *common.SignaturePolicyEnvelope return nil } +// ChaincodeAdditionalParams - parameters passed to chaincode to notify about peer capabilities +type ChaincodeAdditionalParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UsePutStateBatch bool `protobuf:"varint,1,opt,name=use_put_state_batch,json=usePutStateBatch,proto3" json:"use_put_state_batch,omitempty"` // an indication that the peer can handle state change batches + MaxSizePutStateBatch uint32 `protobuf:"varint,2,opt,name=max_size_put_state_batch,json=maxSizePutStateBatch,proto3" json:"max_size_put_state_batch,omitempty"` // maximum size of batches with changed state +} + +func (x *ChaincodeAdditionalParams) Reset() { + *x = ChaincodeAdditionalParams{} + if protoimpl.UnsafeEnabled { + mi := &file_peer_chaincode_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChaincodeAdditionalParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChaincodeAdditionalParams) ProtoMessage() {} + +func (x *ChaincodeAdditionalParams) ProtoReflect() protoreflect.Message { + mi := &file_peer_chaincode_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChaincodeAdditionalParams.ProtoReflect.Descriptor instead. +func (*ChaincodeAdditionalParams) Descriptor() ([]byte, []int) { + return file_peer_chaincode_proto_rawDescGZIP(), []int{8} +} + +func (x *ChaincodeAdditionalParams) GetUsePutStateBatch() bool { + if x != nil { + return x.UsePutStateBatch + } + return false +} + +func (x *ChaincodeAdditionalParams) GetMaxSizePutStateBatch() uint32 { + if x != nil { + return x.MaxSizePutStateBatch + } + return 0 +} + var File_peer_chaincode_proto protoreflect.FileDescriptor var file_peer_chaincode_proto_rawDesc = []byte{ @@ -705,18 +761,26 @@ var file_peer_chaincode_proto_rawDesc = []byte{ 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x52, 0x13, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x42, 0xa0, 0x01, - 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, - 0x72, 0x2e, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, - 0x70, 0x65, 0x65, 0x72, 0x42, 0x0e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, - 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2d, 0x67, 0x6f, 0x2d, - 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x70, 0x65, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, - 0xaa, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x73, 0xe2, 0x02, 0x12, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0x82, 0x01, + 0x0a, 0x19, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x41, 0x64, 0x64, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2d, 0x0a, 0x13, 0x75, + 0x73, 0x65, 0x5f, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x75, 0x73, 0x65, 0x50, 0x75, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x36, 0x0a, 0x18, 0x6d, 0x61, + 0x78, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, + 0x5f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x6d, 0x61, + 0x78, 0x53, 0x69, 0x7a, 0x65, 0x50, 0x75, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x42, 0xa0, 0x01, 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, + 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2e, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x42, 0x0e, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x63, 0x6f, 0x64, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, + 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2d, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x70, 0x65, 0x65, 0x72, 0xa2, + 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x02, + 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xe2, 0x02, 0x12, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -732,8 +796,8 @@ func file_peer_chaincode_proto_rawDescGZIP() []byte { } var file_peer_chaincode_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_peer_chaincode_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_peer_chaincode_proto_goTypes = []any{ +var file_peer_chaincode_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_peer_chaincode_proto_goTypes = []interface{}{ (ChaincodeSpec_Type)(0), // 0: protos.ChaincodeSpec.Type (*ChaincodeID)(nil), // 1: protos.ChaincodeID (*ChaincodeInput)(nil), // 2: protos.ChaincodeInput @@ -743,18 +807,19 @@ var file_peer_chaincode_proto_goTypes = []any{ (*LifecycleEvent)(nil), // 6: protos.LifecycleEvent (*CDSData)(nil), // 7: protos.CDSData (*ChaincodeData)(nil), // 8: protos.ChaincodeData - nil, // 9: protos.ChaincodeInput.DecorationsEntry - (*common.SignaturePolicyEnvelope)(nil), // 10: common.SignaturePolicyEnvelope + (*ChaincodeAdditionalParams)(nil), // 9: protos.ChaincodeAdditionalParams + nil, // 10: protos.ChaincodeInput.DecorationsEntry + (*common.SignaturePolicyEnvelope)(nil), // 11: common.SignaturePolicyEnvelope } var file_peer_chaincode_proto_depIdxs = []int32{ - 9, // 0: protos.ChaincodeInput.decorations:type_name -> protos.ChaincodeInput.DecorationsEntry + 10, // 0: protos.ChaincodeInput.decorations:type_name -> protos.ChaincodeInput.DecorationsEntry 0, // 1: protos.ChaincodeSpec.type:type_name -> protos.ChaincodeSpec.Type 1, // 2: protos.ChaincodeSpec.chaincode_id:type_name -> protos.ChaincodeID 2, // 3: protos.ChaincodeSpec.input:type_name -> protos.ChaincodeInput 3, // 4: protos.ChaincodeDeploymentSpec.chaincode_spec:type_name -> protos.ChaincodeSpec 3, // 5: protos.ChaincodeInvocationSpec.chaincode_spec:type_name -> protos.ChaincodeSpec - 10, // 6: protos.ChaincodeData.policy:type_name -> common.SignaturePolicyEnvelope - 10, // 7: protos.ChaincodeData.instantiation_policy:type_name -> common.SignaturePolicyEnvelope + 11, // 6: protos.ChaincodeData.policy:type_name -> common.SignaturePolicyEnvelope + 11, // 7: protos.ChaincodeData.instantiation_policy:type_name -> common.SignaturePolicyEnvelope 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name @@ -768,7 +833,7 @@ func file_peer_chaincode_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_chaincode_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeID); i { case 0: return &v.state @@ -780,7 +845,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeInput); i { case 0: return &v.state @@ -792,7 +857,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeSpec); i { case 0: return &v.state @@ -804,7 +869,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeDeploymentSpec); i { case 0: return &v.state @@ -816,7 +881,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeInvocationSpec); i { case 0: return &v.state @@ -828,7 +893,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LifecycleEvent); i { case 0: return &v.state @@ -840,7 +905,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CDSData); i { case 0: return &v.state @@ -852,7 +917,7 @@ func file_peer_chaincode_proto_init() { return nil } } - file_peer_chaincode_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_peer_chaincode_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeData); i { case 0: return &v.state @@ -864,6 +929,18 @@ func file_peer_chaincode_proto_init() { return nil } } + file_peer_chaincode_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChaincodeAdditionalParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -871,7 +948,7 @@ func file_peer_chaincode_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_peer_chaincode_proto_rawDesc, NumEnums: 1, - NumMessages: 9, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_event.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_event.pb.go index 0eb0d03ff78..6e9e3c24456 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_event.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_event.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/chaincode_event.proto @@ -137,7 +137,7 @@ func file_peer_chaincode_event_proto_rawDescGZIP() []byte { } var file_peer_chaincode_event_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_peer_chaincode_event_proto_goTypes = []any{ +var file_peer_chaincode_event_proto_goTypes = []interface{}{ (*ChaincodeEvent)(nil), // 0: protos.ChaincodeEvent } var file_peer_chaincode_event_proto_depIdxs = []int32{ @@ -154,7 +154,7 @@ func file_peer_chaincode_event_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_chaincode_event_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_chaincode_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeEvent); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim.pb.go index 17cdac21dfe..d4dbc57a719 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/chaincode_shim.proto @@ -51,6 +51,7 @@ const ( ChaincodeMessage_PUT_STATE_METADATA ChaincodeMessage_Type = 21 ChaincodeMessage_GET_PRIVATE_DATA_HASH ChaincodeMessage_Type = 22 ChaincodeMessage_PURGE_PRIVATE_DATA ChaincodeMessage_Type = 23 + ChaincodeMessage_CHANGE_STATE_BATCH ChaincodeMessage_Type = 24 ) // Enum value maps for ChaincodeMessage_Type. @@ -79,6 +80,7 @@ var ( 21: "PUT_STATE_METADATA", 22: "GET_PRIVATE_DATA_HASH", 23: "PURGE_PRIVATE_DATA", + 24: "CHANGE_STATE_BATCH", } ChaincodeMessage_Type_value = map[string]int32{ "UNDEFINED": 0, @@ -104,6 +106,7 @@ var ( "PUT_STATE_METADATA": 21, "GET_PRIVATE_DATA_HASH": 22, "PURGE_PRIVATE_DATA": 23, + "CHANGE_STATE_BATCH": 24, } ) @@ -134,6 +137,61 @@ func (ChaincodeMessage_Type) EnumDescriptor() ([]byte, []int) { return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{0, 0} } +type StateKV_Type int32 + +const ( + StateKV_UNDEFINED StateKV_Type = 0 + StateKV_PUT_STATE StateKV_Type = 9 + StateKV_DEL_STATE StateKV_Type = 10 + StateKV_PUT_STATE_METADATA StateKV_Type = 21 + StateKV_PURGE_PRIVATE_DATA StateKV_Type = 23 +) + +// Enum value maps for StateKV_Type. +var ( + StateKV_Type_name = map[int32]string{ + 0: "UNDEFINED", + 9: "PUT_STATE", + 10: "DEL_STATE", + 21: "PUT_STATE_METADATA", + 23: "PURGE_PRIVATE_DATA", + } + StateKV_Type_value = map[string]int32{ + "UNDEFINED": 0, + "PUT_STATE": 9, + "DEL_STATE": 10, + "PUT_STATE_METADATA": 21, + "PURGE_PRIVATE_DATA": 23, + } +) + +func (x StateKV_Type) Enum() *StateKV_Type { + p := new(StateKV_Type) + *p = x + return p +} + +func (x StateKV_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StateKV_Type) Descriptor() protoreflect.EnumDescriptor { + return file_peer_chaincode_shim_proto_enumTypes[1].Descriptor() +} + +func (StateKV_Type) Type() protoreflect.EnumType { + return &file_peer_chaincode_shim_proto_enumTypes[1] +} + +func (x StateKV_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StateKV_Type.Descriptor instead. +func (StateKV_Type) EnumDescriptor() ([]byte, []int) { + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{6, 0} +} + type ChaincodeMessage struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -476,6 +534,132 @@ func (x *PutStateMetadata) GetMetadata() *StateMetadata { return nil } +type ChangeStateBatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Kvs []*StateKV `protobuf:"bytes,1,rep,name=kvs,proto3" json:"kvs,omitempty"` +} + +func (x *ChangeStateBatch) Reset() { + *x = ChangeStateBatch{} + if protoimpl.UnsafeEnabled { + mi := &file_peer_chaincode_shim_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChangeStateBatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChangeStateBatch) ProtoMessage() {} + +func (x *ChangeStateBatch) ProtoReflect() protoreflect.Message { + mi := &file_peer_chaincode_shim_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChangeStateBatch.ProtoReflect.Descriptor instead. +func (*ChangeStateBatch) Descriptor() ([]byte, []int) { + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{5} +} + +func (x *ChangeStateBatch) GetKvs() []*StateKV { + if x != nil { + return x.Kvs + } + return nil +} + +type StateKV struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Collection string `protobuf:"bytes,3,opt,name=collection,proto3" json:"collection,omitempty"` + Metadata *StateMetadata `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + Type StateKV_Type `protobuf:"varint,5,opt,name=type,proto3,enum=protos.StateKV_Type" json:"type,omitempty"` +} + +func (x *StateKV) Reset() { + *x = StateKV{} + if protoimpl.UnsafeEnabled { + mi := &file_peer_chaincode_shim_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StateKV) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StateKV) ProtoMessage() {} + +func (x *StateKV) ProtoReflect() protoreflect.Message { + mi := &file_peer_chaincode_shim_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StateKV.ProtoReflect.Descriptor instead. +func (*StateKV) Descriptor() ([]byte, []int) { + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{6} +} + +func (x *StateKV) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *StateKV) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *StateKV) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *StateKV) GetMetadata() *StateMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *StateKV) GetType() StateKV_Type { + if x != nil { + return x.Type + } + return StateKV_UNDEFINED +} + // DelState is the payload of a ChaincodeMessage. It contains a key which // needs to be recorded in the transaction's write set as a delete operation. // If the collection is specified, the key needs to be recorded in the @@ -492,7 +676,7 @@ type DelState struct { func (x *DelState) Reset() { *x = DelState{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[5] + mi := &file_peer_chaincode_shim_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -505,7 +689,7 @@ func (x *DelState) String() string { func (*DelState) ProtoMessage() {} func (x *DelState) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[5] + mi := &file_peer_chaincode_shim_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -518,7 +702,7 @@ func (x *DelState) ProtoReflect() protoreflect.Message { // Deprecated: Use DelState.ProtoReflect.Descriptor instead. func (*DelState) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{5} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{7} } func (x *DelState) GetKey() string { @@ -547,7 +731,7 @@ type PurgePrivateState struct { func (x *PurgePrivateState) Reset() { *x = PurgePrivateState{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[6] + mi := &file_peer_chaincode_shim_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -560,7 +744,7 @@ func (x *PurgePrivateState) String() string { func (*PurgePrivateState) ProtoMessage() {} func (x *PurgePrivateState) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[6] + mi := &file_peer_chaincode_shim_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -573,7 +757,7 @@ func (x *PurgePrivateState) ProtoReflect() protoreflect.Message { // Deprecated: Use PurgePrivateState.ProtoReflect.Descriptor instead. func (*PurgePrivateState) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{6} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{8} } func (x *PurgePrivateState) GetKey() string { @@ -608,7 +792,7 @@ type GetStateByRange struct { func (x *GetStateByRange) Reset() { *x = GetStateByRange{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[7] + mi := &file_peer_chaincode_shim_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -621,7 +805,7 @@ func (x *GetStateByRange) String() string { func (*GetStateByRange) ProtoMessage() {} func (x *GetStateByRange) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[7] + mi := &file_peer_chaincode_shim_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -634,7 +818,7 @@ func (x *GetStateByRange) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStateByRange.ProtoReflect.Descriptor instead. func (*GetStateByRange) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{7} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{9} } func (x *GetStateByRange) GetStartKey() string { @@ -682,7 +866,7 @@ type GetQueryResult struct { func (x *GetQueryResult) Reset() { *x = GetQueryResult{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[8] + mi := &file_peer_chaincode_shim_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -695,7 +879,7 @@ func (x *GetQueryResult) String() string { func (*GetQueryResult) ProtoMessage() {} func (x *GetQueryResult) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[8] + mi := &file_peer_chaincode_shim_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -708,7 +892,7 @@ func (x *GetQueryResult) ProtoReflect() protoreflect.Message { // Deprecated: Use GetQueryResult.ProtoReflect.Descriptor instead. func (*GetQueryResult) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{8} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{10} } func (x *GetQueryResult) GetQuery() string { @@ -747,7 +931,7 @@ type QueryMetadata struct { func (x *QueryMetadata) Reset() { *x = QueryMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[9] + mi := &file_peer_chaincode_shim_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -760,7 +944,7 @@ func (x *QueryMetadata) String() string { func (*QueryMetadata) ProtoMessage() {} func (x *QueryMetadata) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[9] + mi := &file_peer_chaincode_shim_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -773,7 +957,7 @@ func (x *QueryMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryMetadata.ProtoReflect.Descriptor instead. func (*QueryMetadata) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{9} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{11} } func (x *QueryMetadata) GetPageSize() int32 { @@ -803,7 +987,7 @@ type GetHistoryForKey struct { func (x *GetHistoryForKey) Reset() { *x = GetHistoryForKey{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[10] + mi := &file_peer_chaincode_shim_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -816,7 +1000,7 @@ func (x *GetHistoryForKey) String() string { func (*GetHistoryForKey) ProtoMessage() {} func (x *GetHistoryForKey) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[10] + mi := &file_peer_chaincode_shim_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -829,7 +1013,7 @@ func (x *GetHistoryForKey) ProtoReflect() protoreflect.Message { // Deprecated: Use GetHistoryForKey.ProtoReflect.Descriptor instead. func (*GetHistoryForKey) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{10} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{12} } func (x *GetHistoryForKey) GetKey() string { @@ -850,7 +1034,7 @@ type QueryStateNext struct { func (x *QueryStateNext) Reset() { *x = QueryStateNext{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[11] + mi := &file_peer_chaincode_shim_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -863,7 +1047,7 @@ func (x *QueryStateNext) String() string { func (*QueryStateNext) ProtoMessage() {} func (x *QueryStateNext) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[11] + mi := &file_peer_chaincode_shim_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -876,7 +1060,7 @@ func (x *QueryStateNext) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryStateNext.ProtoReflect.Descriptor instead. func (*QueryStateNext) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{11} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{13} } func (x *QueryStateNext) GetId() string { @@ -897,7 +1081,7 @@ type QueryStateClose struct { func (x *QueryStateClose) Reset() { *x = QueryStateClose{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[12] + mi := &file_peer_chaincode_shim_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -910,7 +1094,7 @@ func (x *QueryStateClose) String() string { func (*QueryStateClose) ProtoMessage() {} func (x *QueryStateClose) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[12] + mi := &file_peer_chaincode_shim_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -923,7 +1107,7 @@ func (x *QueryStateClose) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryStateClose.ProtoReflect.Descriptor instead. func (*QueryStateClose) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{12} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{14} } func (x *QueryStateClose) GetId() string { @@ -945,7 +1129,7 @@ type QueryResultBytes struct { func (x *QueryResultBytes) Reset() { *x = QueryResultBytes{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[13] + mi := &file_peer_chaincode_shim_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -958,7 +1142,7 @@ func (x *QueryResultBytes) String() string { func (*QueryResultBytes) ProtoMessage() {} func (x *QueryResultBytes) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[13] + mi := &file_peer_chaincode_shim_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -971,7 +1155,7 @@ func (x *QueryResultBytes) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryResultBytes.ProtoReflect.Descriptor instead. func (*QueryResultBytes) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{13} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{15} } func (x *QueryResultBytes) GetResultBytes() []byte { @@ -1000,7 +1184,7 @@ type QueryResponse struct { func (x *QueryResponse) Reset() { *x = QueryResponse{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[14] + mi := &file_peer_chaincode_shim_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1013,7 +1197,7 @@ func (x *QueryResponse) String() string { func (*QueryResponse) ProtoMessage() {} func (x *QueryResponse) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[14] + mi := &file_peer_chaincode_shim_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1026,7 +1210,7 @@ func (x *QueryResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead. func (*QueryResponse) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{14} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{16} } func (x *QueryResponse) GetResults() []*QueryResultBytes { @@ -1071,7 +1255,7 @@ type QueryResponseMetadata struct { func (x *QueryResponseMetadata) Reset() { *x = QueryResponseMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[15] + mi := &file_peer_chaincode_shim_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1084,7 +1268,7 @@ func (x *QueryResponseMetadata) String() string { func (*QueryResponseMetadata) ProtoMessage() {} func (x *QueryResponseMetadata) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[15] + mi := &file_peer_chaincode_shim_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1097,7 +1281,7 @@ func (x *QueryResponseMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use QueryResponseMetadata.ProtoReflect.Descriptor instead. func (*QueryResponseMetadata) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{15} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{17} } func (x *QueryResponseMetadata) GetFetchedRecordsCount() int32 { @@ -1126,7 +1310,7 @@ type StateMetadata struct { func (x *StateMetadata) Reset() { *x = StateMetadata{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[16] + mi := &file_peer_chaincode_shim_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1139,7 +1323,7 @@ func (x *StateMetadata) String() string { func (*StateMetadata) ProtoMessage() {} func (x *StateMetadata) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[16] + mi := &file_peer_chaincode_shim_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1152,7 +1336,7 @@ func (x *StateMetadata) ProtoReflect() protoreflect.Message { // Deprecated: Use StateMetadata.ProtoReflect.Descriptor instead. func (*StateMetadata) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{16} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{18} } func (x *StateMetadata) GetMetakey() string { @@ -1180,7 +1364,7 @@ type StateMetadataResult struct { func (x *StateMetadataResult) Reset() { *x = StateMetadataResult{} if protoimpl.UnsafeEnabled { - mi := &file_peer_chaincode_shim_proto_msgTypes[17] + mi := &file_peer_chaincode_shim_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1193,7 +1377,7 @@ func (x *StateMetadataResult) String() string { func (*StateMetadataResult) ProtoMessage() {} func (x *StateMetadataResult) ProtoReflect() protoreflect.Message { - mi := &file_peer_chaincode_shim_proto_msgTypes[17] + mi := &file_peer_chaincode_shim_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1206,7 +1390,7 @@ func (x *StateMetadataResult) ProtoReflect() protoreflect.Message { // Deprecated: Use StateMetadataResult.ProtoReflect.Descriptor instead. func (*StateMetadataResult) Descriptor() ([]byte, []int) { - return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{17} + return file_peer_chaincode_shim_proto_rawDescGZIP(), []int{19} } func (x *StateMetadataResult) GetEntries() []*StateMetadata { @@ -1226,7 +1410,7 @@ var file_peer_chaincode_shim_proto_rawDesc = []byte{ 0x13, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee, 0x05, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x86, 0x06, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, @@ -1246,7 +1430,7 @@ var file_peer_chaincode_shim_proto_rawDesc = []byte{ 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x0e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0xaa, 0x03, 0x0a, 0x04, 0x54, 0x79, + 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0xc2, 0x03, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x45, 0x52, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x45, 0x52, 0x45, 0x44, 0x10, 0x02, 0x12, @@ -1273,111 +1457,133 @@ var file_peer_chaincode_shim_proto_rawDesc = []byte{ 0x41, 0x10, 0x15, 0x12, 0x19, 0x0a, 0x15, 0x47, 0x45, 0x54, 0x5f, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x48, 0x41, 0x53, 0x48, 0x10, 0x16, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x55, 0x52, 0x47, 0x45, 0x5f, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x5f, - 0x44, 0x41, 0x54, 0x41, 0x10, 0x17, 0x22, 0x3c, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x44, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x52, 0x0a, 0x08, 0x50, 0x75, - 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, - 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x77, - 0x0a, 0x10, 0x50, 0x75, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3c, 0x0a, 0x08, 0x44, 0x65, 0x6c, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x11, 0x50, 0x75, 0x72, 0x67, 0x65, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x44, 0x41, 0x54, 0x41, 0x10, 0x17, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, + 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x42, 0x41, 0x54, 0x43, 0x48, 0x10, 0x18, 0x22, 0x3c, + 0x0a, 0x08, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x81, 0x01, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x79, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, - 0x65, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, - 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x44, 0x0a, 0x10, + 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x22, 0x52, 0x0a, 0x08, 0x50, 0x75, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x77, 0x0a, 0x10, 0x50, 0x75, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, + 0x35, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x12, 0x21, 0x0a, 0x03, 0x6b, 0x76, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4b, + 0x56, 0x52, 0x03, 0x6b, 0x76, 0x73, 0x22, 0x93, 0x02, 0x0a, 0x07, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x4b, 0x56, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x08, 0x6d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4b, 0x56, 0x2e, 0x54, 0x79, 0x70, + 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x63, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, + 0x0a, 0x09, 0x50, 0x55, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0x09, 0x12, 0x0d, 0x0a, + 0x09, 0x44, 0x45, 0x4c, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0x0a, 0x12, 0x16, 0x0a, 0x12, + 0x50, 0x55, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x4d, 0x45, 0x54, 0x41, 0x44, 0x41, + 0x54, 0x41, 0x10, 0x15, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x55, 0x52, 0x47, 0x45, 0x5f, 0x50, 0x52, + 0x49, 0x56, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x17, 0x22, 0x3c, 0x0a, 0x08, + 0x44, 0x65, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x11, 0x50, 0x75, + 0x72, 0x67, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x81, 0x01, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x79, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x4b, 0x65, + 0x79, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x65, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, + 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x62, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x47, 0x0a, 0x0d, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, + 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, + 0x72, 0x6b, 0x22, 0x24, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, + 0x46, 0x6f, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x20, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x78, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x21, 0x0a, 0x0f, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x34, 0x0a, + 0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, + 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, + 0x74, 0x65, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, + 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, + 0x5f, 0x6d, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, + 0x4d, 0x6f, 0x72, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x22, 0x62, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, - 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x47, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, - 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x24, 0x0a, - 0x10, 0x47, 0x65, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x46, 0x6f, 0x72, 0x4b, 0x65, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x22, 0x20, 0x0a, 0x0e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x4e, 0x65, 0x78, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x21, 0x0a, 0x0f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x34, 0x0a, 0x10, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x8a, - 0x01, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x32, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x07, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x68, 0x61, 0x73, 0x5f, 0x6d, 0x6f, 0x72, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x61, 0x73, 0x4d, 0x6f, 0x72, 0x65, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x67, 0x0a, 0x15, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x15, 0x66, 0x65, 0x74, 0x63, 0x68, 0x65, 0x64, 0x5f, - 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x13, 0x66, 0x65, 0x74, 0x63, 0x68, 0x65, 0x64, 0x52, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6f, 0x6f, 0x6b, - 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6f, 0x6f, 0x6b, - 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x3f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x61, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x61, 0x6b, 0x65, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x46, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x2f, 0x0a, 0x07, - 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x32, 0x56, 0x0a, - 0x10, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x42, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, 0x4e, 0x0a, 0x09, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, - 0x64, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x18, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0xa4, 0x01, 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x68, 0x79, - 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2e, 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x42, 0x12, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x68, 0x69, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, - 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x66, 0x61, 0x62, 0x72, 0x69, - 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2d, 0x67, 0x6f, 0x2d, 0x61, 0x70, 0x69, 0x76, - 0x32, 0x2f, 0x70, 0x65, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xe2, 0x02, - 0x12, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x22, 0x67, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x32, 0x0a, 0x15, 0x66, 0x65, 0x74, + 0x63, 0x68, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x66, 0x65, 0x74, 0x63, 0x68, 0x65, + 0x64, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, + 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x62, 0x6f, 0x6f, 0x6b, 0x6d, 0x61, 0x72, 0x6b, 0x22, 0x3f, 0x0a, 0x0d, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, + 0x74, 0x61, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x74, + 0x61, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x46, 0x0a, 0x13, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x12, 0x2f, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, + 0x65, 0x73, 0x32, 0x56, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x53, + 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x42, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, + 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x32, 0x4e, 0x0a, 0x09, 0x43, 0x68, + 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, + 0x63, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, + 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x18, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0xa4, 0x01, 0x0a, 0x22, 0x6f, + 0x72, 0x67, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2e, 0x66, + 0x61, 0x62, 0x72, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x70, 0x65, 0x65, + 0x72, 0x42, 0x12, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x68, 0x69, 0x6d, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, + 0x66, 0x61, 0x62, 0x72, 0x69, 0x63, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2d, 0x67, 0x6f, + 0x2d, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x70, 0x65, 0x65, 0x72, 0xa2, 0x02, 0x03, 0x50, 0x58, + 0x58, 0xaa, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0xca, 0x02, 0x06, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x73, 0xe2, 0x02, 0x12, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x06, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1392,49 +1598,55 @@ func file_peer_chaincode_shim_proto_rawDescGZIP() []byte { return file_peer_chaincode_shim_proto_rawDescData } -var file_peer_chaincode_shim_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_peer_chaincode_shim_proto_msgTypes = make([]protoimpl.MessageInfo, 18) -var file_peer_chaincode_shim_proto_goTypes = []any{ +var file_peer_chaincode_shim_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_peer_chaincode_shim_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_peer_chaincode_shim_proto_goTypes = []interface{}{ (ChaincodeMessage_Type)(0), // 0: protos.ChaincodeMessage.Type - (*ChaincodeMessage)(nil), // 1: protos.ChaincodeMessage - (*GetState)(nil), // 2: protos.GetState - (*GetStateMetadata)(nil), // 3: protos.GetStateMetadata - (*PutState)(nil), // 4: protos.PutState - (*PutStateMetadata)(nil), // 5: protos.PutStateMetadata - (*DelState)(nil), // 6: protos.DelState - (*PurgePrivateState)(nil), // 7: protos.PurgePrivateState - (*GetStateByRange)(nil), // 8: protos.GetStateByRange - (*GetQueryResult)(nil), // 9: protos.GetQueryResult - (*QueryMetadata)(nil), // 10: protos.QueryMetadata - (*GetHistoryForKey)(nil), // 11: protos.GetHistoryForKey - (*QueryStateNext)(nil), // 12: protos.QueryStateNext - (*QueryStateClose)(nil), // 13: protos.QueryStateClose - (*QueryResultBytes)(nil), // 14: protos.QueryResultBytes - (*QueryResponse)(nil), // 15: protos.QueryResponse - (*QueryResponseMetadata)(nil), // 16: protos.QueryResponseMetadata - (*StateMetadata)(nil), // 17: protos.StateMetadata - (*StateMetadataResult)(nil), // 18: protos.StateMetadataResult - (*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp - (*SignedProposal)(nil), // 20: protos.SignedProposal - (*ChaincodeEvent)(nil), // 21: protos.ChaincodeEvent + (StateKV_Type)(0), // 1: protos.StateKV.Type + (*ChaincodeMessage)(nil), // 2: protos.ChaincodeMessage + (*GetState)(nil), // 3: protos.GetState + (*GetStateMetadata)(nil), // 4: protos.GetStateMetadata + (*PutState)(nil), // 5: protos.PutState + (*PutStateMetadata)(nil), // 6: protos.PutStateMetadata + (*ChangeStateBatch)(nil), // 7: protos.ChangeStateBatch + (*StateKV)(nil), // 8: protos.StateKV + (*DelState)(nil), // 9: protos.DelState + (*PurgePrivateState)(nil), // 10: protos.PurgePrivateState + (*GetStateByRange)(nil), // 11: protos.GetStateByRange + (*GetQueryResult)(nil), // 12: protos.GetQueryResult + (*QueryMetadata)(nil), // 13: protos.QueryMetadata + (*GetHistoryForKey)(nil), // 14: protos.GetHistoryForKey + (*QueryStateNext)(nil), // 15: protos.QueryStateNext + (*QueryStateClose)(nil), // 16: protos.QueryStateClose + (*QueryResultBytes)(nil), // 17: protos.QueryResultBytes + (*QueryResponse)(nil), // 18: protos.QueryResponse + (*QueryResponseMetadata)(nil), // 19: protos.QueryResponseMetadata + (*StateMetadata)(nil), // 20: protos.StateMetadata + (*StateMetadataResult)(nil), // 21: protos.StateMetadataResult + (*timestamppb.Timestamp)(nil), // 22: google.protobuf.Timestamp + (*SignedProposal)(nil), // 23: protos.SignedProposal + (*ChaincodeEvent)(nil), // 24: protos.ChaincodeEvent } var file_peer_chaincode_shim_proto_depIdxs = []int32{ 0, // 0: protos.ChaincodeMessage.type:type_name -> protos.ChaincodeMessage.Type - 19, // 1: protos.ChaincodeMessage.timestamp:type_name -> google.protobuf.Timestamp - 20, // 2: protos.ChaincodeMessage.proposal:type_name -> protos.SignedProposal - 21, // 3: protos.ChaincodeMessage.chaincode_event:type_name -> protos.ChaincodeEvent - 17, // 4: protos.PutStateMetadata.metadata:type_name -> protos.StateMetadata - 14, // 5: protos.QueryResponse.results:type_name -> protos.QueryResultBytes - 17, // 6: protos.StateMetadataResult.entries:type_name -> protos.StateMetadata - 1, // 7: protos.ChaincodeSupport.Register:input_type -> protos.ChaincodeMessage - 1, // 8: protos.Chaincode.Connect:input_type -> protos.ChaincodeMessage - 1, // 9: protos.ChaincodeSupport.Register:output_type -> protos.ChaincodeMessage - 1, // 10: protos.Chaincode.Connect:output_type -> protos.ChaincodeMessage - 9, // [9:11] is the sub-list for method output_type - 7, // [7:9] is the sub-list for method input_type - 7, // [7:7] is the sub-list for extension type_name - 7, // [7:7] is the sub-list for extension extendee - 0, // [0:7] is the sub-list for field type_name + 22, // 1: protos.ChaincodeMessage.timestamp:type_name -> google.protobuf.Timestamp + 23, // 2: protos.ChaincodeMessage.proposal:type_name -> protos.SignedProposal + 24, // 3: protos.ChaincodeMessage.chaincode_event:type_name -> protos.ChaincodeEvent + 20, // 4: protos.PutStateMetadata.metadata:type_name -> protos.StateMetadata + 8, // 5: protos.ChangeStateBatch.kvs:type_name -> protos.StateKV + 20, // 6: protos.StateKV.metadata:type_name -> protos.StateMetadata + 1, // 7: protos.StateKV.type:type_name -> protos.StateKV.Type + 17, // 8: protos.QueryResponse.results:type_name -> protos.QueryResultBytes + 20, // 9: protos.StateMetadataResult.entries:type_name -> protos.StateMetadata + 2, // 10: protos.ChaincodeSupport.Register:input_type -> protos.ChaincodeMessage + 2, // 11: protos.Chaincode.Connect:input_type -> protos.ChaincodeMessage + 2, // 12: protos.ChaincodeSupport.Register:output_type -> protos.ChaincodeMessage + 2, // 13: protos.Chaincode.Connect:output_type -> protos.ChaincodeMessage + 12, // [12:14] is the sub-list for method output_type + 10, // [10:12] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_peer_chaincode_shim_proto_init() } @@ -1445,7 +1657,7 @@ func file_peer_chaincode_shim_proto_init() { file_peer_chaincode_event_proto_init() file_peer_proposal_proto_init() if !protoimpl.UnsafeEnabled { - file_peer_chaincode_shim_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeMessage); i { case 0: return &v.state @@ -1457,7 +1669,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetState); i { case 0: return &v.state @@ -1469,7 +1681,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetStateMetadata); i { case 0: return &v.state @@ -1481,7 +1693,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutState); i { case 0: return &v.state @@ -1493,7 +1705,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PutStateMetadata); i { case 0: return &v.state @@ -1505,7 +1717,31 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChangeStateBatch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_peer_chaincode_shim_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StateKV); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_peer_chaincode_shim_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DelState); i { case 0: return &v.state @@ -1517,7 +1753,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PurgePrivateState); i { case 0: return &v.state @@ -1529,7 +1765,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetStateByRange); i { case 0: return &v.state @@ -1541,7 +1777,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetQueryResult); i { case 0: return &v.state @@ -1553,7 +1789,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryMetadata); i { case 0: return &v.state @@ -1565,7 +1801,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetHistoryForKey); i { case 0: return &v.state @@ -1577,7 +1813,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryStateNext); i { case 0: return &v.state @@ -1589,7 +1825,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryStateClose); i { case 0: return &v.state @@ -1601,7 +1837,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryResultBytes); i { case 0: return &v.state @@ -1613,7 +1849,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[14].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryResponse); i { case 0: return &v.state @@ -1625,7 +1861,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[15].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryResponseMetadata); i { case 0: return &v.state @@ -1637,7 +1873,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[16].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateMetadata); i { case 0: return &v.state @@ -1649,7 +1885,7 @@ func file_peer_chaincode_shim_proto_init() { return nil } } - file_peer_chaincode_shim_proto_msgTypes[17].Exporter = func(v any, i int) any { + file_peer_chaincode_shim_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateMetadataResult); i { case 0: return &v.state @@ -1667,8 +1903,8 @@ func file_peer_chaincode_shim_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_peer_chaincode_shim_proto_rawDesc, - NumEnums: 1, - NumMessages: 18, + NumEnums: 2, + NumMessages: 20, NumExtensions: 0, NumServices: 2, }, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim_grpc.pb.go index 01b080611b7..c7baf0503d2 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/chaincode_shim_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: peer/chaincode_shim.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( ChaincodeSupport_Register_FullMethodName = "/protos.ChaincodeSupport/Register" @@ -29,11 +29,8 @@ const ( // ChaincodeSupportClient is the client API for ChaincodeSupport service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Interface that provides support to chaincode execution. ChaincodeContext -// provides the context necessary for the server to respond appropriately. type ChaincodeSupportClient interface { - Register(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ChaincodeMessage, ChaincodeMessage], error) + Register(ctx context.Context, opts ...grpc.CallOption) (ChaincodeSupport_RegisterClient, error) } type chaincodeSupportClient struct { @@ -44,40 +41,51 @@ func NewChaincodeSupportClient(cc grpc.ClientConnInterface) ChaincodeSupportClie return &chaincodeSupportClient{cc} } -func (c *chaincodeSupportClient) Register(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ChaincodeMessage, ChaincodeMessage], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &ChaincodeSupport_ServiceDesc.Streams[0], ChaincodeSupport_Register_FullMethodName, cOpts...) +func (c *chaincodeSupportClient) Register(ctx context.Context, opts ...grpc.CallOption) (ChaincodeSupport_RegisterClient, error) { + stream, err := c.cc.NewStream(ctx, &ChaincodeSupport_ServiceDesc.Streams[0], ChaincodeSupport_Register_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[ChaincodeMessage, ChaincodeMessage]{ClientStream: stream} + x := &chaincodeSupportRegisterClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ChaincodeSupport_RegisterClient = grpc.BidiStreamingClient[ChaincodeMessage, ChaincodeMessage] +type ChaincodeSupport_RegisterClient interface { + Send(*ChaincodeMessage) error + Recv() (*ChaincodeMessage, error) + grpc.ClientStream +} + +type chaincodeSupportRegisterClient struct { + grpc.ClientStream +} + +func (x *chaincodeSupportRegisterClient) Send(m *ChaincodeMessage) error { + return x.ClientStream.SendMsg(m) +} + +func (x *chaincodeSupportRegisterClient) Recv() (*ChaincodeMessage, error) { + m := new(ChaincodeMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ChaincodeSupportServer is the server API for ChaincodeSupport service. // All implementations should embed UnimplementedChaincodeSupportServer -// for forward compatibility. -// -// Interface that provides support to chaincode execution. ChaincodeContext -// provides the context necessary for the server to respond appropriately. +// for forward compatibility type ChaincodeSupportServer interface { - Register(grpc.BidiStreamingServer[ChaincodeMessage, ChaincodeMessage]) error + Register(ChaincodeSupport_RegisterServer) error } -// UnimplementedChaincodeSupportServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedChaincodeSupportServer struct{} +// UnimplementedChaincodeSupportServer should be embedded to have forward compatible implementations. +type UnimplementedChaincodeSupportServer struct { +} -func (UnimplementedChaincodeSupportServer) Register(grpc.BidiStreamingServer[ChaincodeMessage, ChaincodeMessage]) error { +func (UnimplementedChaincodeSupportServer) Register(ChaincodeSupport_RegisterServer) error { return status.Errorf(codes.Unimplemented, "method Register not implemented") } -func (UnimplementedChaincodeSupportServer) testEmbeddedByValue() {} // UnsafeChaincodeSupportServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ChaincodeSupportServer will @@ -87,22 +95,34 @@ type UnsafeChaincodeSupportServer interface { } func RegisterChaincodeSupportServer(s grpc.ServiceRegistrar, srv ChaincodeSupportServer) { - // If the following call pancis, it indicates UnimplementedChaincodeSupportServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&ChaincodeSupport_ServiceDesc, srv) } func _ChaincodeSupport_Register_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ChaincodeSupportServer).Register(&grpc.GenericServerStream[ChaincodeMessage, ChaincodeMessage]{ServerStream: stream}) + return srv.(ChaincodeSupportServer).Register(&chaincodeSupportRegisterServer{stream}) +} + +type ChaincodeSupport_RegisterServer interface { + Send(*ChaincodeMessage) error + Recv() (*ChaincodeMessage, error) + grpc.ServerStream +} + +type chaincodeSupportRegisterServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type ChaincodeSupport_RegisterServer = grpc.BidiStreamingServer[ChaincodeMessage, ChaincodeMessage] +func (x *chaincodeSupportRegisterServer) Send(m *ChaincodeMessage) error { + return x.ServerStream.SendMsg(m) +} + +func (x *chaincodeSupportRegisterServer) Recv() (*ChaincodeMessage, error) { + m := new(ChaincodeMessage) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ChaincodeSupport_ServiceDesc is the grpc.ServiceDesc for ChaincodeSupport service. // It's only intended for direct use with grpc.RegisterService, @@ -129,11 +149,8 @@ const ( // ChaincodeClient is the client API for Chaincode service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Chaincode as a server - peer establishes a connection to the chaincode as a client -// Currently only supports a stream connection. type ChaincodeClient interface { - Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ChaincodeMessage, ChaincodeMessage], error) + Connect(ctx context.Context, opts ...grpc.CallOption) (Chaincode_ConnectClient, error) } type chaincodeClient struct { @@ -144,40 +161,51 @@ func NewChaincodeClient(cc grpc.ClientConnInterface) ChaincodeClient { return &chaincodeClient{cc} } -func (c *chaincodeClient) Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ChaincodeMessage, ChaincodeMessage], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Chaincode_ServiceDesc.Streams[0], Chaincode_Connect_FullMethodName, cOpts...) +func (c *chaincodeClient) Connect(ctx context.Context, opts ...grpc.CallOption) (Chaincode_ConnectClient, error) { + stream, err := c.cc.NewStream(ctx, &Chaincode_ServiceDesc.Streams[0], Chaincode_Connect_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[ChaincodeMessage, ChaincodeMessage]{ClientStream: stream} + x := &chaincodeConnectClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Chaincode_ConnectClient = grpc.BidiStreamingClient[ChaincodeMessage, ChaincodeMessage] +type Chaincode_ConnectClient interface { + Send(*ChaincodeMessage) error + Recv() (*ChaincodeMessage, error) + grpc.ClientStream +} + +type chaincodeConnectClient struct { + grpc.ClientStream +} + +func (x *chaincodeConnectClient) Send(m *ChaincodeMessage) error { + return x.ClientStream.SendMsg(m) +} + +func (x *chaincodeConnectClient) Recv() (*ChaincodeMessage, error) { + m := new(ChaincodeMessage) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // ChaincodeServer is the server API for Chaincode service. // All implementations should embed UnimplementedChaincodeServer -// for forward compatibility. -// -// Chaincode as a server - peer establishes a connection to the chaincode as a client -// Currently only supports a stream connection. +// for forward compatibility type ChaincodeServer interface { - Connect(grpc.BidiStreamingServer[ChaincodeMessage, ChaincodeMessage]) error + Connect(Chaincode_ConnectServer) error } -// UnimplementedChaincodeServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedChaincodeServer struct{} +// UnimplementedChaincodeServer should be embedded to have forward compatible implementations. +type UnimplementedChaincodeServer struct { +} -func (UnimplementedChaincodeServer) Connect(grpc.BidiStreamingServer[ChaincodeMessage, ChaincodeMessage]) error { +func (UnimplementedChaincodeServer) Connect(Chaincode_ConnectServer) error { return status.Errorf(codes.Unimplemented, "method Connect not implemented") } -func (UnimplementedChaincodeServer) testEmbeddedByValue() {} // UnsafeChaincodeServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ChaincodeServer will @@ -187,22 +215,34 @@ type UnsafeChaincodeServer interface { } func RegisterChaincodeServer(s grpc.ServiceRegistrar, srv ChaincodeServer) { - // If the following call pancis, it indicates UnimplementedChaincodeServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Chaincode_ServiceDesc, srv) } func _Chaincode_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(ChaincodeServer).Connect(&grpc.GenericServerStream[ChaincodeMessage, ChaincodeMessage]{ServerStream: stream}) + return srv.(ChaincodeServer).Connect(&chaincodeConnectServer{stream}) +} + +type Chaincode_ConnectServer interface { + Send(*ChaincodeMessage) error + Recv() (*ChaincodeMessage, error) + grpc.ServerStream +} + +type chaincodeConnectServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Chaincode_ConnectServer = grpc.BidiStreamingServer[ChaincodeMessage, ChaincodeMessage] +func (x *chaincodeConnectServer) Send(m *ChaincodeMessage) error { + return x.ServerStream.SendMsg(m) +} + +func (x *chaincodeConnectServer) Recv() (*ChaincodeMessage, error) { + m := new(ChaincodeMessage) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // Chaincode_ServiceDesc is the grpc.ServiceDesc for Chaincode service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/collection.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/collection.pb.go index 49d304cff3d..7f100490733 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/collection.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/collection.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/collection.proto @@ -424,7 +424,7 @@ func file_peer_collection_proto_rawDescGZIP() []byte { } var file_peer_collection_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_peer_collection_proto_goTypes = []any{ +var file_peer_collection_proto_goTypes = []interface{}{ (*CollectionConfigPackage)(nil), // 0: protos.CollectionConfigPackage (*CollectionConfig)(nil), // 1: protos.CollectionConfig (*StaticCollectionConfig)(nil), // 2: protos.StaticCollectionConfig @@ -452,7 +452,7 @@ func file_peer_collection_proto_init() { } file_peer_policy_proto_init() if !protoimpl.UnsafeEnabled { - file_peer_collection_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_collection_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionConfigPackage); i { case 0: return &v.state @@ -464,7 +464,7 @@ func file_peer_collection_proto_init() { return nil } } - file_peer_collection_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_collection_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionConfig); i { case 0: return &v.state @@ -476,7 +476,7 @@ func file_peer_collection_proto_init() { return nil } } - file_peer_collection_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_collection_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StaticCollectionConfig); i { case 0: return &v.state @@ -488,7 +488,7 @@ func file_peer_collection_proto_init() { return nil } } - file_peer_collection_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_collection_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CollectionPolicyConfig); i { case 0: return &v.state @@ -501,10 +501,10 @@ func file_peer_collection_proto_init() { } } } - file_peer_collection_proto_msgTypes[1].OneofWrappers = []any{ + file_peer_collection_proto_msgTypes[1].OneofWrappers = []interface{}{ (*CollectionConfig_StaticCollectionConfig)(nil), } - file_peer_collection_proto_msgTypes[3].OneofWrappers = []any{ + file_peer_collection_proto_msgTypes[3].OneofWrappers = []interface{}{ (*CollectionPolicyConfig_SignaturePolicy)(nil), } type x struct{} diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/configuration.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/configuration.pb.go index c052ee6418d..9d3f82495ca 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/configuration.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/configuration.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/configuration.proto @@ -277,7 +277,7 @@ func file_peer_configuration_proto_rawDescGZIP() []byte { } var file_peer_configuration_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_peer_configuration_proto_goTypes = []any{ +var file_peer_configuration_proto_goTypes = []interface{}{ (*AnchorPeers)(nil), // 0: protos.AnchorPeers (*AnchorPeer)(nil), // 1: protos.AnchorPeer (*APIResource)(nil), // 2: protos.APIResource @@ -301,7 +301,7 @@ func file_peer_configuration_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_configuration_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_configuration_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnchorPeers); i { case 0: return &v.state @@ -313,7 +313,7 @@ func file_peer_configuration_proto_init() { return nil } } - file_peer_configuration_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_configuration_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AnchorPeer); i { case 0: return &v.state @@ -325,7 +325,7 @@ func file_peer_configuration_proto_init() { return nil } } - file_peer_configuration_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_configuration_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*APIResource); i { case 0: return &v.state @@ -337,7 +337,7 @@ func file_peer_configuration_proto_init() { return nil } } - file_peer_configuration_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_configuration_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ACLs); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events.pb.go index 75f8db6d3b5..37c2f38fe1c 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/events.proto @@ -568,7 +568,7 @@ func file_peer_events_proto_rawDescGZIP() []byte { } var file_peer_events_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_peer_events_proto_goTypes = []any{ +var file_peer_events_proto_goTypes = []interface{}{ (*FilteredBlock)(nil), // 0: protos.FilteredBlock (*FilteredTransaction)(nil), // 1: protos.FilteredTransaction (*FilteredTransactionActions)(nil), // 2: protos.FilteredTransactionActions @@ -619,7 +619,7 @@ func file_peer_events_proto_init() { file_peer_chaincode_event_proto_init() file_peer_transaction_proto_init() if !protoimpl.UnsafeEnabled { - file_peer_events_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_events_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FilteredBlock); i { case 0: return &v.state @@ -631,7 +631,7 @@ func file_peer_events_proto_init() { return nil } } - file_peer_events_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_events_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FilteredTransaction); i { case 0: return &v.state @@ -643,7 +643,7 @@ func file_peer_events_proto_init() { return nil } } - file_peer_events_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FilteredTransactionActions); i { case 0: return &v.state @@ -655,7 +655,7 @@ func file_peer_events_proto_init() { return nil } } - file_peer_events_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_events_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FilteredChaincodeAction); i { case 0: return &v.state @@ -667,7 +667,7 @@ func file_peer_events_proto_init() { return nil } } - file_peer_events_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_events_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BlockAndPrivateData); i { case 0: return &v.state @@ -679,7 +679,7 @@ func file_peer_events_proto_init() { return nil } } - file_peer_events_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_peer_events_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeliverResponse); i { case 0: return &v.state @@ -692,10 +692,10 @@ func file_peer_events_proto_init() { } } } - file_peer_events_proto_msgTypes[1].OneofWrappers = []any{ + file_peer_events_proto_msgTypes[1].OneofWrappers = []interface{}{ (*FilteredTransaction_TransactionActions)(nil), } - file_peer_events_proto_msgTypes[5].OneofWrappers = []any{ + file_peer_events_proto_msgTypes[5].OneofWrappers = []interface{}{ (*DeliverResponse_Status)(nil), (*DeliverResponse_Block)(nil), (*DeliverResponse_FilteredBlock)(nil), diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events_grpc.pb.go index bfbf3f5837e..4b4b09ce9fb 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/events_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: peer/events.proto @@ -20,8 +20,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Deliver_Deliver_FullMethodName = "/protos.Deliver/Deliver" @@ -36,15 +36,15 @@ type DeliverClient interface { // Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with // Payload data as a marshaled orderer.SeekInfo message, // then a stream of block replies is received - Deliver(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) + Deliver(ctx context.Context, opts ...grpc.CallOption) (Deliver_DeliverClient, error) // DeliverFiltered first requires an Envelope of type ab.DELIVER_SEEK_INFO with // Payload data as a marshaled orderer.SeekInfo message, // then a stream of **filtered** block replies is received - DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) + DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (Deliver_DeliverFilteredClient, error) // DeliverWithPrivateData first requires an Envelope of type ab.DELIVER_SEEK_INFO with // Payload data as a marshaled orderer.SeekInfo message, // then a stream of block and private data replies is received - DeliverWithPrivateData(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) + DeliverWithPrivateData(ctx context.Context, opts ...grpc.CallOption) (Deliver_DeliverWithPrivateDataClient, error) } type deliverClient struct { @@ -55,80 +55,130 @@ func NewDeliverClient(cc grpc.ClientConnInterface) DeliverClient { return &deliverClient{cc} } -func (c *deliverClient) Deliver(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Deliver_ServiceDesc.Streams[0], Deliver_Deliver_FullMethodName, cOpts...) +func (c *deliverClient) Deliver(ctx context.Context, opts ...grpc.CallOption) (Deliver_DeliverClient, error) { + stream, err := c.cc.NewStream(ctx, &Deliver_ServiceDesc.Streams[0], Deliver_Deliver_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[common.Envelope, DeliverResponse]{ClientStream: stream} + x := &deliverDeliverClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Deliver_DeliverClient = grpc.BidiStreamingClient[common.Envelope, DeliverResponse] +type Deliver_DeliverClient interface { + Send(*common.Envelope) error + Recv() (*DeliverResponse, error) + grpc.ClientStream +} + +type deliverDeliverClient struct { + grpc.ClientStream +} + +func (x *deliverDeliverClient) Send(m *common.Envelope) error { + return x.ClientStream.SendMsg(m) +} -func (c *deliverClient) DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Deliver_ServiceDesc.Streams[1], Deliver_DeliverFiltered_FullMethodName, cOpts...) +func (x *deliverDeliverClient) Recv() (*DeliverResponse, error) { + m := new(DeliverResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *deliverClient) DeliverFiltered(ctx context.Context, opts ...grpc.CallOption) (Deliver_DeliverFilteredClient, error) { + stream, err := c.cc.NewStream(ctx, &Deliver_ServiceDesc.Streams[1], Deliver_DeliverFiltered_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[common.Envelope, DeliverResponse]{ClientStream: stream} + x := &deliverDeliverFilteredClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Deliver_DeliverFilteredClient = grpc.BidiStreamingClient[common.Envelope, DeliverResponse] +type Deliver_DeliverFilteredClient interface { + Send(*common.Envelope) error + Recv() (*DeliverResponse, error) + grpc.ClientStream +} + +type deliverDeliverFilteredClient struct { + grpc.ClientStream +} -func (c *deliverClient) DeliverWithPrivateData(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[common.Envelope, DeliverResponse], error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &Deliver_ServiceDesc.Streams[2], Deliver_DeliverWithPrivateData_FullMethodName, cOpts...) +func (x *deliverDeliverFilteredClient) Send(m *common.Envelope) error { + return x.ClientStream.SendMsg(m) +} + +func (x *deliverDeliverFilteredClient) Recv() (*DeliverResponse, error) { + m := new(DeliverResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *deliverClient) DeliverWithPrivateData(ctx context.Context, opts ...grpc.CallOption) (Deliver_DeliverWithPrivateDataClient, error) { + stream, err := c.cc.NewStream(ctx, &Deliver_ServiceDesc.Streams[2], Deliver_DeliverWithPrivateData_FullMethodName, opts...) if err != nil { return nil, err } - x := &grpc.GenericClientStream[common.Envelope, DeliverResponse]{ClientStream: stream} + x := &deliverDeliverWithPrivateDataClient{stream} return x, nil } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Deliver_DeliverWithPrivateDataClient = grpc.BidiStreamingClient[common.Envelope, DeliverResponse] +type Deliver_DeliverWithPrivateDataClient interface { + Send(*common.Envelope) error + Recv() (*DeliverResponse, error) + grpc.ClientStream +} + +type deliverDeliverWithPrivateDataClient struct { + grpc.ClientStream +} + +func (x *deliverDeliverWithPrivateDataClient) Send(m *common.Envelope) error { + return x.ClientStream.SendMsg(m) +} + +func (x *deliverDeliverWithPrivateDataClient) Recv() (*DeliverResponse, error) { + m := new(DeliverResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // DeliverServer is the server API for Deliver service. // All implementations should embed UnimplementedDeliverServer -// for forward compatibility. +// for forward compatibility type DeliverServer interface { // Deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with // Payload data as a marshaled orderer.SeekInfo message, // then a stream of block replies is received - Deliver(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error + Deliver(Deliver_DeliverServer) error // DeliverFiltered first requires an Envelope of type ab.DELIVER_SEEK_INFO with // Payload data as a marshaled orderer.SeekInfo message, // then a stream of **filtered** block replies is received - DeliverFiltered(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error + DeliverFiltered(Deliver_DeliverFilteredServer) error // DeliverWithPrivateData first requires an Envelope of type ab.DELIVER_SEEK_INFO with // Payload data as a marshaled orderer.SeekInfo message, // then a stream of block and private data replies is received - DeliverWithPrivateData(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error + DeliverWithPrivateData(Deliver_DeliverWithPrivateDataServer) error } -// UnimplementedDeliverServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedDeliverServer struct{} +// UnimplementedDeliverServer should be embedded to have forward compatible implementations. +type UnimplementedDeliverServer struct { +} -func (UnimplementedDeliverServer) Deliver(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error { +func (UnimplementedDeliverServer) Deliver(Deliver_DeliverServer) error { return status.Errorf(codes.Unimplemented, "method Deliver not implemented") } -func (UnimplementedDeliverServer) DeliverFiltered(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error { +func (UnimplementedDeliverServer) DeliverFiltered(Deliver_DeliverFilteredServer) error { return status.Errorf(codes.Unimplemented, "method DeliverFiltered not implemented") } -func (UnimplementedDeliverServer) DeliverWithPrivateData(grpc.BidiStreamingServer[common.Envelope, DeliverResponse]) error { +func (UnimplementedDeliverServer) DeliverWithPrivateData(Deliver_DeliverWithPrivateDataServer) error { return status.Errorf(codes.Unimplemented, "method DeliverWithPrivateData not implemented") } -func (UnimplementedDeliverServer) testEmbeddedByValue() {} // UnsafeDeliverServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DeliverServer will @@ -138,36 +188,86 @@ type UnsafeDeliverServer interface { } func RegisterDeliverServer(s grpc.ServiceRegistrar, srv DeliverServer) { - // If the following call pancis, it indicates UnimplementedDeliverServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Deliver_ServiceDesc, srv) } func _Deliver_Deliver_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DeliverServer).Deliver(&grpc.GenericServerStream[common.Envelope, DeliverResponse]{ServerStream: stream}) + return srv.(DeliverServer).Deliver(&deliverDeliverServer{stream}) +} + +type Deliver_DeliverServer interface { + Send(*DeliverResponse) error + Recv() (*common.Envelope, error) + grpc.ServerStream +} + +type deliverDeliverServer struct { + grpc.ServerStream +} + +func (x *deliverDeliverServer) Send(m *DeliverResponse) error { + return x.ServerStream.SendMsg(m) } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Deliver_DeliverServer = grpc.BidiStreamingServer[common.Envelope, DeliverResponse] +func (x *deliverDeliverServer) Recv() (*common.Envelope, error) { + m := new(common.Envelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func _Deliver_DeliverFiltered_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DeliverServer).DeliverFiltered(&grpc.GenericServerStream[common.Envelope, DeliverResponse]{ServerStream: stream}) + return srv.(DeliverServer).DeliverFiltered(&deliverDeliverFilteredServer{stream}) +} + +type Deliver_DeliverFilteredServer interface { + Send(*DeliverResponse) error + Recv() (*common.Envelope, error) + grpc.ServerStream +} + +type deliverDeliverFilteredServer struct { + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Deliver_DeliverFilteredServer = grpc.BidiStreamingServer[common.Envelope, DeliverResponse] +func (x *deliverDeliverFilteredServer) Send(m *DeliverResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *deliverDeliverFilteredServer) Recv() (*common.Envelope, error) { + m := new(common.Envelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} func _Deliver_DeliverWithPrivateData_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DeliverServer).DeliverWithPrivateData(&grpc.GenericServerStream[common.Envelope, DeliverResponse]{ServerStream: stream}) + return srv.(DeliverServer).DeliverWithPrivateData(&deliverDeliverWithPrivateDataServer{stream}) +} + +type Deliver_DeliverWithPrivateDataServer interface { + Send(*DeliverResponse) error + Recv() (*common.Envelope, error) + grpc.ServerStream } -// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. -type Deliver_DeliverWithPrivateDataServer = grpc.BidiStreamingServer[common.Envelope, DeliverResponse] +type deliverDeliverWithPrivateDataServer struct { + grpc.ServerStream +} + +func (x *deliverDeliverWithPrivateDataServer) Send(m *DeliverResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *deliverDeliverWithPrivateDataServer) Recv() (*common.Envelope, error) { + m := new(common.Envelope) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} // Deliver_ServiceDesc is the grpc.ServiceDesc for Deliver service. // It's only intended for direct use with grpc.RegisterService, diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/chaincode_definition.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/chaincode_definition.pb.go index e10fe0d15fe..7b4976bdb5b 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/chaincode_definition.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/chaincode_definition.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/lifecycle/chaincode_definition.proto @@ -198,7 +198,7 @@ func file_peer_lifecycle_chaincode_definition_proto_rawDescGZIP() []byte { } var file_peer_lifecycle_chaincode_definition_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_peer_lifecycle_chaincode_definition_proto_goTypes = []any{ +var file_peer_lifecycle_chaincode_definition_proto_goTypes = []interface{}{ (*ChaincodeEndorsementInfo)(nil), // 0: lifecycle.ChaincodeEndorsementInfo (*ChaincodeValidationInfo)(nil), // 1: lifecycle.ChaincodeValidationInfo } @@ -216,7 +216,7 @@ func file_peer_lifecycle_chaincode_definition_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_lifecycle_chaincode_definition_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_lifecycle_chaincode_definition_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeEndorsementInfo); i { case 0: return &v.state @@ -228,7 +228,7 @@ func file_peer_lifecycle_chaincode_definition_proto_init() { return nil } } - file_peer_lifecycle_chaincode_definition_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_lifecycle_chaincode_definition_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeValidationInfo); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/db.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/db.pb.go index d02a68bb1ad..4e02ace1e9f 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/db.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/db.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/lifecycle/db.proto @@ -221,7 +221,7 @@ func file_peer_lifecycle_db_proto_rawDescGZIP() []byte { } var file_peer_lifecycle_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_peer_lifecycle_db_proto_goTypes = []any{ +var file_peer_lifecycle_db_proto_goTypes = []interface{}{ (*StateMetadata)(nil), // 0: lifecycle.StateMetadata (*StateData)(nil), // 1: lifecycle.StateData } @@ -239,7 +239,7 @@ func file_peer_lifecycle_db_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_lifecycle_db_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_lifecycle_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateMetadata); i { case 0: return &v.state @@ -251,7 +251,7 @@ func file_peer_lifecycle_db_proto_init() { return nil } } - file_peer_lifecycle_db_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_lifecycle_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateData); i { case 0: return &v.state @@ -264,7 +264,7 @@ func file_peer_lifecycle_db_proto_init() { } } } - file_peer_lifecycle_db_proto_msgTypes[1].OneofWrappers = []any{ + file_peer_lifecycle_db_proto_msgTypes[1].OneofWrappers = []interface{}{ (*StateData_Int64)(nil), (*StateData_Bytes)(nil), (*StateData_String_)(nil), diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/lifecycle.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/lifecycle.pb.go index 5a766009cc0..af42d7078b8 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/lifecycle.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/lifecycle/lifecycle.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/lifecycle/lifecycle.proto @@ -2469,7 +2469,7 @@ func file_peer_lifecycle_lifecycle_proto_rawDescGZIP() []byte { } var file_peer_lifecycle_lifecycle_proto_msgTypes = make([]protoimpl.MessageInfo, 38) -var file_peer_lifecycle_lifecycle_proto_goTypes = []any{ +var file_peer_lifecycle_lifecycle_proto_goTypes = []interface{}{ (*InstallChaincodeArgs)(nil), // 0: lifecycle.InstallChaincodeArgs (*InstallChaincodeResult)(nil), // 1: lifecycle.InstallChaincodeResult (*QueryInstalledChaincodeArgs)(nil), // 2: lifecycle.QueryInstalledChaincodeArgs @@ -2549,7 +2549,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_lifecycle_lifecycle_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InstallChaincodeArgs); i { case 0: return &v.state @@ -2561,7 +2561,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InstallChaincodeResult); i { case 0: return &v.state @@ -2573,7 +2573,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodeArgs); i { case 0: return &v.state @@ -2585,7 +2585,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodeResult); i { case 0: return &v.state @@ -2597,7 +2597,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetInstalledChaincodePackageArgs); i { case 0: return &v.state @@ -2609,7 +2609,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetInstalledChaincodePackageResult); i { case 0: return &v.state @@ -2621,7 +2621,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[6].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodesArgs); i { case 0: return &v.state @@ -2633,7 +2633,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[7].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodesResult); i { case 0: return &v.state @@ -2645,7 +2645,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[8].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ApproveChaincodeDefinitionForMyOrgArgs); i { case 0: return &v.state @@ -2657,7 +2657,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[9].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeSource); i { case 0: return &v.state @@ -2669,7 +2669,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[10].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ApproveChaincodeDefinitionForMyOrgResult); i { case 0: return &v.state @@ -2681,7 +2681,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[11].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CommitChaincodeDefinitionArgs); i { case 0: return &v.state @@ -2693,7 +2693,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[12].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CommitChaincodeDefinitionResult); i { case 0: return &v.state @@ -2705,7 +2705,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[13].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckCommitReadinessArgs); i { case 0: return &v.state @@ -2717,7 +2717,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[14].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckCommitReadinessResult); i { case 0: return &v.state @@ -2729,7 +2729,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[15].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryApprovedChaincodeDefinitionArgs); i { case 0: return &v.state @@ -2741,7 +2741,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[16].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryApprovedChaincodeDefinitionResult); i { case 0: return &v.state @@ -2753,7 +2753,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[17].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryApprovedChaincodeDefinitionsArgs); i { case 0: return &v.state @@ -2765,7 +2765,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[18].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryApprovedChaincodeDefinitionsResult); i { case 0: return &v.state @@ -2777,7 +2777,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[19].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionArgs); i { case 0: return &v.state @@ -2789,7 +2789,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[20].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionResult); i { case 0: return &v.state @@ -2801,7 +2801,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[21].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionsArgs); i { case 0: return &v.state @@ -2813,7 +2813,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[22].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionsResult); i { case 0: return &v.state @@ -2825,7 +2825,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[24].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodeResult_References); i { case 0: return &v.state @@ -2837,7 +2837,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[25].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodeResult_Chaincode); i { case 0: return &v.state @@ -2849,7 +2849,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[26].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodesResult_InstalledChaincode); i { case 0: return &v.state @@ -2861,7 +2861,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[27].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodesResult_References); i { case 0: return &v.state @@ -2873,7 +2873,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[28].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryInstalledChaincodesResult_Chaincode); i { case 0: return &v.state @@ -2885,7 +2885,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[30].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeSource_Unavailable); i { case 0: return &v.state @@ -2897,7 +2897,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[31].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeSource_Local); i { case 0: return &v.state @@ -2909,7 +2909,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[33].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CheckCommitReadinessResult_Mismatches); i { case 0: return &v.state @@ -2921,7 +2921,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[35].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryApprovedChaincodeDefinitionsResult_ApprovedChaincodeDefinition); i { case 0: return &v.state @@ -2933,7 +2933,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { return nil } } - file_peer_lifecycle_lifecycle_proto_msgTypes[37].Exporter = func(v any, i int) any { + file_peer_lifecycle_lifecycle_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryChaincodeDefinitionsResult_ChaincodeDefinition); i { case 0: return &v.state @@ -2946,7 +2946,7 @@ func file_peer_lifecycle_lifecycle_proto_init() { } } } - file_peer_lifecycle_lifecycle_proto_msgTypes[9].OneofWrappers = []any{ + file_peer_lifecycle_lifecycle_proto_msgTypes[9].OneofWrappers = []interface{}{ (*ChaincodeSource_Unavailable_)(nil), (*ChaincodeSource_LocalPackage)(nil), } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer.pb.go index 1577fb03113..ac100fb8342 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/peer.proto @@ -49,7 +49,7 @@ var file_peer_peer_proto_rawDesc = []byte{ 0x74, 0x6f, 0x33, } -var file_peer_peer_proto_goTypes = []any{ +var file_peer_peer_proto_goTypes = []interface{}{ (*SignedProposal)(nil), // 0: protos.SignedProposal (*ProposalResponse)(nil), // 1: protos.ProposalResponse } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer_grpc.pb.go index ac99beb100b..f3fd5657084 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/peer_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: peer/peer.proto @@ -19,8 +19,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Endorser_ProcessProposal_FullMethodName = "/protos.Endorser/ProcessProposal" @@ -42,9 +42,8 @@ func NewEndorserClient(cc grpc.ClientConnInterface) EndorserClient { } func (c *endorserClient) ProcessProposal(ctx context.Context, in *SignedProposal, opts ...grpc.CallOption) (*ProposalResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ProposalResponse) - err := c.cc.Invoke(ctx, Endorser_ProcessProposal_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Endorser_ProcessProposal_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -53,22 +52,18 @@ func (c *endorserClient) ProcessProposal(ctx context.Context, in *SignedProposal // EndorserServer is the server API for Endorser service. // All implementations should embed UnimplementedEndorserServer -// for forward compatibility. +// for forward compatibility type EndorserServer interface { ProcessProposal(context.Context, *SignedProposal) (*ProposalResponse, error) } -// UnimplementedEndorserServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedEndorserServer struct{} +// UnimplementedEndorserServer should be embedded to have forward compatible implementations. +type UnimplementedEndorserServer struct { +} func (UnimplementedEndorserServer) ProcessProposal(context.Context, *SignedProposal) (*ProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProcessProposal not implemented") } -func (UnimplementedEndorserServer) testEmbeddedByValue() {} // UnsafeEndorserServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to EndorserServer will @@ -78,13 +73,6 @@ type UnsafeEndorserServer interface { } func RegisterEndorserServer(s grpc.ServiceRegistrar, srv EndorserServer) { - // If the following call pancis, it indicates UnimplementedEndorserServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Endorser_ServiceDesc, srv) } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/policy.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/policy.pb.go index 72a80941b69..99e99044f2b 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/policy.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/policy.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/policy.proto @@ -157,7 +157,7 @@ func file_peer_policy_proto_rawDescGZIP() []byte { } var file_peer_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_peer_policy_proto_goTypes = []any{ +var file_peer_policy_proto_goTypes = []interface{}{ (*ApplicationPolicy)(nil), // 0: protos.ApplicationPolicy (*common.SignaturePolicyEnvelope)(nil), // 1: common.SignaturePolicyEnvelope } @@ -176,7 +176,7 @@ func file_peer_policy_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_policy_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_policy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ApplicationPolicy); i { case 0: return &v.state @@ -189,7 +189,7 @@ func file_peer_policy_proto_init() { } } } - file_peer_policy_proto_msgTypes[0].OneofWrappers = []any{ + file_peer_policy_proto_msgTypes[0].OneofWrappers = []interface{}{ (*ApplicationPolicy_SignaturePolicy)(nil), (*ApplicationPolicy_ChannelConfigPolicyReference)(nil), } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal.pb.go index 4283b522028..46b7f13d844 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/proposal.proto @@ -470,7 +470,7 @@ func file_peer_proposal_proto_rawDescGZIP() []byte { } var file_peer_proposal_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_peer_proposal_proto_goTypes = []any{ +var file_peer_proposal_proto_goTypes = []interface{}{ (*SignedProposal)(nil), // 0: protos.SignedProposal (*Proposal)(nil), // 1: protos.Proposal (*ChaincodeHeaderExtension)(nil), // 2: protos.ChaincodeHeaderExtension @@ -500,7 +500,7 @@ func file_peer_proposal_proto_init() { file_peer_chaincode_proto_init() file_peer_proposal_response_proto_init() if !protoimpl.UnsafeEnabled { - file_peer_proposal_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_proposal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignedProposal); i { case 0: return &v.state @@ -512,7 +512,7 @@ func file_peer_proposal_proto_init() { return nil } } - file_peer_proposal_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_proposal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Proposal); i { case 0: return &v.state @@ -524,7 +524,7 @@ func file_peer_proposal_proto_init() { return nil } } - file_peer_proposal_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_proposal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeHeaderExtension); i { case 0: return &v.state @@ -536,7 +536,7 @@ func file_peer_proposal_proto_init() { return nil } } - file_peer_proposal_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_proposal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeProposalPayload); i { case 0: return &v.state @@ -548,7 +548,7 @@ func file_peer_proposal_proto_init() { return nil } } - file_peer_proposal_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_proposal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeAction); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal_response.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal_response.pb.go index 2ce05de86f6..5524b3e748b 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal_response.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/proposal_response.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/proposal_response.proto @@ -570,7 +570,7 @@ func file_peer_proposal_response_proto_rawDescGZIP() []byte { } var file_peer_proposal_response_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_peer_proposal_response_proto_goTypes = []any{ +var file_peer_proposal_response_proto_goTypes = []interface{}{ (*ProposalResponse)(nil), // 0: protos.ProposalResponse (*Response)(nil), // 1: protos.Response (*ProposalResponsePayload)(nil), // 2: protos.ProposalResponsePayload @@ -600,7 +600,7 @@ func file_peer_proposal_response_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_proposal_response_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_proposal_response_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ProposalResponse); i { case 0: return &v.state @@ -612,7 +612,7 @@ func file_peer_proposal_response_proto_init() { return nil } } - file_peer_proposal_response_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_proposal_response_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Response); i { case 0: return &v.state @@ -624,7 +624,7 @@ func file_peer_proposal_response_proto_init() { return nil } } - file_peer_proposal_response_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_proposal_response_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ProposalResponsePayload); i { case 0: return &v.state @@ -636,7 +636,7 @@ func file_peer_proposal_response_proto_init() { return nil } } - file_peer_proposal_response_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_proposal_response_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Endorsement); i { case 0: return &v.state @@ -648,7 +648,7 @@ func file_peer_proposal_response_proto_init() { return nil } } - file_peer_proposal_response_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_proposal_response_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeInterest); i { case 0: return &v.state @@ -660,7 +660,7 @@ func file_peer_proposal_response_proto_init() { return nil } } - file_peer_proposal_response_proto_msgTypes[5].Exporter = func(v any, i int) any { + file_peer_proposal_response_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeCall); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/query.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/query.pb.go index b17a5de8f92..3341d6e1c3a 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/query.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/query.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/query.proto @@ -401,7 +401,7 @@ func file_peer_query_proto_rawDescGZIP() []byte { } var file_peer_query_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_peer_query_proto_goTypes = []any{ +var file_peer_query_proto_goTypes = []interface{}{ (*ChaincodeQueryResponse)(nil), // 0: protos.ChaincodeQueryResponse (*ChaincodeInfo)(nil), // 1: protos.ChaincodeInfo (*ChannelQueryResponse)(nil), // 2: protos.ChannelQueryResponse @@ -424,7 +424,7 @@ func file_peer_query_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_query_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeQueryResponse); i { case 0: return &v.state @@ -436,7 +436,7 @@ func file_peer_query_proto_init() { return nil } } - file_peer_query_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeInfo); i { case 0: return &v.state @@ -448,7 +448,7 @@ func file_peer_query_proto_init() { return nil } } - file_peer_query_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChannelQueryResponse); i { case 0: return &v.state @@ -460,7 +460,7 @@ func file_peer_query_proto_init() { return nil } } - file_peer_query_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChannelInfo); i { case 0: return &v.state @@ -472,7 +472,7 @@ func file_peer_query_proto_init() { return nil } } - file_peer_query_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*JoinBySnapshotStatus); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/resources.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/resources.pb.go index 08e484b5225..e94129daa11 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/resources.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/resources.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/resources.proto @@ -356,7 +356,7 @@ func file_peer_resources_proto_rawDescGZIP() []byte { } var file_peer_resources_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_peer_resources_proto_goTypes = []any{ +var file_peer_resources_proto_goTypes = []interface{}{ (*ChaincodeIdentifier)(nil), // 0: protos.ChaincodeIdentifier (*ChaincodeValidation)(nil), // 1: protos.ChaincodeValidation (*VSCCArgs)(nil), // 2: protos.VSCCArgs @@ -380,7 +380,7 @@ func file_peer_resources_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_resources_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_resources_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeIdentifier); i { case 0: return &v.state @@ -392,7 +392,7 @@ func file_peer_resources_proto_init() { return nil } } - file_peer_resources_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_resources_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeValidation); i { case 0: return &v.state @@ -404,7 +404,7 @@ func file_peer_resources_proto_init() { return nil } } - file_peer_resources_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_resources_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VSCCArgs); i { case 0: return &v.state @@ -416,7 +416,7 @@ func file_peer_resources_proto_init() { return nil } } - file_peer_resources_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_resources_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeEndorsement); i { case 0: return &v.state @@ -428,7 +428,7 @@ func file_peer_resources_proto_init() { return nil } } - file_peer_resources_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_resources_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigTree); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/signed_cc_dep_spec.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/signed_cc_dep_spec.pb.go index e8d66b39fd0..cb6ab9ddf3b 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/signed_cc_dep_spec.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/signed_cc_dep_spec.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/signed_cc_dep_spec.proto @@ -143,7 +143,7 @@ func file_peer_signed_cc_dep_spec_proto_rawDescGZIP() []byte { } var file_peer_signed_cc_dep_spec_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_peer_signed_cc_dep_spec_proto_goTypes = []any{ +var file_peer_signed_cc_dep_spec_proto_goTypes = []interface{}{ (*SignedChaincodeDeploymentSpec)(nil), // 0: protos.SignedChaincodeDeploymentSpec (*Endorsement)(nil), // 1: protos.Endorsement } @@ -163,7 +163,7 @@ func file_peer_signed_cc_dep_spec_proto_init() { } file_peer_proposal_response_proto_init() if !protoimpl.UnsafeEnabled { - file_peer_signed_cc_dep_spec_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_signed_cc_dep_spec_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignedChaincodeDeploymentSpec); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot.pb.go index 00b52c2b40c..a80153b1bf3 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/snapshot.proto @@ -332,7 +332,7 @@ func file_peer_snapshot_proto_rawDescGZIP() []byte { } var file_peer_snapshot_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_peer_snapshot_proto_goTypes = []any{ +var file_peer_snapshot_proto_goTypes = []interface{}{ (*SnapshotRequest)(nil), // 0: protos.SnapshotRequest (*SnapshotQuery)(nil), // 1: protos.SnapshotQuery (*SignedSnapshotRequest)(nil), // 2: protos.SignedSnapshotRequest @@ -362,7 +362,7 @@ func file_peer_snapshot_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_peer_snapshot_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_snapshot_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SnapshotRequest); i { case 0: return &v.state @@ -374,7 +374,7 @@ func file_peer_snapshot_proto_init() { return nil } } - file_peer_snapshot_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_snapshot_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SnapshotQuery); i { case 0: return &v.state @@ -386,7 +386,7 @@ func file_peer_snapshot_proto_init() { return nil } } - file_peer_snapshot_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_snapshot_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignedSnapshotRequest); i { case 0: return &v.state @@ -398,7 +398,7 @@ func file_peer_snapshot_proto_init() { return nil } } - file_peer_snapshot_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_snapshot_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryPendingSnapshotsResponse); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot_grpc.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot_grpc.pb.go index f991b2f6783..466f8eedc93 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot_grpc.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/snapshot_grpc.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.3.0 // - protoc (unknown) // source: peer/snapshot.proto @@ -20,8 +20,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 const ( Snapshot_Generate_FullMethodName = "/protos.Snapshot/Generate" @@ -50,9 +50,8 @@ func NewSnapshotClient(cc grpc.ClientConnInterface) SnapshotClient { } func (c *snapshotClient) Generate(ctx context.Context, in *SignedSnapshotRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Snapshot_Generate_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Snapshot_Generate_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -60,9 +59,8 @@ func (c *snapshotClient) Generate(ctx context.Context, in *SignedSnapshotRequest } func (c *snapshotClient) Cancel(ctx context.Context, in *SignedSnapshotRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Snapshot_Cancel_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Snapshot_Cancel_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -70,9 +68,8 @@ func (c *snapshotClient) Cancel(ctx context.Context, in *SignedSnapshotRequest, } func (c *snapshotClient) QueryPendings(ctx context.Context, in *SignedSnapshotRequest, opts ...grpc.CallOption) (*QueryPendingSnapshotsResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(QueryPendingSnapshotsResponse) - err := c.cc.Invoke(ctx, Snapshot_QueryPendings_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, Snapshot_QueryPendings_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -81,7 +78,7 @@ func (c *snapshotClient) QueryPendings(ctx context.Context, in *SignedSnapshotRe // SnapshotServer is the server API for Snapshot service. // All implementations should embed UnimplementedSnapshotServer -// for forward compatibility. +// for forward compatibility type SnapshotServer interface { // Generate a snapshot reqeust. SignedSnapshotRequest contains marshalled bytes for SnaphostRequest Generate(context.Context, *SignedSnapshotRequest) (*emptypb.Empty, error) @@ -91,12 +88,9 @@ type SnapshotServer interface { QueryPendings(context.Context, *SignedSnapshotRequest) (*QueryPendingSnapshotsResponse, error) } -// UnimplementedSnapshotServer should be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedSnapshotServer struct{} +// UnimplementedSnapshotServer should be embedded to have forward compatible implementations. +type UnimplementedSnapshotServer struct { +} func (UnimplementedSnapshotServer) Generate(context.Context, *SignedSnapshotRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method Generate not implemented") @@ -107,7 +101,6 @@ func (UnimplementedSnapshotServer) Cancel(context.Context, *SignedSnapshotReques func (UnimplementedSnapshotServer) QueryPendings(context.Context, *SignedSnapshotRequest) (*QueryPendingSnapshotsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryPendings not implemented") } -func (UnimplementedSnapshotServer) testEmbeddedByValue() {} // UnsafeSnapshotServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to SnapshotServer will @@ -117,13 +110,6 @@ type UnsafeSnapshotServer interface { } func RegisterSnapshotServer(s grpc.ServiceRegistrar, srv SnapshotServer) { - // If the following call pancis, it indicates UnimplementedSnapshotServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } s.RegisterService(&Snapshot_ServiceDesc, srv) } diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/transaction.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/transaction.pb.go index 93992aaab4a..4b0ae311331 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/transaction.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/peer/transaction.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: peer/transaction.proto @@ -628,7 +628,7 @@ func file_peer_transaction_proto_rawDescGZIP() []byte { var file_peer_transaction_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_peer_transaction_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_peer_transaction_proto_goTypes = []any{ +var file_peer_transaction_proto_goTypes = []interface{}{ (TxValidationCode)(0), // 0: protos.TxValidationCode (MetaDataKeys)(0), // 1: protos.MetaDataKeys (*ProcessedTransaction)(nil), // 2: protos.ProcessedTransaction @@ -658,7 +658,7 @@ func file_peer_transaction_proto_init() { } file_peer_proposal_response_proto_init() if !protoimpl.UnsafeEnabled { - file_peer_transaction_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_peer_transaction_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ProcessedTransaction); i { case 0: return &v.state @@ -670,7 +670,7 @@ func file_peer_transaction_proto_init() { return nil } } - file_peer_transaction_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_peer_transaction_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Transaction); i { case 0: return &v.state @@ -682,7 +682,7 @@ func file_peer_transaction_proto_init() { return nil } } - file_peer_transaction_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_peer_transaction_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TransactionAction); i { case 0: return &v.state @@ -694,7 +694,7 @@ func file_peer_transaction_proto_init() { return nil } } - file_peer_transaction_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_peer_transaction_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeActionPayload); i { case 0: return &v.state @@ -706,7 +706,7 @@ func file_peer_transaction_proto_init() { return nil } } - file_peer_transaction_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_peer_transaction_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ChaincodeEndorsedAction); i { case 0: return &v.state diff --git a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/transientstore/transientstore.pb.go b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/transientstore/transientstore.pb.go index 5a3a3100933..fc793fbeeab 100644 --- a/vendor/github.com/hyperledger/fabric-protos-go-apiv2/transientstore/transientstore.pb.go +++ b/vendor/github.com/hyperledger/fabric-protos-go-apiv2/transientstore/transientstore.pb.go @@ -4,7 +4,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: transientstore/transientstore.proto @@ -153,7 +153,7 @@ func file_transientstore_transientstore_proto_rawDescGZIP() []byte { } var file_transientstore_transientstore_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_transientstore_transientstore_proto_goTypes = []any{ +var file_transientstore_transientstore_proto_goTypes = []interface{}{ (*TxPvtReadWriteSetWithConfigInfo)(nil), // 0: transientstore.TxPvtReadWriteSetWithConfigInfo nil, // 1: transientstore.TxPvtReadWriteSetWithConfigInfo.CollectionConfigsEntry (*rwset.TxPvtReadWriteSet)(nil), // 2: rwset.TxPvtReadWriteSet @@ -176,7 +176,7 @@ func file_transientstore_transientstore_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_transientstore_transientstore_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_transientstore_transientstore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TxPvtReadWriteSetWithConfigInfo); i { case 0: return &v.state diff --git a/vendor/github.com/onsi/gomega/gmeasure/cache.go b/vendor/github.com/onsi/gomega/gmeasure/cache.go new file mode 100644 index 00000000000..27fab63757a --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/cache.go @@ -0,0 +1,202 @@ +package gmeasure + +import ( + "crypto/md5" + "encoding/json" + "fmt" + "os" + "path/filepath" + + "github.com/onsi/gomega/internal/gutil" +) + +const CACHE_EXT = ".gmeasure-cache" + +/* +ExperimentCache provides a director-and-file based cache of experiments +*/ +type ExperimentCache struct { + Path string +} + +/* +NewExperimentCache creates and initializes a new cache. Path must point to a directory (if path does not exist, NewExperimentCache will create a directory at path). + +Cached Experiments are stored as separate files in the cache directory - the filename is a hash of the Experiment name. Each file contains two JSON-encoded objects - a CachedExperimentHeader that includes the experiment's name and cache version number, and then the Experiment itself. +*/ +func NewExperimentCache(path string) (ExperimentCache, error) { + stat, err := os.Stat(path) + if os.IsNotExist(err) { + err := os.MkdirAll(path, 0777) + if err != nil { + return ExperimentCache{}, err + } + } else if !stat.IsDir() { + return ExperimentCache{}, fmt.Errorf("%s is not a directory", path) + } + + return ExperimentCache{ + Path: path, + }, nil +} + +/* +CachedExperimentHeader captures the name of the Cached Experiment and its Version +*/ +type CachedExperimentHeader struct { + Name string + Version int +} + +func (cache ExperimentCache) hashOf(name string) string { + return fmt.Sprintf("%x", md5.Sum([]byte(name))) +} + +func (cache ExperimentCache) readHeader(filename string) (CachedExperimentHeader, error) { + out := CachedExperimentHeader{} + f, err := os.Open(filepath.Join(cache.Path, filename)) + if err != nil { + return out, err + } + defer f.Close() + err = json.NewDecoder(f).Decode(&out) + return out, err +} + +/* +List returns a list of all Cached Experiments found in the cache. +*/ +func (cache ExperimentCache) List() ([]CachedExperimentHeader, error) { + var out []CachedExperimentHeader + names, err := gutil.ReadDir(cache.Path) + if err != nil { + return out, err + } + for _, name := range names { + if filepath.Ext(name) != CACHE_EXT { + continue + } + header, err := cache.readHeader(name) + if err != nil { + return out, err + } + out = append(out, header) + } + return out, nil +} + +/* +Clear empties out the cache - this will delete any and all detected cache files in the cache directory. Use with caution! +*/ +func (cache ExperimentCache) Clear() error { + names, err := gutil.ReadDir(cache.Path) + if err != nil { + return err + } + for _, name := range names { + if filepath.Ext(name) != CACHE_EXT { + continue + } + err := os.Remove(filepath.Join(cache.Path, name)) + if err != nil { + return err + } + } + return nil +} + +/* +Load fetches an experiment from the cache. Lookup occurs by name. Load requires that the version numer in the cache is equal to or greater than the passed-in version. + +If an experiment with corresponding name and version >= the passed-in version is found, it is unmarshaled and returned. + +If no experiment is found, or the cached version is smaller than the passed-in version, Load will return nil. + +When paired with Ginkgo you can cache experiments and prevent potentially expensive recomputation with this pattern: + + const EXPERIMENT_VERSION = 1 //bump this to bust the cache and recompute _all_ experiments + + Describe("some experiments", func() { + var cache gmeasure.ExperimentCache + var experiment *gmeasure.Experiment + + BeforeEach(func() { + cache = gmeasure.NewExperimentCache("./gmeasure-cache") + name := CurrentSpecReport().LeafNodeText + experiment = cache.Load(name, EXPERIMENT_VERSION) + if experiment != nil { + AddReportEntry(experiment) + Skip("cached") + } + experiment = gmeasure.NewExperiment(name) + AddReportEntry(experiment) + }) + + It("foo runtime", func() { + experiment.SampleDuration("runtime", func() { + //do stuff + }, gmeasure.SamplingConfig{N:100}) + }) + + It("bar runtime", func() { + experiment.SampleDuration("runtime", func() { + //do stuff + }, gmeasure.SamplingConfig{N:100}) + }) + + AfterEach(func() { + if !CurrentSpecReport().State.Is(types.SpecStateSkipped) { + cache.Save(experiment.Name, EXPERIMENT_VERSION, experiment) + } + }) + }) +*/ +func (cache ExperimentCache) Load(name string, version int) *Experiment { + path := filepath.Join(cache.Path, cache.hashOf(name)+CACHE_EXT) + f, err := os.Open(path) + if err != nil { + return nil + } + defer f.Close() + dec := json.NewDecoder(f) + header := CachedExperimentHeader{} + dec.Decode(&header) + if header.Version < version { + return nil + } + out := NewExperiment("") + err = dec.Decode(out) + if err != nil { + return nil + } + return out +} + +/* +Save stores the passed-in experiment to the cache with the passed-in name and version. +*/ +func (cache ExperimentCache) Save(name string, version int, experiment *Experiment) error { + path := filepath.Join(cache.Path, cache.hashOf(name)+CACHE_EXT) + f, err := os.Create(path) + if err != nil { + return err + } + defer f.Close() + enc := json.NewEncoder(f) + err = enc.Encode(CachedExperimentHeader{ + Name: name, + Version: version, + }) + if err != nil { + return err + } + return enc.Encode(experiment) +} + +/* +Delete removes the experiment with the passed-in name from the cache +*/ +func (cache ExperimentCache) Delete(name string) error { + path := filepath.Join(cache.Path, cache.hashOf(name)+CACHE_EXT) + return os.Remove(path) +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/enum_support.go b/vendor/github.com/onsi/gomega/gmeasure/enum_support.go new file mode 100644 index 00000000000..b5404f96200 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/enum_support.go @@ -0,0 +1,43 @@ +package gmeasure + +import "encoding/json" + +type enumSupport struct { + toString map[uint]string + toEnum map[string]uint + maxEnum uint +} + +func newEnumSupport(toString map[uint]string) enumSupport { + toEnum, maxEnum := map[string]uint{}, uint(0) + for k, v := range toString { + toEnum[v] = k + if maxEnum < k { + maxEnum = k + } + } + return enumSupport{toString: toString, toEnum: toEnum, maxEnum: maxEnum} +} + +func (es enumSupport) String(e uint) string { + if e > es.maxEnum { + return es.toString[0] + } + return es.toString[e] +} + +func (es enumSupport) UnmarshJSON(b []byte) (uint, error) { + var dec string + if err := json.Unmarshal(b, &dec); err != nil { + return 0, err + } + out := es.toEnum[dec] // if we miss we get 0 which is what we want anyway + return out, nil +} + +func (es enumSupport) MarshJSON(e uint) ([]byte, error) { + if e == 0 || e > es.maxEnum { + return json.Marshal(nil) + } + return json.Marshal(es.toString[e]) +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/experiment.go b/vendor/github.com/onsi/gomega/gmeasure/experiment.go new file mode 100644 index 00000000000..a8341c5e662 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/experiment.go @@ -0,0 +1,527 @@ +/* +Package gomega/gmeasure provides support for benchmarking and measuring code. It is intended as a more robust replacement for Ginkgo V1's Measure nodes. + +gmeasure is organized around the metaphor of an Experiment that can record multiple Measurements. A Measurement is a named collection of data points and gmeasure supports +measuring Values (of type float64) and Durations (of type time.Duration). + +Experiments allows the user to record Measurements directly by passing in Values (i.e. float64) or Durations (i.e. time.Duration) +or to measure measurements by passing in functions to measure. When measuring functions Experiments take care of timing the duration of functions (for Duration measurements) +and/or recording returned values (for Value measurements). Experiments also support sampling functions - when told to sample Experiments will run functions repeatedly +and measure and record results. The sampling behavior is configured by passing in a SamplingConfig that can control the maximum number of samples, the maximum duration for sampling (or both) +and the number of concurrent samples to take. + +Measurements can be decorated with additional information. This is supported by passing in special typed decorators when recording measurements. These include: + +- Units("any string") - to attach units to a Value Measurement (Duration Measurements always have units of "duration") +- Style("any Ginkgo color style string") - to attach styling to a Measurement. This styling is used when rendering console information about the measurement in reports. Color style strings are documented at TODO. +- Precision(integer or time.Duration) - to attach precision to a Measurement. This controls how many decimal places to show for Value Measurements and how to round Duration Measurements when rendering them to screen. + +In addition, individual data points in a Measurement can be annotated with an Annotation("any string"). The annotation is associated with the individual data point and is intended to convey additional context about the data point. + +Once measurements are complete, an Experiment can generate a comprehensive report by calling its String() or ColorableString() method. + +Users can also access and analyze the resulting Measurements directly. Use Experiment.Get(NAME) to fetch the Measurement named NAME. This returned struct will have fields containing +all the data points and annotations recorded by the experiment. You can subsequently fetch the Measurement.Stats() to get a Stats struct that contains basic statistical information about the +Measurement (min, max, median, mean, standard deviation). You can order these Stats objects using RankStats() to identify best/worst performers across multpile experiments or measurements. + +gmeasure also supports caching Experiments via an ExperimentCache. The cache supports storing and retreiving experiments by name and version. This allows you to rerun code without +repeating expensive experiments that may not have changed (which can be controlled by the cache version number). It also enables you to compare new experiment runs with older runs to detect +variations in performance/behavior. + +When used with Ginkgo, you can emit experiment reports and encode them in test reports easily using Ginkgo V2's support for Report Entries. +Simply pass your experiment to AddReportEntry to get a report every time the tests run. You can also use AddReportEntry with Measurements to emit all the captured data +and Rankings to emit measurement summaries in rank order. + +Finally, Experiments provide an additional mechanism to measure durations called a Stopwatch. The Stopwatch makes it easy to pepper code with statements that measure elapsed time across +different sections of code and can be useful when debugging or evaluating bottlenecks in a given codepath. +*/ +package gmeasure + +import ( + "fmt" + "math" + "reflect" + "sync" + "time" + + "github.com/onsi/gomega/gmeasure/table" +) + +/* +SamplingConfig configures the Sample family of experiment methods. +These methods invoke passed-in functions repeatedly to sample and record a given measurement. +SamplingConfig is used to control the maximum number of samples or time spent sampling (or both). When both are specified sampling ends as soon as one of the conditions is met. +SamplingConfig can also ensure a minimum interval between samples and can enable concurrent sampling. +*/ +type SamplingConfig struct { + // N - the maximum number of samples to record + N int + // Duration - the maximum amount of time to spend recording samples + Duration time.Duration + // MinSamplingInterval - the minimum time that must elapse between samplings. It is an error to specify both MinSamplingInterval and NumParallel. + MinSamplingInterval time.Duration + // NumParallel - the number of parallel workers to spin up to record samples. It is an error to specify both MinSamplingInterval and NumParallel. + NumParallel int +} + +// The Units decorator allows you to specify units (an arbitrary string) when recording values. It is ignored when recording durations. +// +// e := gmeasure.NewExperiment("My Experiment") +// e.RecordValue("length", 3.141, gmeasure.Units("inches")) +// +// Units are only set the first time a value of a given name is recorded. In the example above any subsequent calls to e.RecordValue("length", X) will maintain the "inches" units even if a new set of Units("UNIT") are passed in later. +type Units string + +// The Annotation decorator allows you to attach an annotation to a given recorded data-point: +// +// For example: +// +// e := gmeasure.NewExperiment("My Experiment") +// e.RecordValue("length", 3.141, gmeasure.Annotation("bob")) +// e.RecordValue("length", 2.71, gmeasure.Annotation("jane")) +// +// ...will result in a Measurement named "length" that records two values )[3.141, 2.71]) annotation with (["bob", "jane"]) +type Annotation string + +// The Style decorator allows you to associate a style with a measurement. This is used to generate colorful console reports using Ginkgo V2's +// console formatter. Styles are strings in curly brackets that correspond to a color or style. +// +// For example: +// +// e := gmeasure.NewExperiment("My Experiment") +// e.RecordValue("length", 3.141, gmeasure.Style("{{blue}}{{bold}}")) +// e.RecordValue("length", 2.71) +// e.RecordDuration("cooking time", 3 * time.Second, gmeasure.Style("{{red}}{{underline}}")) +// e.RecordDuration("cooking time", 2 * time.Second) +// +// will emit a report with blue bold entries for the length measurement and red underlined entries for the cooking time measurement. +// +// Units are only set the first time a value or duration of a given name is recorded. In the example above any subsequent calls to e.RecordValue("length", X) will maintain the "{{blue}}{{bold}}" style even if a new Style is passed in later. +type Style string + +// The PrecisionBundle decorator controls the rounding of value and duration measurements. See Precision(). +type PrecisionBundle struct { + Duration time.Duration + ValueFormat string +} + +// Precision() allows you to specify the precision of a value or duration measurement - this precision is used when rendering the measurement to screen. +// +// To control the precision of Value measurements, pass Precision an integer. This will denote the number of decimal places to render (equivalen to the format string "%.Nf") +// To control the precision of Duration measurements, pass Precision a time.Duration. Duration measurements will be rounded oo the nearest time.Duration when rendered. +// +// For example: +// +// e := gmeasure.NewExperiment("My Experiment") +// e.RecordValue("length", 3.141, gmeasure.Precision(2)) +// e.RecordValue("length", 2.71) +// e.RecordDuration("cooking time", 3214 * time.Millisecond, gmeasure.Precision(100*time.Millisecond)) +// e.RecordDuration("cooking time", 2623 * time.Millisecond) +func Precision(p interface{}) PrecisionBundle { + out := DefaultPrecisionBundle + switch reflect.TypeOf(p) { + case reflect.TypeOf(time.Duration(0)): + out.Duration = p.(time.Duration) + case reflect.TypeOf(int(0)): + out.ValueFormat = fmt.Sprintf("%%.%df", p.(int)) + default: + panic("invalid precision type, must be time.Duration or int") + } + return out +} + +// DefaultPrecisionBundle captures the default precisions for Vale and Duration measurements. +var DefaultPrecisionBundle = PrecisionBundle{ + Duration: 100 * time.Microsecond, + ValueFormat: "%.3f", +} + +type extractedDecorations struct { + annotation Annotation + units Units + precisionBundle PrecisionBundle + style Style +} + +func extractDecorations(args []interface{}) extractedDecorations { + var out extractedDecorations + out.precisionBundle = DefaultPrecisionBundle + + for _, arg := range args { + switch reflect.TypeOf(arg) { + case reflect.TypeOf(out.annotation): + out.annotation = arg.(Annotation) + case reflect.TypeOf(out.units): + out.units = arg.(Units) + case reflect.TypeOf(out.precisionBundle): + out.precisionBundle = arg.(PrecisionBundle) + case reflect.TypeOf(out.style): + out.style = arg.(Style) + default: + panic(fmt.Sprintf("unrecognized argument %#v", arg)) + } + } + + return out +} + +/* +Experiment is gmeasure's core data type. You use experiments to record Measurements and generate reports. +Experiments are thread-safe and all methods can be called from multiple goroutines. +*/ +type Experiment struct { + Name string + + // Measurements includes all Measurements recorded by this experiment. You should access them by name via Get() and GetStats() + Measurements Measurements + lock *sync.Mutex +} + +/* +NexExperiment creates a new experiment with the passed-in name. + +When using Ginkgo we recommend immediately registering the experiment as a ReportEntry: + + experiment = NewExperiment("My Experiment") + AddReportEntry(experiment.Name, experiment) + +this will ensure an experiment report is emitted as part of the test output and exported with any test reports. +*/ +func NewExperiment(name string) *Experiment { + experiment := &Experiment{ + Name: name, + lock: &sync.Mutex{}, + } + return experiment +} + +func (e *Experiment) report(enableStyling bool) string { + t := table.NewTable() + t.TableStyle.EnableTextStyling = enableStyling + t.AppendRow(table.R( + table.C("Name"), table.C("N"), table.C("Min"), table.C("Median"), table.C("Mean"), table.C("StdDev"), table.C("Max"), + table.Divider("="), + "{{bold}}", + )) + + for _, measurement := range e.Measurements { + r := table.R(measurement.Style) + t.AppendRow(r) + switch measurement.Type { + case MeasurementTypeNote: + r.AppendCell(table.C(measurement.Note)) + case MeasurementTypeValue, MeasurementTypeDuration: + name := measurement.Name + if measurement.Units != "" { + name += " [" + measurement.Units + "]" + } + r.AppendCell(table.C(name)) + r.AppendCell(measurement.Stats().cells()...) + } + } + + out := e.Name + "\n" + if enableStyling { + out = "{{bold}}" + out + "{{/}}" + } + out += t.Render() + return out +} + +/* +ColorableString returns a Ginkgo formatted summary of the experiment and all its Measurements. +It is called automatically by Ginkgo's reporting infrastructure when the Experiment is registered as a ReportEntry via AddReportEntry. +*/ +func (e *Experiment) ColorableString() string { + return e.report(true) +} + +/* +ColorableString returns an unformatted summary of the experiment and all its Measurements. +*/ +func (e *Experiment) String() string { + return e.report(false) +} + +/* +RecordNote records a Measurement of type MeasurementTypeNote - this is simply a textual note to annotate the experiment. It will be emitted in any experiment reports. + +RecordNote supports the Style() decoration. +*/ +func (e *Experiment) RecordNote(note string, args ...interface{}) { + decorations := extractDecorations(args) + + e.lock.Lock() + defer e.lock.Unlock() + e.Measurements = append(e.Measurements, Measurement{ + ExperimentName: e.Name, + Type: MeasurementTypeNote, + Note: note, + Style: string(decorations.style), + }) +} + +/* +RecordDuration records the passed-in duration on a Duration Measurement with the passed-in name. If the Measurement does not exist it is created. + +RecordDuration supports the Style(), Precision(), and Annotation() decorations. +*/ +func (e *Experiment) RecordDuration(name string, duration time.Duration, args ...interface{}) { + decorations := extractDecorations(args) + e.recordDuration(name, duration, decorations) +} + +/* +MeasureDuration runs the passed-in callback and times how long it takes to complete. The resulting duration is recorded on a Duration Measurement with the passed-in name. If the Measurement does not exist it is created. + +MeasureDuration supports the Style(), Precision(), and Annotation() decorations. +*/ +func (e *Experiment) MeasureDuration(name string, callback func(), args ...interface{}) time.Duration { + t := time.Now() + callback() + duration := time.Since(t) + e.RecordDuration(name, duration, args...) + return duration +} + +/* +SampleDuration samples the passed-in callback and times how long it takes to complete each sample. +The resulting durations are recorded on a Duration Measurement with the passed-in name. If the Measurement does not exist it is created. + +The callback is given a zero-based index that increments by one between samples. The Sampling is configured via the passed-in SamplingConfig + +SampleDuration supports the Style(), Precision(), and Annotation() decorations. When passed an Annotation() the same annotation is applied to all sample measurements. +*/ +func (e *Experiment) SampleDuration(name string, callback func(idx int), samplingConfig SamplingConfig, args ...interface{}) { + decorations := extractDecorations(args) + e.Sample(func(idx int) { + t := time.Now() + callback(idx) + duration := time.Since(t) + e.recordDuration(name, duration, decorations) + }, samplingConfig) +} + +/* +SampleDuration samples the passed-in callback and times how long it takes to complete each sample. +The resulting durations are recorded on a Duration Measurement with the passed-in name. If the Measurement does not exist it is created. + +The callback is given a zero-based index that increments by one between samples. The callback must return an Annotation - this annotation is attached to the measured duration. + +The Sampling is configured via the passed-in SamplingConfig + +SampleAnnotatedDuration supports the Style() and Precision() decorations. +*/ +func (e *Experiment) SampleAnnotatedDuration(name string, callback func(idx int) Annotation, samplingConfig SamplingConfig, args ...interface{}) { + decorations := extractDecorations(args) + e.Sample(func(idx int) { + t := time.Now() + decorations.annotation = callback(idx) + duration := time.Since(t) + e.recordDuration(name, duration, decorations) + }, samplingConfig) +} + +func (e *Experiment) recordDuration(name string, duration time.Duration, decorations extractedDecorations) { + e.lock.Lock() + defer e.lock.Unlock() + idx := e.Measurements.IdxWithName(name) + if idx == -1 { + measurement := Measurement{ + ExperimentName: e.Name, + Type: MeasurementTypeDuration, + Name: name, + Units: "duration", + Durations: []time.Duration{duration}, + PrecisionBundle: decorations.precisionBundle, + Style: string(decorations.style), + Annotations: []string{string(decorations.annotation)}, + } + e.Measurements = append(e.Measurements, measurement) + } else { + if e.Measurements[idx].Type != MeasurementTypeDuration { + panic(fmt.Sprintf("attempting to record duration with name '%s'. That name is already in-use for recording values.", name)) + } + e.Measurements[idx].Durations = append(e.Measurements[idx].Durations, duration) + e.Measurements[idx].Annotations = append(e.Measurements[idx].Annotations, string(decorations.annotation)) + } +} + +/* +NewStopwatch() returns a stopwatch configured to record duration measurements with this experiment. +*/ +func (e *Experiment) NewStopwatch() *Stopwatch { + return newStopwatch(e) +} + +/* +RecordValue records the passed-in value on a Value Measurement with the passed-in name. If the Measurement does not exist it is created. + +RecordValue supports the Style(), Units(), Precision(), and Annotation() decorations. +*/ +func (e *Experiment) RecordValue(name string, value float64, args ...interface{}) { + decorations := extractDecorations(args) + e.recordValue(name, value, decorations) +} + +/* +MeasureValue runs the passed-in callback and records the return value on a Value Measurement with the passed-in name. If the Measurement does not exist it is created. + +MeasureValue supports the Style(), Units(), Precision(), and Annotation() decorations. +*/ +func (e *Experiment) MeasureValue(name string, callback func() float64, args ...interface{}) float64 { + value := callback() + e.RecordValue(name, value, args...) + return value +} + +/* +SampleValue samples the passed-in callback and records the return value on a Value Measurement with the passed-in name. If the Measurement does not exist it is created. + +The callback is given a zero-based index that increments by one between samples. The callback must return a float64. The Sampling is configured via the passed-in SamplingConfig + +SampleValue supports the Style(), Units(), Precision(), and Annotation() decorations. When passed an Annotation() the same annotation is applied to all sample measurements. +*/ +func (e *Experiment) SampleValue(name string, callback func(idx int) float64, samplingConfig SamplingConfig, args ...interface{}) { + decorations := extractDecorations(args) + e.Sample(func(idx int) { + value := callback(idx) + e.recordValue(name, value, decorations) + }, samplingConfig) +} + +/* +SampleAnnotatedValue samples the passed-in callback and records the return value on a Value Measurement with the passed-in name. If the Measurement does not exist it is created. + +The callback is given a zero-based index that increments by one between samples. The callback must return a float64 and an Annotation - the annotation is attached to the recorded value. + +The Sampling is configured via the passed-in SamplingConfig + +SampleValue supports the Style(), Units(), and Precision() decorations. +*/ +func (e *Experiment) SampleAnnotatedValue(name string, callback func(idx int) (float64, Annotation), samplingConfig SamplingConfig, args ...interface{}) { + decorations := extractDecorations(args) + e.Sample(func(idx int) { + var value float64 + value, decorations.annotation = callback(idx) + e.recordValue(name, value, decorations) + }, samplingConfig) +} + +func (e *Experiment) recordValue(name string, value float64, decorations extractedDecorations) { + e.lock.Lock() + defer e.lock.Unlock() + idx := e.Measurements.IdxWithName(name) + if idx == -1 { + measurement := Measurement{ + ExperimentName: e.Name, + Type: MeasurementTypeValue, + Name: name, + Style: string(decorations.style), + Units: string(decorations.units), + PrecisionBundle: decorations.precisionBundle, + Values: []float64{value}, + Annotations: []string{string(decorations.annotation)}, + } + e.Measurements = append(e.Measurements, measurement) + } else { + if e.Measurements[idx].Type != MeasurementTypeValue { + panic(fmt.Sprintf("attempting to record value with name '%s'. That name is already in-use for recording durations.", name)) + } + e.Measurements[idx].Values = append(e.Measurements[idx].Values, value) + e.Measurements[idx].Annotations = append(e.Measurements[idx].Annotations, string(decorations.annotation)) + } +} + +/* +Sample samples the passed-in callback repeatedly. The sampling is governed by the passed in SamplingConfig. + +The SamplingConfig can limit the total number of samples and/or the total time spent sampling the callback. +The SamplingConfig can also instruct Sample to run with multiple concurrent workers. + +The callback is called with a zero-based index that incerements by one between samples. +*/ +func (e *Experiment) Sample(callback func(idx int), samplingConfig SamplingConfig) { + if samplingConfig.N == 0 && samplingConfig.Duration == 0 { + panic("you must specify at least one of SamplingConfig.N and SamplingConfig.Duration") + } + if samplingConfig.MinSamplingInterval > 0 && samplingConfig.NumParallel > 1 { + panic("you cannot specify both SamplingConfig.MinSamplingInterval and SamplingConfig.NumParallel") + } + maxTime := time.Now().Add(100000 * time.Hour) + if samplingConfig.Duration > 0 { + maxTime = time.Now().Add(samplingConfig.Duration) + } + maxN := math.MaxInt32 + if samplingConfig.N > 0 { + maxN = samplingConfig.N + } + numParallel := 1 + if samplingConfig.NumParallel > numParallel { + numParallel = samplingConfig.NumParallel + } + minSamplingInterval := samplingConfig.MinSamplingInterval + + work := make(chan int) + defer close(work) + if numParallel > 1 { + for worker := 0; worker < numParallel; worker++ { + go func() { + for idx := range work { + callback(idx) + } + }() + } + } + + idx := 0 + var avgDt time.Duration + for { + t := time.Now() + if numParallel > 1 { + work <- idx + } else { + callback(idx) + } + dt := time.Since(t) + if numParallel == 1 && dt < minSamplingInterval { + time.Sleep(minSamplingInterval - dt) + dt = time.Since(t) + } + if idx >= numParallel { + avgDt = (avgDt*time.Duration(idx-numParallel) + dt) / time.Duration(idx-numParallel+1) + } + idx += 1 + if idx >= maxN { + return + } + if time.Now().Add(avgDt).After(maxTime) { + return + } + } +} + +/* +Get returns the Measurement with the associated name. If no Measurement is found a zero Measurement{} is returned. +*/ +func (e *Experiment) Get(name string) Measurement { + e.lock.Lock() + defer e.lock.Unlock() + idx := e.Measurements.IdxWithName(name) + if idx == -1 { + return Measurement{} + } + return e.Measurements[idx] +} + +/* +GetStats returns the Stats for the Measurement with the associated name. If no Measurement is found a zero Stats{} is returned. + +experiment.GetStats(name) is equivalent to experiment.Get(name).Stats() +*/ +func (e *Experiment) GetStats(name string) Stats { + measurement := e.Get(name) + e.lock.Lock() + defer e.lock.Unlock() + return measurement.Stats() +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/measurement.go b/vendor/github.com/onsi/gomega/gmeasure/measurement.go new file mode 100644 index 00000000000..103d3ea9d06 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/measurement.go @@ -0,0 +1,235 @@ +package gmeasure + +import ( + "fmt" + "math" + "sort" + "time" + + "github.com/onsi/gomega/gmeasure/table" +) + +type MeasurementType uint + +const ( + MeasurementTypeInvalid MeasurementType = iota + MeasurementTypeNote + MeasurementTypeDuration + MeasurementTypeValue +) + +var letEnumSupport = newEnumSupport(map[uint]string{uint(MeasurementTypeInvalid): "INVALID LOG ENTRY TYPE", uint(MeasurementTypeNote): "Note", uint(MeasurementTypeDuration): "Duration", uint(MeasurementTypeValue): "Value"}) + +func (s MeasurementType) String() string { return letEnumSupport.String(uint(s)) } +func (s *MeasurementType) UnmarshalJSON(b []byte) error { + out, err := letEnumSupport.UnmarshJSON(b) + *s = MeasurementType(out) + return err +} +func (s MeasurementType) MarshalJSON() ([]byte, error) { return letEnumSupport.MarshJSON(uint(s)) } + +/* +Measurement records all captured data for a given measurement. You generally don't make Measurements directly - but you can fetch them from Experiments using Get(). + +When using Ginkgo, you can register Measurements as Report Entries via AddReportEntry. This will emit all the captured data points when Ginkgo generates the report. +*/ +type Measurement struct { + // Type is the MeasurementType - one of MeasurementTypeNote, MeasurementTypeDuration, or MeasurementTypeValue + Type MeasurementType + + // ExperimentName is the name of the experiment that this Measurement is associated with + ExperimentName string + + // If Type is MeasurementTypeNote, Note is populated with the note text. + Note string + + // If Type is MeasurementTypeDuration or MeasurementTypeValue, Name is the name of the recorded measurement + Name string + + // Style captures the styling information (if any) for this Measurement + Style string + + // Units capture the units (if any) for this Measurement. Units is set to "duration" if the Type is MeasurementTypeDuration + Units string + + // PrecisionBundle captures the precision to use when rendering data for this Measurement. + // If Type is MeasurementTypeDuration then PrecisionBundle.Duration is used to round any durations before presentation. + // If Type is MeasurementTypeValue then PrecisionBundle.ValueFormat is used to format any values before presentation + PrecisionBundle PrecisionBundle + + // If Type is MeasurementTypeDuration, Durations will contain all durations recorded for this measurement + Durations []time.Duration + + // If Type is MeasurementTypeValue, Values will contain all float64s recorded for this measurement + Values []float64 + + // If Type is MeasurementTypeDuration or MeasurementTypeValue then Annotations will include string annotations for all recorded Durations or Values. + // If the user does not pass-in an Annotation() decoration for a particular value or duration, the corresponding entry in the Annotations slice will be the empty string "" + Annotations []string +} + +type Measurements []Measurement + +func (m Measurements) IdxWithName(name string) int { + for idx, measurement := range m { + if measurement.Name == name { + return idx + } + } + + return -1 +} + +func (m Measurement) report(enableStyling bool) string { + out := "" + style := m.Style + if !enableStyling { + style = "" + } + switch m.Type { + case MeasurementTypeNote: + out += fmt.Sprintf("%s - Note\n%s\n", m.ExperimentName, m.Note) + if style != "" { + out = style + out + "{{/}}" + } + return out + case MeasurementTypeValue, MeasurementTypeDuration: + out += fmt.Sprintf("%s - %s", m.ExperimentName, m.Name) + if m.Units != "" { + out += " [" + m.Units + "]" + } + if style != "" { + out = style + out + "{{/}}" + } + out += "\n" + out += m.Stats().String() + "\n" + } + t := table.NewTable() + t.TableStyle.EnableTextStyling = enableStyling + switch m.Type { + case MeasurementTypeValue: + t.AppendRow(table.R(table.C("Value", table.AlignTypeCenter), table.C("Annotation", table.AlignTypeCenter), table.Divider("="), style)) + for idx := range m.Values { + t.AppendRow(table.R( + table.C(fmt.Sprintf(m.PrecisionBundle.ValueFormat, m.Values[idx]), table.AlignTypeRight), + table.C(m.Annotations[idx], "{{gray}}", table.AlignTypeLeft), + )) + } + case MeasurementTypeDuration: + t.AppendRow(table.R(table.C("Duration", table.AlignTypeCenter), table.C("Annotation", table.AlignTypeCenter), table.Divider("="), style)) + for idx := range m.Durations { + t.AppendRow(table.R( + table.C(m.Durations[idx].Round(m.PrecisionBundle.Duration).String(), style, table.AlignTypeRight), + table.C(m.Annotations[idx], "{{gray}}", table.AlignTypeLeft), + )) + } + } + out += t.Render() + return out +} + +/* +ColorableString generates a styled report that includes all the data points for this Measurement. +It is called automatically by Ginkgo's reporting infrastructure when the Measurement is registered as a ReportEntry via AddReportEntry. +*/ +func (m Measurement) ColorableString() string { + return m.report(true) +} + +/* +String generates an unstyled report that includes all the data points for this Measurement. +*/ +func (m Measurement) String() string { + return m.report(false) +} + +/* +Stats returns a Stats struct summarizing the statistic of this measurement +*/ +func (m Measurement) Stats() Stats { + if m.Type == MeasurementTypeInvalid || m.Type == MeasurementTypeNote { + return Stats{} + } + + out := Stats{ + ExperimentName: m.ExperimentName, + MeasurementName: m.Name, + Style: m.Style, + Units: m.Units, + PrecisionBundle: m.PrecisionBundle, + } + + switch m.Type { + case MeasurementTypeValue: + out.Type = StatsTypeValue + out.N = len(m.Values) + if out.N == 0 { + return out + } + indices, sum := make([]int, len(m.Values)), 0.0 + for idx, v := range m.Values { + indices[idx] = idx + sum += v + } + sort.Slice(indices, func(i, j int) bool { + return m.Values[indices[i]] < m.Values[indices[j]] + }) + out.ValueBundle = map[Stat]float64{ + StatMin: m.Values[indices[0]], + StatMax: m.Values[indices[out.N-1]], + StatMean: sum / float64(out.N), + StatStdDev: 0.0, + } + out.AnnotationBundle = map[Stat]string{ + StatMin: m.Annotations[indices[0]], + StatMax: m.Annotations[indices[out.N-1]], + } + + if out.N%2 == 0 { + out.ValueBundle[StatMedian] = (m.Values[indices[out.N/2]] + m.Values[indices[out.N/2-1]]) / 2.0 + } else { + out.ValueBundle[StatMedian] = m.Values[indices[(out.N-1)/2]] + } + + for _, v := range m.Values { + out.ValueBundle[StatStdDev] += (v - out.ValueBundle[StatMean]) * (v - out.ValueBundle[StatMean]) + } + out.ValueBundle[StatStdDev] = math.Sqrt(out.ValueBundle[StatStdDev] / float64(out.N)) + case MeasurementTypeDuration: + out.Type = StatsTypeDuration + out.N = len(m.Durations) + if out.N == 0 { + return out + } + indices, sum := make([]int, len(m.Durations)), time.Duration(0) + for idx, v := range m.Durations { + indices[idx] = idx + sum += v + } + sort.Slice(indices, func(i, j int) bool { + return m.Durations[indices[i]] < m.Durations[indices[j]] + }) + out.DurationBundle = map[Stat]time.Duration{ + StatMin: m.Durations[indices[0]], + StatMax: m.Durations[indices[out.N-1]], + StatMean: sum / time.Duration(out.N), + } + out.AnnotationBundle = map[Stat]string{ + StatMin: m.Annotations[indices[0]], + StatMax: m.Annotations[indices[out.N-1]], + } + + if out.N%2 == 0 { + out.DurationBundle[StatMedian] = (m.Durations[indices[out.N/2]] + m.Durations[indices[out.N/2-1]]) / 2 + } else { + out.DurationBundle[StatMedian] = m.Durations[indices[(out.N-1)/2]] + } + stdDev := 0.0 + for _, v := range m.Durations { + stdDev += float64(v-out.DurationBundle[StatMean]) * float64(v-out.DurationBundle[StatMean]) + } + out.DurationBundle[StatStdDev] = time.Duration(math.Sqrt(stdDev / float64(out.N))) + } + + return out +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/rank.go b/vendor/github.com/onsi/gomega/gmeasure/rank.go new file mode 100644 index 00000000000..1544cd8f4de --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/rank.go @@ -0,0 +1,141 @@ +package gmeasure + +import ( + "fmt" + "sort" + + "github.com/onsi/gomega/gmeasure/table" +) + +/* +RankingCriteria is an enum representing the criteria by which Stats should be ranked. The enum names should be self explanatory. e.g. LowerMeanIsBetter means that Stats with lower mean values are considered more beneficial, with the lowest mean being declared the "winner" . +*/ +type RankingCriteria uint + +const ( + LowerMeanIsBetter RankingCriteria = iota + HigherMeanIsBetter + LowerMedianIsBetter + HigherMedianIsBetter + LowerMinIsBetter + HigherMinIsBetter + LowerMaxIsBetter + HigherMaxIsBetter +) + +var rcEnumSupport = newEnumSupport(map[uint]string{uint(LowerMeanIsBetter): "Lower Mean is Better", uint(HigherMeanIsBetter): "Higher Mean is Better", uint(LowerMedianIsBetter): "Lower Median is Better", uint(HigherMedianIsBetter): "Higher Median is Better", uint(LowerMinIsBetter): "Lower Mins is Better", uint(HigherMinIsBetter): "Higher Min is Better", uint(LowerMaxIsBetter): "Lower Max is Better", uint(HigherMaxIsBetter): "Higher Max is Better"}) + +func (s RankingCriteria) String() string { return rcEnumSupport.String(uint(s)) } +func (s *RankingCriteria) UnmarshalJSON(b []byte) error { + out, err := rcEnumSupport.UnmarshJSON(b) + *s = RankingCriteria(out) + return err +} +func (s RankingCriteria) MarshalJSON() ([]byte, error) { return rcEnumSupport.MarshJSON(uint(s)) } + +/* +Ranking ranks a set of Stats by a specified RankingCritera. Use RankStats to create a Ranking. + +When using Ginkgo, you can register Rankings as Report Entries via AddReportEntry. This will emit a formatted table representing the Stats in rank-order when Ginkgo generates the report. +*/ +type Ranking struct { + Criteria RankingCriteria + Stats []Stats +} + +/* +RankStats creates a new ranking of the passed-in stats according to the passed-in criteria. +*/ +func RankStats(criteria RankingCriteria, stats ...Stats) Ranking { + sort.Slice(stats, func(i int, j int) bool { + switch criteria { + case LowerMeanIsBetter: + return stats[i].FloatFor(StatMean) < stats[j].FloatFor(StatMean) + case HigherMeanIsBetter: + return stats[i].FloatFor(StatMean) > stats[j].FloatFor(StatMean) + case LowerMedianIsBetter: + return stats[i].FloatFor(StatMedian) < stats[j].FloatFor(StatMedian) + case HigherMedianIsBetter: + return stats[i].FloatFor(StatMedian) > stats[j].FloatFor(StatMedian) + case LowerMinIsBetter: + return stats[i].FloatFor(StatMin) < stats[j].FloatFor(StatMin) + case HigherMinIsBetter: + return stats[i].FloatFor(StatMin) > stats[j].FloatFor(StatMin) + case LowerMaxIsBetter: + return stats[i].FloatFor(StatMax) < stats[j].FloatFor(StatMax) + case HigherMaxIsBetter: + return stats[i].FloatFor(StatMax) > stats[j].FloatFor(StatMax) + } + return false + }) + + out := Ranking{ + Criteria: criteria, + Stats: stats, + } + + return out +} + +/* +Winner returns the Stats with the most optimal rank based on the specified ranking criteria. For example, if the RankingCriteria is LowerMaxIsBetter then the Stats with the lowest value or duration for StatMax will be returned as the "winner" +*/ +func (c Ranking) Winner() Stats { + if len(c.Stats) == 0 { + return Stats{} + } + return c.Stats[0] +} + +func (c Ranking) report(enableStyling bool) string { + if len(c.Stats) == 0 { + return "Empty Ranking" + } + t := table.NewTable() + t.TableStyle.EnableTextStyling = enableStyling + t.AppendRow(table.R( + table.C("Experiment"), table.C("Name"), table.C("N"), table.C("Min"), table.C("Median"), table.C("Mean"), table.C("StdDev"), table.C("Max"), + table.Divider("="), + "{{bold}}", + )) + + for idx, stats := range c.Stats { + name := stats.MeasurementName + if stats.Units != "" { + name = name + " [" + stats.Units + "]" + } + experimentName := stats.ExperimentName + style := stats.Style + if idx == 0 { + style = "{{bold}}" + style + name += "\n*Winner*" + experimentName += "\n*Winner*" + } + r := table.R(style) + t.AppendRow(r) + r.AppendCell(table.C(experimentName), table.C(name)) + r.AppendCell(stats.cells()...) + + } + out := fmt.Sprintf("Ranking Criteria: %s\n", c.Criteria) + if enableStyling { + out = "{{bold}}" + out + "{{/}}" + } + out += t.Render() + return out +} + +/* +ColorableString generates a styled report that includes a table of the rank-ordered Stats +It is called automatically by Ginkgo's reporting infrastructure when the Ranking is registered as a ReportEntry via AddReportEntry. +*/ +func (c Ranking) ColorableString() string { + return c.report(true) +} + +/* +String generates an unstyled report that includes a table of the rank-ordered Stats +*/ +func (c Ranking) String() string { + return c.report(false) +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/stats.go b/vendor/github.com/onsi/gomega/gmeasure/stats.go new file mode 100644 index 00000000000..8c02e1bdf1f --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/stats.go @@ -0,0 +1,153 @@ +package gmeasure + +import ( + "fmt" + "time" + + "github.com/onsi/gomega/gmeasure/table" +) + +/* +Stat is an enum representing the statistics you can request of a Stats struct +*/ +type Stat uint + +const ( + StatInvalid Stat = iota + StatMin + StatMax + StatMean + StatMedian + StatStdDev +) + +var statEnumSupport = newEnumSupport(map[uint]string{uint(StatInvalid): "INVALID STAT", uint(StatMin): "Min", uint(StatMax): "Max", uint(StatMean): "Mean", uint(StatMedian): "Median", uint(StatStdDev): "StdDev"}) + +func (s Stat) String() string { return statEnumSupport.String(uint(s)) } +func (s *Stat) UnmarshalJSON(b []byte) error { + out, err := statEnumSupport.UnmarshJSON(b) + *s = Stat(out) + return err +} +func (s Stat) MarshalJSON() ([]byte, error) { return statEnumSupport.MarshJSON(uint(s)) } + +type StatsType uint + +const ( + StatsTypeInvalid StatsType = iota + StatsTypeValue + StatsTypeDuration +) + +var statsTypeEnumSupport = newEnumSupport(map[uint]string{uint(StatsTypeInvalid): "INVALID STATS TYPE", uint(StatsTypeValue): "StatsTypeValue", uint(StatsTypeDuration): "StatsTypeDuration"}) + +func (s StatsType) String() string { return statsTypeEnumSupport.String(uint(s)) } +func (s *StatsType) UnmarshalJSON(b []byte) error { + out, err := statsTypeEnumSupport.UnmarshJSON(b) + *s = StatsType(out) + return err +} +func (s StatsType) MarshalJSON() ([]byte, error) { return statsTypeEnumSupport.MarshJSON(uint(s)) } + +/* +Stats records the key statistics for a given measurement. You generally don't make Stats directly - but you can fetch them from Experiments using GetStats() and from Measurements using Stats(). + +When using Ginkgo, you can register Measurements as Report Entries via AddReportEntry. This will emit all the captured data points when Ginkgo generates the report. +*/ +type Stats struct { + // Type is the StatType - one of StatTypeDuration or StatTypeValue + Type StatsType + + // ExperimentName is the name of the Experiment that recorded the Measurement from which this Stat is derived + ExperimentName string + + // MeasurementName is the name of the Measurement from which this Stat is derived + MeasurementName string + + // Units captures the Units of the Measurement from which this Stat is derived + Units string + + // Style captures the Style of the Measurement from which this Stat is derived + Style string + + // PrecisionBundle captures the precision to use when rendering data for this Measurement. + // If Type is StatTypeDuration then PrecisionBundle.Duration is used to round any durations before presentation. + // If Type is StatTypeValue then PrecisionBundle.ValueFormat is used to format any values before presentation + PrecisionBundle PrecisionBundle + + // N represents the total number of data points in the Meassurement from which this Stat is derived + N int + + // If Type is StatTypeValue, ValueBundle will be populated with float64s representing this Stat's statistics + ValueBundle map[Stat]float64 + + // If Type is StatTypeDuration, DurationBundle will be populated with float64s representing this Stat's statistics + DurationBundle map[Stat]time.Duration + + // AnnotationBundle is populated with Annotations corresponding to the data points that can be associated with a Stat. + // For example AnnotationBundle[StatMin] will return the Annotation for the data point that has the minimum value/duration. + AnnotationBundle map[Stat]string +} + +// String returns a minimal summary of the stats of the form "MIN < [MEDIAN] | ±STDDEV < MAX" +func (s Stats) String() string { + return fmt.Sprintf("%s < [%s] | <%s> ±%s < %s", s.StringFor(StatMin), s.StringFor(StatMedian), s.StringFor(StatMean), s.StringFor(StatStdDev), s.StringFor(StatMax)) +} + +// ValueFor returns the float64 value for a particular Stat. You should only use this if the Stats has Type StatsTypeValue +// For example: +// +// median := experiment.GetStats("length").ValueFor(gmeasure.StatMedian) +// +// will return the median data point for the "length" Measurement. +func (s Stats) ValueFor(stat Stat) float64 { + return s.ValueBundle[stat] +} + +// DurationFor returns the time.Duration for a particular Stat. You should only use this if the Stats has Type StatsTypeDuration +// For example: +// +// mean := experiment.GetStats("runtime").ValueFor(gmeasure.StatMean) +// +// will return the mean duration for the "runtime" Measurement. +func (s Stats) DurationFor(stat Stat) time.Duration { + return s.DurationBundle[stat] +} + +// FloatFor returns a float64 representation of the passed-in Stat. +// When Type is StatsTypeValue this is equivalent to s.ValueFor(stat). +// When Type is StatsTypeDuration this is equivalent to float64(s.DurationFor(stat)) +func (s Stats) FloatFor(stat Stat) float64 { + switch s.Type { + case StatsTypeValue: + return s.ValueFor(stat) + case StatsTypeDuration: + return float64(s.DurationFor(stat)) + } + return 0 +} + +// StringFor returns a formatted string representation of the passed-in Stat. +// The formatting honors the precision directives provided in stats.PrecisionBundle +func (s Stats) StringFor(stat Stat) string { + switch s.Type { + case StatsTypeValue: + return fmt.Sprintf(s.PrecisionBundle.ValueFormat, s.ValueFor(stat)) + case StatsTypeDuration: + return s.DurationFor(stat).Round(s.PrecisionBundle.Duration).String() + } + return "" +} + +func (s Stats) cells() []table.Cell { + out := []table.Cell{} + out = append(out, table.C(fmt.Sprintf("%d", s.N))) + for _, stat := range []Stat{StatMin, StatMedian, StatMean, StatStdDev, StatMax} { + content := s.StringFor(stat) + if s.AnnotationBundle[stat] != "" { + content += "\n" + s.AnnotationBundle[stat] + } + out = append(out, table.C(content)) + } + return out +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/stopwatch.go b/vendor/github.com/onsi/gomega/gmeasure/stopwatch.go new file mode 100644 index 00000000000..634f11f2a46 --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/stopwatch.go @@ -0,0 +1,117 @@ +package gmeasure + +import "time" + +/* +Stopwatch provides a convenient abstraction for recording durations. There are two ways to make a Stopwatch: + +You can make a Stopwatch from an Experiment via experiment.NewStopwatch(). This is how you first get a hold of a Stopwatch. + +You can subsequently call stopwatch.NewStopwatch() to get a fresh Stopwatch. +This is only necessary if you need to record durations on a different goroutine as a single Stopwatch is not considered thread-safe. + +The Stopwatch starts as soon as it is created. You can Pause() the stopwatch and Reset() it as needed. + +Stopwatches refer back to their parent Experiment. They use this reference to record any measured durations back with the Experiment. +*/ +type Stopwatch struct { + Experiment *Experiment + t time.Time + pauseT time.Time + pauseDuration time.Duration + running bool +} + +func newStopwatch(experiment *Experiment) *Stopwatch { + return &Stopwatch{ + Experiment: experiment, + t: time.Now(), + running: true, + } +} + +/* +NewStopwatch returns a new Stopwatch pointing to the same Experiment as this Stopwatch +*/ +func (s *Stopwatch) NewStopwatch() *Stopwatch { + return newStopwatch(s.Experiment) +} + +/* +Record captures the amount of time that has passed since the Stopwatch was created or most recently Reset(). It records the duration on it's associated Experiment in a Measurement with the passed-in name. + +Record takes all the decorators that experiment.RecordDuration takes (e.g. Annotation("...") can be used to annotate this duration) + +Note that Record does not Reset the Stopwatch. It does, however, return the Stopwatch so the following pattern is common: + + stopwatch := experiment.NewStopwatch() + // first expensive operation + stopwatch.Record("first operation").Reset() //records the duration of the first operation and resets the stopwatch. + // second expensive operation + stopwatch.Record("second operation").Reset() //records the duration of the second operation and resets the stopwatch. + +omitting the Reset() after the first operation would cause the duration recorded for the second operation to include the time elapsed by both the first _and_ second operations. + +The Stopwatch must be running (i.e. not paused) when Record is called. +*/ +func (s *Stopwatch) Record(name string, args ...interface{}) *Stopwatch { + if !s.running { + panic("stopwatch is not running - call Resume or Reset before calling Record") + } + duration := time.Since(s.t) - s.pauseDuration + s.Experiment.RecordDuration(name, duration, args...) + return s +} + +/* +Reset resets the Stopwatch. Subsequent recorded durations will measure the time elapsed from the moment Reset was called. +If the Stopwatch was Paused it is unpaused after calling Reset. +*/ +func (s *Stopwatch) Reset() *Stopwatch { + s.running = true + s.t = time.Now() + s.pauseDuration = 0 + return s +} + +/* +Pause pauses the Stopwatch. While pasued the Stopwatch does not accumulate elapsed time. This is useful for ignoring expensive operations that are incidental to the behavior you are attempting to characterize. +Note: You must call Resume() before you can Record() subsequent measurements. + +For example: + + stopwatch := experiment.NewStopwatch() + // first expensive operation + stopwatch.Record("first operation").Reset() + // second expensive operation - part 1 + stopwatch.Pause() + // something expensive that we don't care about + stopwatch.Resume() + // second expensive operation - part 2 + stopwatch.Record("second operation").Reset() // the recorded duration captures the time elapsed during parts 1 and 2 of the second expensive operation, but not the bit in between + + +The Stopwatch must be running when Pause is called. +*/ +func (s *Stopwatch) Pause() *Stopwatch { + if !s.running { + panic("stopwatch is not running - call Resume or Reset before calling Pause") + } + s.running = false + s.pauseT = time.Now() + return s +} + +/* +Resume resumes a paused Stopwatch. Any time that elapses after Resume is called will be accumulated as elapsed time when a subsequent duration is Recorded. + +The Stopwatch must be Paused when Resume is called +*/ +func (s *Stopwatch) Resume() *Stopwatch { + if s.running { + panic("stopwatch is running - call Pause before calling Resume") + } + s.running = true + s.pauseDuration = s.pauseDuration + time.Since(s.pauseT) + return s +} diff --git a/vendor/github.com/onsi/gomega/gmeasure/table/table.go b/vendor/github.com/onsi/gomega/gmeasure/table/table.go new file mode 100644 index 00000000000..f980b9c7aac --- /dev/null +++ b/vendor/github.com/onsi/gomega/gmeasure/table/table.go @@ -0,0 +1,370 @@ +package table + +// This is a temporary package - Table will move to github.com/onsi/consolable once some more dust settles + +import ( + "reflect" + "strings" + "unicode/utf8" +) + +type AlignType uint + +const ( + AlignTypeLeft AlignType = iota + AlignTypeCenter + AlignTypeRight +) + +type Divider string + +type Row struct { + Cells []Cell + Divider string + Style string +} + +func R(args ...interface{}) *Row { + r := &Row{ + Divider: "-", + } + for _, arg := range args { + switch reflect.TypeOf(arg) { + case reflect.TypeOf(Divider("")): + r.Divider = string(arg.(Divider)) + case reflect.TypeOf(r.Style): + r.Style = arg.(string) + case reflect.TypeOf(Cell{}): + r.Cells = append(r.Cells, arg.(Cell)) + } + } + return r +} + +func (r *Row) AppendCell(cells ...Cell) *Row { + r.Cells = append(r.Cells, cells...) + return r +} + +func (r *Row) Render(widths []int, totalWidth int, tableStyle TableStyle, isLastRow bool) string { + out := "" + if len(r.Cells) == 1 { + out += strings.Join(r.Cells[0].render(totalWidth, r.Style, tableStyle), "\n") + "\n" + } else { + if len(r.Cells) != len(widths) { + panic("row vs width mismatch") + } + renderedCells := make([][]string, len(r.Cells)) + maxHeight := 0 + for colIdx, cell := range r.Cells { + renderedCells[colIdx] = cell.render(widths[colIdx], r.Style, tableStyle) + if len(renderedCells[colIdx]) > maxHeight { + maxHeight = len(renderedCells[colIdx]) + } + } + for colIdx := range r.Cells { + for len(renderedCells[colIdx]) < maxHeight { + renderedCells[colIdx] = append(renderedCells[colIdx], strings.Repeat(" ", widths[colIdx])) + } + } + border := strings.Repeat(" ", tableStyle.Padding) + if tableStyle.VerticalBorders { + border += "|" + border + } + for lineIdx := 0; lineIdx < maxHeight; lineIdx++ { + for colIdx := range r.Cells { + out += renderedCells[colIdx][lineIdx] + if colIdx < len(r.Cells)-1 { + out += border + } + } + out += "\n" + } + } + if tableStyle.HorizontalBorders && !isLastRow && r.Divider != "" { + out += strings.Repeat(string(r.Divider), totalWidth) + "\n" + } + + return out +} + +type Cell struct { + Contents []string + Style string + Align AlignType +} + +func C(contents string, args ...interface{}) Cell { + c := Cell{ + Contents: strings.Split(contents, "\n"), + } + for _, arg := range args { + switch reflect.TypeOf(arg) { + case reflect.TypeOf(c.Style): + c.Style = arg.(string) + case reflect.TypeOf(c.Align): + c.Align = arg.(AlignType) + } + } + return c +} + +func (c Cell) Width() (int, int) { + w, minW := 0, 0 + for _, line := range c.Contents { + lineWidth := utf8.RuneCountInString(line) + if lineWidth > w { + w = lineWidth + } + for _, word := range strings.Split(line, " ") { + wordWidth := utf8.RuneCountInString(word) + if wordWidth > minW { + minW = wordWidth + } + } + } + return w, minW +} + +func (c Cell) alignLine(line string, width int) string { + lineWidth := utf8.RuneCountInString(line) + if lineWidth == width { + return line + } + if lineWidth < width { + gap := width - lineWidth + switch c.Align { + case AlignTypeLeft: + return line + strings.Repeat(" ", gap) + case AlignTypeRight: + return strings.Repeat(" ", gap) + line + case AlignTypeCenter: + leftGap := gap / 2 + rightGap := gap - leftGap + return strings.Repeat(" ", leftGap) + line + strings.Repeat(" ", rightGap) + } + } + return line +} + +func (c Cell) splitWordToWidth(word string, width int) []string { + out := []string{} + n, subWord := 0, "" + for _, c := range word { + subWord += string(c) + n += 1 + if n == width-1 { + out = append(out, subWord+"-") + n, subWord = 0, "" + } + } + return out +} + +func (c Cell) splitToWidth(line string, width int) []string { + lineWidth := utf8.RuneCountInString(line) + if lineWidth <= width { + return []string{line} + } + + outLines := []string{} + words := strings.Split(line, " ") + outWords := []string{words[0]} + length := utf8.RuneCountInString(words[0]) + if length > width { + splitWord := c.splitWordToWidth(words[0], width) + lastIdx := len(splitWord) - 1 + outLines = append(outLines, splitWord[:lastIdx]...) + outWords = []string{splitWord[lastIdx]} + length = utf8.RuneCountInString(splitWord[lastIdx]) + } + + for _, word := range words[1:] { + wordLength := utf8.RuneCountInString(word) + if length+wordLength+1 <= width { + length += wordLength + 1 + outWords = append(outWords, word) + continue + } + outLines = append(outLines, strings.Join(outWords, " ")) + + outWords = []string{word} + length = wordLength + if length > width { + splitWord := c.splitWordToWidth(word, width) + lastIdx := len(splitWord) - 1 + outLines = append(outLines, splitWord[:lastIdx]...) + outWords = []string{splitWord[lastIdx]} + length = utf8.RuneCountInString(splitWord[lastIdx]) + } + } + if len(outWords) > 0 { + outLines = append(outLines, strings.Join(outWords, " ")) + } + + return outLines +} + +func (c Cell) render(width int, style string, tableStyle TableStyle) []string { + out := []string{} + for _, line := range c.Contents { + out = append(out, c.splitToWidth(line, width)...) + } + for idx := range out { + out[idx] = c.alignLine(out[idx], width) + } + + if tableStyle.EnableTextStyling { + style = style + c.Style + if style != "" { + for idx := range out { + out[idx] = style + out[idx] + "{{/}}" + } + } + } + + return out +} + +type TableStyle struct { + Padding int + VerticalBorders bool + HorizontalBorders bool + MaxTableWidth int + MaxColWidth int + EnableTextStyling bool +} + +var DefaultTableStyle = TableStyle{ + Padding: 1, + VerticalBorders: true, + HorizontalBorders: true, + MaxTableWidth: 120, + MaxColWidth: 40, + EnableTextStyling: true, +} + +type Table struct { + Rows []*Row + + TableStyle TableStyle +} + +func NewTable() *Table { + return &Table{ + TableStyle: DefaultTableStyle, + } +} + +func (t *Table) AppendRow(row *Row) *Table { + t.Rows = append(t.Rows, row) + return t +} + +func (t *Table) Render() string { + out := "" + totalWidth, widths := t.computeWidths() + for rowIdx, row := range t.Rows { + out += row.Render(widths, totalWidth, t.TableStyle, rowIdx == len(t.Rows)-1) + } + return out +} + +func (t *Table) computeWidths() (int, []int) { + nCol := 0 + for _, row := range t.Rows { + if len(row.Cells) > nCol { + nCol = len(row.Cells) + } + } + + // lets compute the contribution to width from the borders + padding + borderWidth := t.TableStyle.Padding + if t.TableStyle.VerticalBorders { + borderWidth += 1 + t.TableStyle.Padding + } + totalBorderWidth := borderWidth * (nCol - 1) + + // lets compute the width of each column + widths := make([]int, nCol) + minWidths := make([]int, nCol) + for colIdx := range widths { + for _, row := range t.Rows { + if colIdx >= len(row.Cells) { + // ignore rows with fewer columns + continue + } + w, minWid := row.Cells[colIdx].Width() + if w > widths[colIdx] { + widths[colIdx] = w + } + if minWid > minWidths[colIdx] { + minWidths[colIdx] = minWid + } + } + } + + // do we already fit? + if sum(widths)+totalBorderWidth <= t.TableStyle.MaxTableWidth { + // yes! we're done + return sum(widths) + totalBorderWidth, widths + } + + // clamp the widths and minWidths to MaxColWidth + for colIdx := range widths { + widths[colIdx] = min(widths[colIdx], t.TableStyle.MaxColWidth) + minWidths[colIdx] = min(minWidths[colIdx], t.TableStyle.MaxColWidth) + } + + // do we fit now? + if sum(widths)+totalBorderWidth <= t.TableStyle.MaxTableWidth { + // yes! we're done + return sum(widths) + totalBorderWidth, widths + } + + // hmm... still no... can we possibly squeeze the table in without violating minWidths? + if sum(minWidths)+totalBorderWidth >= t.TableStyle.MaxTableWidth { + // nope - we're just going to have to exceed MaxTableWidth + return sum(minWidths) + totalBorderWidth, minWidths + } + + // looks like we don't fit yet, but we should be able to fit without violating minWidths + // lets start scaling down + n := 0 + for sum(widths)+totalBorderWidth > t.TableStyle.MaxTableWidth { + budget := t.TableStyle.MaxTableWidth - totalBorderWidth + baseline := sum(widths) + + for colIdx := range widths { + widths[colIdx] = max((widths[colIdx]*budget)/baseline, minWidths[colIdx]) + } + n += 1 + if n > 100 { + break // in case we somehow fail to converge + } + } + + return sum(widths) + totalBorderWidth, widths +} + +func sum(s []int) int { + out := 0 + for _, v := range s { + out += v + } + return out +} + +func min(a int, b int) int { + if a < b { + return a + } + return b +} + +func max(a int, b int) int { + if a > b { + return a + } + return b +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 6dfa5f99037..416fd172d97 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -220,7 +220,7 @@ github.com/hyperledger/fabric-amcl/amcl github.com/hyperledger/fabric-amcl/amcl/FP256BN github.com/hyperledger/fabric-amcl/core github.com/hyperledger/fabric-amcl/core/FP256BN -# github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0 +# github.com/hyperledger/fabric-chaincode-go/v2 v2.0.0 => github.com/scientificideas/fabric-chaincode-go/v2 v2.0.0-20240917062040-734ea7e39c20 ## explicit; go 1.21.0 github.com/hyperledger/fabric-chaincode-go/v2/pkg/statebased github.com/hyperledger/fabric-chaincode-go/v2/shim @@ -260,8 +260,8 @@ github.com/hyperledger/fabric-lib-go/common/metrics/prometheus github.com/hyperledger/fabric-lib-go/common/metrics/statsd github.com/hyperledger/fabric-lib-go/common/metrics/statsd/goruntime github.com/hyperledger/fabric-lib-go/healthz -# github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 -## explicit; go 1.21.0 +# github.com/hyperledger/fabric-protos-go-apiv2 v0.3.4 => github.com/scientificideas/fabric-protos-go-apiv2 v0.0.0-20240917052027-e43d30d02e8c +## explicit; go 1.17 github.com/hyperledger/fabric-protos-go-apiv2/common github.com/hyperledger/fabric-protos-go-apiv2/discovery github.com/hyperledger/fabric-protos-go-apiv2/gateway @@ -389,6 +389,8 @@ github.com/onsi/gomega github.com/onsi/gomega/format github.com/onsi/gomega/gbytes github.com/onsi/gomega/gexec +github.com/onsi/gomega/gmeasure +github.com/onsi/gomega/gmeasure/table github.com/onsi/gomega/gstruct github.com/onsi/gomega/gstruct/errors github.com/onsi/gomega/internal @@ -712,3 +714,5 @@ gopkg.in/yaml.v3 ## explicit; go 1.17 rsc.io/tmplfunc rsc.io/tmplfunc/internal/parse +# github.com/hyperledger/fabric-chaincode-go/v2 => github.com/scientificideas/fabric-chaincode-go/v2 v2.0.0-20240917062040-734ea7e39c20 +# github.com/hyperledger/fabric-protos-go-apiv2 => github.com/scientificideas/fabric-protos-go-apiv2 v0.0.0-20240917052027-e43d30d02e8c