Documentation ¶
Index ¶
- Constants
- func CreateCompositeKey(objectType string, attributes []string) (string, error)
- func CreateNonce() ([]byte, error)
- func CreateNonceOrPanic() []byte
- func CreateRangeKeysForPartialCompositeKey(objectType string, attributes []string) (string, string, error)
- func ExchangeRecipientIdentities(context view.Context, recipient view.Identity, opts ...ServiceOption) (view.Identity, view.Identity, error)
- func GenerateBytesUUID() []byte
- func GenerateUUID() string
- func GetCertification(tx TxTransientStore, id string) ([]byte, error)
- func GetCertificationType(tx TxTransientStore) (string, []byte, error)
- func IDHasPrefixFilter(prefix string) func(k ID) bool
- func InputHasIDPrefixFilter(prefix string) func(i *input) bool
- func NewAcceptView(tx *Transaction) view.View
- func NewCollectApprovesView(tx *Transaction, parties ...view.Identity) view.View
- func NewCollectEndorsementsView(tx *Transaction, parties ...view.Identity) view.View
- func NewEndorseView(tx *Transaction, ids ...view.Identity) view.View
- func NewEndorsementOnProposalResponderView(tx *Transaction) view.View
- func NewFinalityView(tx *Transaction) view.View
- func NewFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) view.View
- func NewOrderingAndFinalityView(tx *Transaction) view.View
- func NewOrderingAndFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) view.View
- func NewParallelCollectEndorsementsOnProposalView(tx *Transaction, parties ...view.Identity) view.View
- func NewPayloadReceiveView() *payloadReceiveView
- func NewReceiveTransactionFromView(party view.Identity) *receiveTransactionView
- func NewReceiveTransactionView() *receiveTransactionView
- func NewReceiveView(state interface{}) *receiveView
- func NewReplyView(state interface{}) *replyView
- func NewRespondRequestRecipientIdentityView() view.View
- func NewSendReceiveView(sendState, receiveState interface{}, party view.Identity) *sendReceiveView
- func NewSendTransactionBackView(tx *Transaction) *sendTransactionBackView
- func NewSendTransactionView(tx *Transaction, parties ...view.Identity) *sendTransactionView
- func RequestRecipientIdentity(context view.Context, other view.Identity) (view.Identity, error)
- func RespondExchangeRecipientIdentities(context view.Context, opts ...ServiceOption) (view.Identity, view.Identity, error)
- func RespondRequestRecipientIdentity(context view.Context) (view.Identity, error)
- func SetCertification(tx TxTransientStore, id string, value []byte) error
- func SetCertificationType(tx TxTransientStore, typ string, value []byte) error
- func Unmarshal(unmarshaller Unmarshaller, data []byte, v interface{}) error
- type AddInputOption
- type AddOutputOption
- type AutoLinearState
- type Bytes
- type CertificationRequest
- type CertificationView
- type CertificationViewFactory
- type Codec
- type Command
- type CommonIteratorInterface
- type EmbeddingState
- type EndorseTransaction
- type ExchangeRecipientIdentitiesView
- type ExchangeRecipientRequest
- type Header
- type ID
- type IDs
- type Identities
- type JSONCodec
- type LinearState
- type Marshaller
- type MetaHandler
- type Namespace
- func (n *Namespace) AddCommand(command string, ids ...view.Identity) error
- func (n *Namespace) AddInputByLinearID(id string, state interface{}, opts ...AddInputOption) error
- func (n *Namespace) AddOutput(st interface{}, opts ...AddOutputOption) error
- func (n *Namespace) Commands() *commandStream
- func (n *Namespace) Delete(state interface{}) error
- func (n *Namespace) GetInputAt(index int, state interface{}) error
- func (n *Namespace) GetOutputAt(index int, state interface{}) error
- func (n *Namespace) GetService(v interface{}) (interface{}, error)
- func (n *Namespace) Inputs() *inputStream
- func (n *Namespace) NumInputs() int
- func (n *Namespace) NumOutputs() int
- func (n *Namespace) Outputs() *outputStream
- func (n *Namespace) Present() bool
- func (n *Namespace) RWSet() (*fabric.RWSet, error)
- func (n *Namespace) SetNamespace(ns string)
- func (n *Namespace) VerifyInputCertificationAt(index int, key string) error
- type Namespaces
- type Network
- type Ownable
- type QueryIteratorInterface
- type RWSetProcessor
- type RecipientData
- type RecipientRequest
- type RequestRecipientIdentityView
- type RespondExchangeRecipientIdentitiesView
- type RespondRequestRecipientIdentityView
- type Serializable
- type ServiceOption
- type ServiceOptions
- type State
- type Transaction
- func NewAnonymousTransaction(context view.Context) (*Transaction, error)
- func NewTransaction(context view.Context) (*Transaction, error)
- func NewTransactionFromBytes(context view.Context, raw []byte) (*Transaction, error)
- func ReceiveTransaction(context view.Context) (*Transaction, error)
- func ReceiveTransactionFrom(context view.Context, party view.Identity) (*Transaction, error)
- func SendAndReceiveTransaction(context view.Context, tx *Transaction, party view.Identity) (*Transaction, error)
- func SendBackAndReceiveTransaction(context view.Context, tx *Transaction) (*Transaction, error)
- func Wrap(tx *endorser.Transaction) (*Transaction, error)
- type TxTransientStore
- type Unmarshaller
- type Vault
- type VaultService
- type ViewManager
Constants ¶
const ( CertificationType string = "CertificationType" Certification string = "Certification" ChaincodeCertification string = "ChaincodesCertification" CertificationFnc string = "state_certification" )
const (
MaxUnicodeRuneValue = utf8.MaxRune // U+10FFFF - maximum (and unallocated) code point
)
Variables ¶
This section is empty.
Functions ¶
func CreateCompositeKey ¶
func CreateNonce ¶
CreateNonce generates a nonce using the common/crypto package.
func CreateNonceOrPanic ¶
func CreateNonceOrPanic() []byte
CreateNonceOrPanic generates a nonce using the common/crypto package and panics if this operation fails.
func ExchangeRecipientIdentities ¶
func ExchangeRecipientIdentities(context view.Context, recipient view.Identity, opts ...ServiceOption) (view.Identity, view.Identity, error)
ExchangeRecipientIdentities runs the ExchangeRecipientIdentitiesView against the passed receiver. The function returns, the recipient identity of the sender, the recipient identity of the receiver.
func GenerateBytesUUID ¶
func GenerateBytesUUID() []byte
GenerateBytesUUID returns a UUID based on RFC 4122 returning the generated bytes
func GetCertification ¶
func GetCertification(tx TxTransientStore, id string) ([]byte, error)
func GetCertificationType ¶
func GetCertificationType(tx TxTransientStore) (string, []byte, error)
func IDHasPrefixFilter ¶
func InputHasIDPrefixFilter ¶
func NewAcceptView ¶
func NewAcceptView(tx *Transaction) view.View
func NewCollectApprovesView ¶
func NewCollectApprovesView(tx *Transaction, parties ...view.Identity) view.View
func NewCollectEndorsementsView ¶
func NewCollectEndorsementsView(tx *Transaction, parties ...view.Identity) view.View
NewCollectEndorsementsView returns a view that does the following: 1. It contacts each passed party sequentially and sends the marshalled version of the passed transaction. 2. It waits for a response containing either the endorsement of the transaction or an error.
func NewEndorseView ¶
func NewEndorseView(tx *Transaction, ids ...view.Identity) view.View
NewEndorseView returns a view that does the following: 1. It signs the transaction with the signing key of each passed identity 2. Send the transaction back on the context's session.
func NewEndorsementOnProposalResponderView ¶
func NewEndorsementOnProposalResponderView(tx *Transaction) view.View
func NewFinalityView ¶
func NewFinalityView(tx *Transaction) view.View
NewFinalityView returns a new instance of the finality view that waits for the finality of the passed transaction.
func NewFinalityWithTimeoutView ¶
func NewFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) view.View
NewFinalityWithTimeoutView runs the finality view for the passed transaction and timeout
func NewOrderingAndFinalityView ¶
func NewOrderingAndFinalityView(tx *Transaction) view.View
NewOrderingAndFinalityView returns a view that does the following: 1. Sends the passed transaction to the ordering service. 2. Waits for the finality of the transaction.
func NewOrderingAndFinalityWithTimeoutView ¶
func NewOrderingAndFinalityWithTimeoutView(tx *Transaction, timeout time.Duration) view.View
func NewParallelCollectEndorsementsOnProposalView ¶
func NewParallelCollectEndorsementsOnProposalView(tx *Transaction, parties ...view.Identity) view.View
func NewPayloadReceiveView ¶
func NewPayloadReceiveView() *payloadReceiveView
func NewReceiveTransactionView ¶
func NewReceiveTransactionView() *receiveTransactionView
func NewReceiveView ¶
func NewReceiveView(state interface{}) *receiveView
func NewReplyView ¶
func NewReplyView(state interface{}) *replyView
func NewRespondRequestRecipientIdentityView ¶
NewRespondRequestRecipientIdentityView returns a new instance of RespondRequestRecipientIdentityView
func NewSendReceiveView ¶
func NewSendTransactionBackView ¶
func NewSendTransactionBackView(tx *Transaction) *sendTransactionBackView
func NewSendTransactionView ¶
func NewSendTransactionView(tx *Transaction, parties ...view.Identity) *sendTransactionView
func RespondExchangeRecipientIdentities ¶
func RespondExchangeRecipientIdentities(context view.Context, opts ...ServiceOption) (view.Identity, view.Identity, error)
RespondExchangeRecipientIdentities runs the RespondExchangeRecipientIdentitiesView
func RespondRequestRecipientIdentity ¶
RespondRequestRecipientIdentity runs the RespondRequestRecipientIdentityView and returns the identity sent to the requester. In this case, the identity used is the one returned by fabric.GetFabricNetworkService(context, rr.Network).IdentityProvider().DefaultIdentity()a
func SetCertification ¶
func SetCertification(tx TxTransientStore, id string, value []byte) error
func SetCertificationType ¶
func SetCertificationType(tx TxTransientStore, typ string, value []byte) error
func Unmarshal ¶
func Unmarshal(unmarshaller Unmarshaller, data []byte, v interface{}) error
Types ¶
type AddInputOption ¶
type AddInputOption func(*addInputOptions) error
func WithCertification ¶
func WithCertification() AddInputOption
type AddOutputOption ¶
type AddOutputOption func(*addOutputOptions) error
func WithContract ¶
func WithContract(contract string) AddOutputOption
func WithHashHiding ¶
func WithHashHiding() AddOutputOption
func WithStateBasedEndorsement ¶
func WithStateBasedEndorsement() AddOutputOption
type AutoLinearState ¶
type CertificationRequest ¶
type CertificationView ¶
type CertificationView struct {
*CertificationRequest
}
type CertificationViewFactory ¶
type CertificationViewFactory struct{}
type Codec ¶
type Codec interface { Marshaller Unmarshaller }
type Command ¶
type Command struct { // Name of the commands Name string // Ids contains the identities that the command involves Ids Identities }
Command models an operation that involve given business parties
type CommonIteratorInterface ¶
type EmbeddingState ¶
type EmbeddingState interface {
GetState() interface{}
}
type EndorseTransaction ¶
type EndorseTransaction interface { }
type ExchangeRecipientIdentitiesView ¶
type ExchangeRecipientIdentitiesView struct { Network string IdentityLabel string Other view.Identity }
ExchangeRecipientIdentitiesView models the view of the initiator of an exchange of recipient identities.
type ExchangeRecipientRequest ¶
type ExchangeRecipientRequest struct { Channel string WalletID []byte RecipientData *RecipientData }
ExchangeRecipientRequest models a request of exchange of recipient identities
func (*ExchangeRecipientRequest) Bytes ¶
func (r *ExchangeRecipientRequest) Bytes() ([]byte, error)
Bytes returns the byte representation of this struct
func (*ExchangeRecipientRequest) FromBytes ¶
func (r *ExchangeRecipientRequest) FromBytes(raw []byte) error
FromBytes unmarshalls the passed bytes into this struct
type Identities ¶
func (Identities) Count ¶
func (i Identities) Count() int
Count returns the number of identities in the list
func (Identities) Filter ¶
func (i Identities) Filter(f func(identity view.Identity) bool) Identities
func (Identities) Match ¶
func (i Identities) Match(ids []view.Identity) bool
Match returns true if the list of passed identities is equal to this set of identities modulo the position of each identity.
func (Identities) Others ¶
func (i Identities) Others(me view.Identity) Identities
type LinearState ¶
type LinearState interface { // SetLinearID assigns the passed id to the state SetLinearID(id string) string }
LinearState models a state with a unique identifier that does not change through the evolution of the state.
type Marshaller ¶
type MetaHandler ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func NewNamespace ¶
func NewNamespace(tx *endorser.Transaction, forceSBE bool) *Namespace
func NewNamespaceForName ¶
func NewNamespaceForName(tx *endorser.Transaction, ns string, forceSBE bool) *Namespace
func (*Namespace) AddCommand ¶
AddCommand appends a new Command to this namespace
func (*Namespace) AddInputByLinearID ¶
func (n *Namespace) AddInputByLinearID(id string, state interface{}, opts ...AddInputOption) error
AddInputByLinearID add a reference to the state with the passed id. In addition, the function pupulates the passed state with the content of state associated to the passed id and stored in the vault. Options can be passed to change the behaviour of the function.
func (*Namespace) AddOutput ¶
func (n *Namespace) AddOutput(st interface{}, opts ...AddOutputOption) error
AddOutput adds the passed state following the passed options. This corresponds to a write entry in the RWSet
func (*Namespace) Commands ¶
func (n *Namespace) Commands() *commandStream
Commands returns a stream containing the commands in this namespace
func (*Namespace) GetInputAt ¶
GetInputAt populates the passed state with the content of the input in the passed position. The content of the input is loaded from the vault.
func (*Namespace) GetOutputAt ¶
GetOutputAt populates the passed state with the content of the output in the passed position
func (*Namespace) GetService ¶
func (*Namespace) Inputs ¶
func (n *Namespace) Inputs() *inputStream
Inputs returns a stream containing the inputs in this namespace
func (*Namespace) NumInputs ¶
NumInputs returns the number of inputs (or reads in the RWSet) contained in this namespace
func (*Namespace) NumOutputs ¶
NumOutputs returns the number of outputs (or writes in the RWSet) contained in this namespace
func (*Namespace) Outputs ¶
func (n *Namespace) Outputs() *outputStream
Outputs returns a stream containing the outputs in this namespace
func (*Namespace) SetNamespace ¶
SetNamespace sets the name of this namespace
type Namespaces ¶
type Namespaces []string
func (Namespaces) Count ¶
func (k Namespaces) Count() int
func (Namespaces) Filter ¶
func (k Namespaces) Filter(f func(k string) bool) Namespaces
func (Namespaces) Match ¶
func (k Namespaces) Match(keys Namespaces) bool
type Ownable ¶
type Ownable interface { // Owners returns the identities of the owners of this state Owners() Identities }
Ownable models an ownable state
type QueryIteratorInterface ¶
type QueryIteratorInterface interface { CommonIteratorInterface Next(state interface{}) (string, error) }
QueryIteratorInterface models a state iterator
type RWSetProcessor ¶
type RWSetProcessor struct {
// contains filtered or unexported fields
}
func NewRWSetProcessor ¶
func NewRWSetProcessor(network Network) *RWSetProcessor
type RecipientData ¶
RecipientData models the answer to a request of recipient identity
func (*RecipientData) Bytes ¶
func (r *RecipientData) Bytes() ([]byte, error)
Bytes returns the byte representation of this struct
func (*RecipientData) FromBytes ¶
func (r *RecipientData) FromBytes(raw []byte) error
FromBytes unmarshalls the passed bytes into this struct
type RecipientRequest ¶
type RecipientRequest struct { // Network identifier Network string }
RecipientRequest models a request of recipient identity
func (*RecipientRequest) Bytes ¶
func (r *RecipientRequest) Bytes() ([]byte, error)
Bytes returns the byte representation of this struct
func (*RecipientRequest) FromBytes ¶
func (r *RecipientRequest) FromBytes(raw []byte) error
FromBytes unmarshalls the passed bytes into this struct
type RespondExchangeRecipientIdentitiesView ¶
RespondExchangeRecipientIdentitiesView models the view of the responder of an exchange of recipient identities.
type RespondRequestRecipientIdentityView ¶
RespondRequestRecipientIdentityView models a view of a responder to a request of recipient identity
func (*RespondRequestRecipientIdentityView) Call ¶
func (s *RespondRequestRecipientIdentityView) Call(context view.Context) (interface{}, error)
Call does the following: 1. Reads a first message from the context's session 2. Unmarshall the message into rr = RecipientRequest 3. If the identity to send back is not set, it is set to fabric.GetFabricNetworkService(context, rr.Network).IdentityProvider().DefaultIdentity() 4. Send back marshalled RecipientData struct
type Serializable ¶
type ServiceOption ¶
type ServiceOption func(*ServiceOptions) error
ServiceOption models an option
func WithChannel ¶
func WithChannel(channel string) ServiceOption
WithChannel is a ServiceOption to set the channel
func WithIdentity ¶
func WithIdentity(identity string) ServiceOption
WithIdentity is a ServiceOption to set the identity
func WithNetwork ¶
func WithNetwork(network string) ServiceOption
WithNetwork is a ServiceOption to set the network
type ServiceOptions ¶
type ServiceOptions struct { // Network is the name of the network to use Network string // Channel is the name of the channel to use Channel string // Identity is the name of the identity to use Identity string }
ServiceOptions defines the options for the state service
func CompileServiceOptions ¶
func CompileServiceOptions(opts ...ServiceOption) (*ServiceOptions, error)
CompileServiceOptions compiles the service options
type Transaction ¶
type Transaction struct { *endorser.Transaction *Namespace }
func NewAnonymousTransaction ¶
func NewAnonymousTransaction(context view.Context) (*Transaction, error)
NewAnonymousTransaction returns a new instance of a state-based transaction that embeds a single namespace and is signed by an anonymous identity
func NewTransaction ¶
func NewTransaction(context view.Context) (*Transaction, error)
NewTransaction returns a new instance of a state-based transaction that embeds a single namespace.
func NewTransactionFromBytes ¶
func NewTransactionFromBytes(context view.Context, raw []byte) (*Transaction, error)
func ReceiveTransaction ¶
func ReceiveTransaction(context view.Context) (*Transaction, error)
ReceiveTransaction runs the receiveTransactionView that expects on the context's session a byte representation of a state transaction.
func ReceiveTransactionFrom ¶
func SendAndReceiveTransaction ¶
func SendAndReceiveTransaction(context view.Context, tx *Transaction, party view.Identity) (*Transaction, error)
func SendBackAndReceiveTransaction ¶
func SendBackAndReceiveTransaction(context view.Context, tx *Transaction) (*Transaction, error)
func Wrap ¶
func Wrap(tx *endorser.Transaction) (*Transaction, error)
type TxTransientStore ¶
type Unmarshaller ¶
type Vault ¶
type Vault interface { // GetState loads the state identified by the tuple [namespace, id] into the passed state reference. GetState(namespace string, id string, state interface{}) error GetStateCertification(namespace string, key string) ([]byte, error) GetStateByPartialCompositeID(ns string, prefix string, attrs []string) (QueryIteratorInterface, error) }
Vault models a container of states
func GetVault ¶
func GetVault(ctx view2.ServiceProvider) Vault
func GetVaultForChannel ¶
func GetVaultForChannel(ctx view2.ServiceProvider, channel string) Vault
type VaultService ¶
type VaultService interface { // Vault returns the world state for the passed channel. Vault(network string, channel string) (Vault, error) }
VaultService models a vault instance provider
func GetVaultService ¶
func GetVaultService(ctx view2.ServiceProvider) VaultService