Documentation
¶
Index ¶
- Variables
- func CommonTestAsnMarshal(t *testing.T, txs []*TestTx)
- type ConfigTransaction
- func (*ConfigTransaction) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigTransaction) GetEnvelope() []byte
- func (x *ConfigTransaction) GetVersion() uint64
- func (*ConfigTransaction) ProtoMessage()
- func (x *ConfigTransaction) ProtoReflect() protoreflect.Message
- func (x *ConfigTransaction) Reset()
- func (x *ConfigTransaction) String() string
- type EndorsementWithIdentity
- func (*EndorsementWithIdentity) Descriptor() ([]byte, []int)deprecated
- func (x *EndorsementWithIdentity) GetEndorsement() []byte
- func (x *EndorsementWithIdentity) GetIdentity() *msppb.Identity
- func (*EndorsementWithIdentity) ProtoMessage()
- func (x *EndorsementWithIdentity) ProtoReflect() protoreflect.Message
- func (x *EndorsementWithIdentity) Reset()
- func (x *EndorsementWithIdentity) String() string
- type Endorsements
- func (*Endorsements) Descriptor() ([]byte, []int)deprecated
- func (x *Endorsements) GetEndorsementsWithIdentity() []*EndorsementWithIdentity
- func (*Endorsements) ProtoMessage()
- func (x *Endorsements) ProtoReflect() protoreflect.Message
- func (x *Endorsements) Reset()
- func (x *Endorsements) String() string
- type NamespacePolicies
- func (*NamespacePolicies) Descriptor() ([]byte, []int)deprecated
- func (x *NamespacePolicies) GetPolicies() []*PolicyItem
- func (*NamespacePolicies) ProtoMessage()
- func (x *NamespacePolicies) ProtoReflect() protoreflect.Message
- func (x *NamespacePolicies) Reset()
- func (x *NamespacePolicies) String() string
- type NamespacePolicy
- func (*NamespacePolicy) Descriptor() ([]byte, []int)deprecated
- func (x *NamespacePolicy) GetMspRule() []byte
- func (x *NamespacePolicy) GetRule() isNamespacePolicy_Rule
- func (x *NamespacePolicy) GetThresholdRule() *ThresholdRule
- func (*NamespacePolicy) ProtoMessage()
- func (x *NamespacePolicy) ProtoReflect() protoreflect.Message
- func (x *NamespacePolicy) Reset()
- func (x *NamespacePolicy) String() string
- type NamespacePolicy_MspRule
- type NamespacePolicy_ThresholdRule
- type PolicyItem
- func (*PolicyItem) Descriptor() ([]byte, []int)deprecated
- func (x *PolicyItem) GetNamespace() string
- func (x *PolicyItem) GetPolicy() []byte
- func (x *PolicyItem) GetVersion() uint64
- func (*PolicyItem) ProtoMessage()
- func (x *PolicyItem) ProtoReflect() protoreflect.Message
- func (x *PolicyItem) Reset()
- func (x *PolicyItem) String() string
- type Read
- type ReadWrite
- func (*ReadWrite) Descriptor() ([]byte, []int)deprecated
- func (x *ReadWrite) GetKey() []byte
- func (x *ReadWrite) GetValue() []byte
- func (x *ReadWrite) GetVersion() uint64
- func (*ReadWrite) ProtoMessage()
- func (x *ReadWrite) ProtoReflect() protoreflect.Message
- func (x *ReadWrite) Reset()
- func (x *ReadWrite) String() string
- type TestTx
- type ThresholdRule
- func (*ThresholdRule) Descriptor() ([]byte, []int)deprecated
- func (x *ThresholdRule) GetPublicKey() []byte
- func (x *ThresholdRule) GetScheme() string
- func (*ThresholdRule) ProtoMessage()
- func (x *ThresholdRule) ProtoReflect() protoreflect.Message
- func (x *ThresholdRule) Reset()
- func (x *ThresholdRule) String() string
- type Tx
- func (*Tx) Descriptor() ([]byte, []int)deprecated
- func (x *Tx) GetEndorsements() []*Endorsements
- func (x *Tx) GetMetadata() [][]byte
- func (x *Tx) GetNamespaces() []*TxNamespace
- func (*Tx) ProtoMessage()
- func (x *Tx) ProtoReflect() protoreflect.Message
- func (x *Tx) Reset()
- func (x *Tx) String() string
- type TxNamespace
- func (ns *TxNamespace) ASN1Marshal(txID string, metadata [][]byte) ([]byte, error)
- func (*TxNamespace) Descriptor() ([]byte, []int)deprecated
- func (x *TxNamespace) GetBlindWrites() []*Write
- func (x *TxNamespace) GetNsId() string
- func (x *TxNamespace) GetNsVersion() uint64
- func (x *TxNamespace) GetReadWrites() []*ReadWrite
- func (x *TxNamespace) GetReadsOnly() []*Read
- func (*TxNamespace) ProtoMessage()
- func (x *TxNamespace) ProtoReflect() protoreflect.Message
- func (ns *TxNamespace) QuickASN1Marshal(txID string, metadata [][]byte) ([]byte, error)
- func (x *TxNamespace) Reset()
- func (x *TxNamespace) String() string
- type Write
Constants ¶
This section is empty.
Variables ¶
var File_api_applicationpb_block_tx_proto protoreflect.FileDescriptor
var File_api_applicationpb_config_proto protoreflect.FileDescriptor
Functions ¶
func CommonTestAsnMarshal ¶
CommonTestAsnMarshal tests ASN1 marshalling and unmarshalling of the given TXs. It can be used by other test packages (e.g., loadgen) to ensure consistency with the implementation.
Types ¶
type ConfigTransaction ¶
type ConfigTransaction struct {
Envelope []byte `protobuf:"bytes,1,opt,name=envelope,proto3" json:"envelope,omitempty"`
Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
// contains filtered or unexported fields
}
The config TX envelope with the update version.
func (*ConfigTransaction) Descriptor
deprecated
func (*ConfigTransaction) Descriptor() ([]byte, []int)
Deprecated: Use ConfigTransaction.ProtoReflect.Descriptor instead.
func (*ConfigTransaction) GetEnvelope ¶
func (x *ConfigTransaction) GetEnvelope() []byte
func (*ConfigTransaction) GetVersion ¶
func (x *ConfigTransaction) GetVersion() uint64
func (*ConfigTransaction) ProtoMessage ¶
func (*ConfigTransaction) ProtoMessage()
func (*ConfigTransaction) ProtoReflect ¶
func (x *ConfigTransaction) ProtoReflect() protoreflect.Message
func (*ConfigTransaction) Reset ¶
func (x *ConfigTransaction) Reset()
func (*ConfigTransaction) String ¶
func (x *ConfigTransaction) String() string
type EndorsementWithIdentity ¶
type EndorsementWithIdentity struct {
// The actual cryptographic signature bytes.
Endorsement []byte `protobuf:"bytes,1,opt,name=endorsement,proto3" json:"endorsement,omitempty"`
// The identity of the creator who produced the signature, i.e., the endorsement.
Identity *msppb.Identity `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
// contains filtered or unexported fields
}
EndorsementWithIdentity bundles a single signature with the identity of its creator.
func (*EndorsementWithIdentity) Descriptor
deprecated
func (*EndorsementWithIdentity) Descriptor() ([]byte, []int)
Deprecated: Use EndorsementWithIdentity.ProtoReflect.Descriptor instead.
func (*EndorsementWithIdentity) GetEndorsement ¶
func (x *EndorsementWithIdentity) GetEndorsement() []byte
func (*EndorsementWithIdentity) GetIdentity ¶
func (x *EndorsementWithIdentity) GetIdentity() *msppb.Identity
func (*EndorsementWithIdentity) ProtoMessage ¶
func (*EndorsementWithIdentity) ProtoMessage()
func (*EndorsementWithIdentity) ProtoReflect ¶
func (x *EndorsementWithIdentity) ProtoReflect() protoreflect.Message
func (*EndorsementWithIdentity) Reset ¶
func (x *EndorsementWithIdentity) Reset()
func (*EndorsementWithIdentity) String ¶
func (x *EndorsementWithIdentity) String() string
type Endorsements ¶
type Endorsements struct {
// The list of individual signatures for the corresponding namespace.
EndorsementsWithIdentity []*EndorsementWithIdentity `` /* 135-byte string literal not displayed */
// contains filtered or unexported fields
}
Endorsements holds all the signatures that correspond to a single namespace in the transaction's namespaces list.
func (*Endorsements) Descriptor
deprecated
func (*Endorsements) Descriptor() ([]byte, []int)
Deprecated: Use Endorsements.ProtoReflect.Descriptor instead.
func (*Endorsements) GetEndorsementsWithIdentity ¶
func (x *Endorsements) GetEndorsementsWithIdentity() []*EndorsementWithIdentity
func (*Endorsements) ProtoMessage ¶
func (*Endorsements) ProtoMessage()
func (*Endorsements) ProtoReflect ¶
func (x *Endorsements) ProtoReflect() protoreflect.Message
func (*Endorsements) Reset ¶
func (x *Endorsements) Reset()
func (*Endorsements) String ¶
func (x *Endorsements) String() string
type NamespacePolicies ¶
type NamespacePolicies struct {
Policies []*PolicyItem `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty"`
// contains filtered or unexported fields
}
A batch of namespace policies.
func (*NamespacePolicies) Descriptor
deprecated
func (*NamespacePolicies) Descriptor() ([]byte, []int)
Deprecated: Use NamespacePolicies.ProtoReflect.Descriptor instead.
func (*NamespacePolicies) GetPolicies ¶
func (x *NamespacePolicies) GetPolicies() []*PolicyItem
func (*NamespacePolicies) ProtoMessage ¶
func (*NamespacePolicies) ProtoMessage()
func (*NamespacePolicies) ProtoReflect ¶
func (x *NamespacePolicies) ProtoReflect() protoreflect.Message
func (*NamespacePolicies) Reset ¶
func (x *NamespacePolicies) Reset()
func (*NamespacePolicies) String ¶
func (x *NamespacePolicies) String() string
type NamespacePolicy ¶
type NamespacePolicy struct {
// Types that are valid to be assigned to Rule:
//
// *NamespacePolicy_ThresholdRule
// *NamespacePolicy_MspRule
Rule isNamespacePolicy_Rule `protobuf_oneof:"rule"`
// contains filtered or unexported fields
}
Represents a namespace policy.
func (*NamespacePolicy) Descriptor
deprecated
func (*NamespacePolicy) Descriptor() ([]byte, []int)
Deprecated: Use NamespacePolicy.ProtoReflect.Descriptor instead.
func (*NamespacePolicy) GetMspRule ¶
func (x *NamespacePolicy) GetMspRule() []byte
func (*NamespacePolicy) GetRule ¶
func (x *NamespacePolicy) GetRule() isNamespacePolicy_Rule
func (*NamespacePolicy) GetThresholdRule ¶
func (x *NamespacePolicy) GetThresholdRule() *ThresholdRule
func (*NamespacePolicy) ProtoMessage ¶
func (*NamespacePolicy) ProtoMessage()
func (*NamespacePolicy) ProtoReflect ¶
func (x *NamespacePolicy) ProtoReflect() protoreflect.Message
func (*NamespacePolicy) Reset ¶
func (x *NamespacePolicy) Reset()
func (*NamespacePolicy) String ¶
func (x *NamespacePolicy) String() string
type NamespacePolicy_MspRule ¶
type NamespacePolicy_MspRule struct {
MspRule []byte `protobuf:"bytes,2,opt,name=msp_rule,json=mspRule,proto3,oneof"`
}
type NamespacePolicy_ThresholdRule ¶
type NamespacePolicy_ThresholdRule struct {
ThresholdRule *ThresholdRule `protobuf:"bytes,1,opt,name=threshold_rule,json=thresholdRule,proto3,oneof"`
}
type PolicyItem ¶
type PolicyItem struct {
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
Policy []byte `protobuf:"bytes,2,opt,name=policy,proto3" json:"policy,omitempty"`
Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"`
// contains filtered or unexported fields
}
A namespace policy item with the update version.
func (*PolicyItem) Descriptor
deprecated
func (*PolicyItem) Descriptor() ([]byte, []int)
Deprecated: Use PolicyItem.ProtoReflect.Descriptor instead.
func (*PolicyItem) GetNamespace ¶
func (x *PolicyItem) GetNamespace() string
func (*PolicyItem) GetPolicy ¶
func (x *PolicyItem) GetPolicy() []byte
func (*PolicyItem) GetVersion ¶
func (x *PolicyItem) GetVersion() uint64
func (*PolicyItem) ProtoMessage ¶
func (*PolicyItem) ProtoMessage()
func (*PolicyItem) ProtoReflect ¶
func (x *PolicyItem) ProtoReflect() protoreflect.Message
func (*PolicyItem) Reset ¶
func (x *PolicyItem) Reset()
func (*PolicyItem) String ¶
func (x *PolicyItem) String() string
type Read ¶
type Read struct {
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The key being read.
Version *uint64 `protobuf:"varint,2,opt,name=version,proto3,oneof" json:"version,omitempty"` // The version of the key being read. Nil version means it doesn't exist.
// contains filtered or unexported fields
}
Represents a read operation.
func (*Read) Descriptor
deprecated
func (*Read) GetVersion ¶
func (*Read) ProtoMessage ¶
func (*Read) ProtoMessage()
func (*Read) ProtoReflect ¶
func (x *Read) ProtoReflect() protoreflect.Message
type ReadWrite ¶
type ReadWrite struct {
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The key involved in the read-write operation.
Version *uint64 `protobuf:"varint,2,opt,name=version,proto3,oneof" json:"version,omitempty"` // The version of the key being read and written. Nil version means it doesn't exist.
Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // The value associated with the key being written.
// contains filtered or unexported fields
}
Represents a read-write operation.
func (*ReadWrite) Descriptor
deprecated
func (*ReadWrite) GetVersion ¶
func (*ReadWrite) ProtoMessage ¶
func (*ReadWrite) ProtoMessage()
func (*ReadWrite) ProtoReflect ¶
func (x *ReadWrite) ProtoReflect() protoreflect.Message
type TestTx ¶
type TestTx struct {
ID string
Metadata [][]byte
Namespaces []*TxNamespace
}
TestTx represents a test transaction for ASN1 marshalling tests.
type ThresholdRule ¶
type ThresholdRule struct {
Scheme string `protobuf:"bytes,1,opt,name=scheme,proto3" json:"scheme,omitempty"` // The scheme for signature verification.
PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // The public key for signature verification.
// contains filtered or unexported fields
}
Represents a threshold signature rule.
func (*ThresholdRule) Descriptor
deprecated
func (*ThresholdRule) Descriptor() ([]byte, []int)
Deprecated: Use ThresholdRule.ProtoReflect.Descriptor instead.
func (*ThresholdRule) GetPublicKey ¶
func (x *ThresholdRule) GetPublicKey() []byte
func (*ThresholdRule) GetScheme ¶
func (x *ThresholdRule) GetScheme() string
func (*ThresholdRule) ProtoMessage ¶
func (*ThresholdRule) ProtoMessage()
func (*ThresholdRule) ProtoReflect ¶
func (x *ThresholdRule) ProtoReflect() protoreflect.Message
func (*ThresholdRule) Reset ¶
func (x *ThresholdRule) Reset()
func (*ThresholdRule) String ¶
func (x *ThresholdRule) String() string
type Tx ¶
type Tx struct {
// A list of namespaces that define the transaction's scope.
Namespaces []*TxNamespace `protobuf:"bytes,1,rep,name=namespaces,proto3" json:"namespaces,omitempty"`
// A list of endorsements.
// IMPORTANT: This list MUST be the same size as the namespaces list.
// The Endorsement at index i corresponds to the namespace at index i.
Endorsements []*Endorsements `protobuf:"bytes,2,rep,name=endorsements,proto3" json:"endorsements,omitempty"`
// The metadata field contains additional transaction execution information.
// It does not affect the world state and is only visible when inspecting the transaction.
// The metadata is included in namespace endorsements, ensuring that endorsers validate both
// the transaction results and the associated execution metadata.
Metadata [][]byte `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty"`
// contains filtered or unexported fields
}
Represents a transaction in the blockchain.
func (*Tx) Descriptor
deprecated
func (*Tx) GetEndorsements ¶
func (x *Tx) GetEndorsements() []*Endorsements
func (*Tx) GetMetadata ¶ added in v0.2.6
func (*Tx) GetNamespaces ¶
func (x *Tx) GetNamespaces() []*TxNamespace
func (*Tx) ProtoMessage ¶
func (*Tx) ProtoMessage()
func (*Tx) ProtoReflect ¶
func (x *Tx) ProtoReflect() protoreflect.Message
type TxNamespace ¶
type TxNamespace struct {
NsId string `protobuf:"bytes,1,opt,name=ns_id,json=nsId,proto3" json:"ns_id,omitempty"` // The namespace ID.
NsVersion uint64 `protobuf:"varint,2,opt,name=ns_version,json=nsVersion,proto3" json:"ns_version,omitempty"` // The version of the namespace.
ReadsOnly []*Read `protobuf:"bytes,3,rep,name=reads_only,json=readsOnly,proto3" json:"reads_only,omitempty"` // List of read only operations within the namespace.
ReadWrites []*ReadWrite `protobuf:"bytes,4,rep,name=read_writes,json=readWrites,proto3" json:"read_writes,omitempty"` // List of read-write operations within the namespace.
BlindWrites []*Write `protobuf:"bytes,5,rep,name=blind_writes,json=blindWrites,proto3" json:"blind_writes,omitempty"` // List of blind write operations within the namespace.
// contains filtered or unexported fields
}
Represents a namespace within a transaction.
func (*TxNamespace) ASN1Marshal ¶
func (ns *TxNamespace) ASN1Marshal(txID string, metadata [][]byte) ([]byte, error)
ASN1Marshal marshals a transactions for a given namespace index. It uses the schema described in asn1_tx_schema.asn.
func (*TxNamespace) Descriptor
deprecated
func (*TxNamespace) Descriptor() ([]byte, []int)
Deprecated: Use TxNamespace.ProtoReflect.Descriptor instead.
func (*TxNamespace) GetBlindWrites ¶
func (x *TxNamespace) GetBlindWrites() []*Write
func (*TxNamespace) GetNsId ¶
func (x *TxNamespace) GetNsId() string
func (*TxNamespace) GetNsVersion ¶
func (x *TxNamespace) GetNsVersion() uint64
func (*TxNamespace) GetReadWrites ¶
func (x *TxNamespace) GetReadWrites() []*ReadWrite
func (*TxNamespace) GetReadsOnly ¶
func (x *TxNamespace) GetReadsOnly() []*Read
func (*TxNamespace) ProtoMessage ¶
func (*TxNamespace) ProtoMessage()
func (*TxNamespace) ProtoReflect ¶
func (x *TxNamespace) ProtoReflect() protoreflect.Message
func (*TxNamespace) QuickASN1Marshal ¶ added in v0.2.9
func (ns *TxNamespace) QuickASN1Marshal(txID string, metadata [][]byte) ([]byte, error)
QuickASN1Marshal marshals a transaction for a given namespace. It uses the schema described in asn1_tx_schema.asn.
It sizes the whole encoding before writing any of it, so the result is one allocation and every payload byte is copied exactly once. Every size function therefore has to agree with the appender that writes what it measures, so each is grouped with that appender below.
Against encoding/asn1, medians of BenchmarkASN1Marshal over -count=5:
two read-writes, 32-byte keys and values 7,195 ns/61 allocs -> 237 ns/1 alloc 512 read-writes, 32-byte keys and values 887,108 ns/8477 allocs -> 26,460 ns/1 alloc
With megabyte keys and values the two are a wash -- both are dominated by copying the four megabytes, and that case's run-to-run spread of 20-26% is wider than the difference between them -- so what is left there is 61 allocations against one.
func (*TxNamespace) Reset ¶
func (x *TxNamespace) Reset()
func (*TxNamespace) String ¶
func (x *TxNamespace) String() string
type Write ¶
type Write struct {
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The key being written.
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` // The value associated with the key being written.
// contains filtered or unexported fields
}
Represents a write operation.
func (*Write) Descriptor
deprecated
func (*Write) ProtoMessage ¶
func (*Write) ProtoMessage()
func (*Write) ProtoReflect ¶
func (x *Write) ProtoReflect() protoreflect.Message