Documentation
¶
Index ¶
- type AuditRegistry
- type BlockNum
- type ByNum
- type Channel
- type FinalityEvent
- type FinalityListener
- type GetStateOpt
- type ListenerManager
- type ListenerManagerProvider
- type MKey
- type Metadata
- type NamedDriver
- type Namespace
- type Network
- type PKey
- type PersistenceType
- type QueryExecutor
- type RWSet
- type RawValue
- type RawVersion
- type SeekEnd
- type SeekPos
- type SeekSet
- type SeekStart
- type SigDeserializer
- type SigRegistry
- type SigService
- type Signer
- type SigningIdentity
- type TransactionFilter
- type TxID
- type TxNum
- type TxValidationStatus
- type ValidationCode
- type ValidationCodeProvider
- type Vault
- type Verifier
- type VerifyingIdentity
- type VersionedMetadataValue
- type VersionedRead
- type VersionedResultsIterator
- type VersionedValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditRegistry ¶
type AuditRegistry interface { // RegisterAuditInfo binds the passed audit info to the passed identity RegisterAuditInfo(identity view.Identity, info []byte) error // GetAuditInfo returns the audit info associated to the passed identity, nil if not found GetAuditInfo(identity view.Identity) ([]byte, error) }
AuditRegistry models a repository of identities' audit information
type ByNum ¶
type ByNum[V comparable] struct { TxID TxID Code V Message string }
type FinalityEvent ¶
type FinalityEvent[V comparable] struct { Ctx context.Context TxID TxID ValidationCode V ValidationMessage string Block BlockNum IndexInBlock TxNum Err error }
FinalityEvent contains information about the finality of a given transaction
type FinalityListener ¶
type FinalityListener[V comparable] interface { // OnStatus is called when the status of a transaction changes, or it is already valid or invalid OnStatus(ctx context.Context, txID TxID, status V, statusMessage string) }
FinalityListener is the interface that must be implemented to receive transaction status notifications
type GetStateOpt ¶
type GetStateOpt int
const ( FromStorage GetStateOpt = iota FromIntermediate FromBoth )
type ListenerManager ¶
type ListenerManager[V comparable] interface { AddListener(txID TxID, toAdd FinalityListener[V]) error RemoveListener(txID TxID, toRemove FinalityListener[V]) InvokeListeners(event FinalityEvent[V]) TxIDs() []TxID }
type ListenerManagerProvider ¶
type ListenerManagerProvider[V comparable] interface { NewManager() ListenerManager[V] }
type NamedDriver ¶
type NamedDriver[D any] struct { Name PersistenceType Driver D }
type PersistenceType ¶
type PersistenceType string
type QueryExecutor ¶
type RWSet ¶
type RWSet interface { // IsValid returns true if this rwset is valid. // A rwset is valid if: // 1. It exists in the vault as valid // 2. All the read dependencies are satisfied by the vault IsValid() error IsClosed() bool // Clear remove the passed namespace from this rwset Clear(ns Namespace) error // AddReadAt adds a read dependency for the given namespace and key at the given version AddReadAt(ns Namespace, key string, version RawVersion) error // SetState sets the given value for the given namespace and key. SetState(namespace Namespace, key PKey, value RawValue) error GetState(namespace Namespace, key PKey, opts ...GetStateOpt) (RawValue, error) // GetDirectState accesses the state using the query executor without looking into the RWSet. // This way we can access the query executor while we have a RWSet already open avoiding nested RLocks. GetDirectState(namespace Namespace, key PKey) (RawValue, error) // DeleteState deletes the given namespace and key DeleteState(namespace Namespace, key PKey) error GetStateMetadata(namespace Namespace, key PKey, opts ...GetStateOpt) (Metadata, error) // SetStateMetadata sets the metadata associated with an existing key-tuple <namespace, key> SetStateMetadata(namespace Namespace, key PKey, metadata Metadata) error GetReadKeyAt(ns Namespace, i int) (PKey, error) // GetReadAt returns the i-th read (key, value) in the namespace ns of this rwset. // The value is loaded from the ledger, if present. If the key's version in the ledger // does not match the key's version in the read, then it returns an error. GetReadAt(ns Namespace, i int) (PKey, RawValue, error) // GetWriteAt returns the i-th write (key, value) in the namespace ns of this rwset. GetWriteAt(ns Namespace, i int) (PKey, RawValue, error) // NumReads returns the number of reads in the namespace ns of this rwset. NumReads(ns Namespace) int // NumWrites returns the number of writes in the namespace ns of this rwset. NumWrites(ns Namespace) int // Namespaces returns the namespace labels in this rwset. Namespaces() []Namespace AppendRWSet(raw []byte, nss ...Namespace) error Bytes() ([]byte, error) Done() Equals(rws interface{}, nss ...Namespace) error }
RWSet models a namespaced versioned read-write set
type RawVersion ¶
type RawVersion = []byte
type SigDeserializer ¶
type SigRegistry ¶
type SigRegistry interface { // RegisterSigner binds the passed identity to the passed signer and verifier RegisterSigner(identity view.Identity, signer Signer, verifier Verifier) error // RegisterVerifier binds the passed identity to the passed verifier RegisterVerifier(identity view.Identity, verifier Verifier) error }
type SigService ¶
type SigService interface { // GetSigner returns the signer bound to the passed identity GetSigner(identity view.Identity) (Signer, error) // GetVerifier returns the verifier bound to the passed identity GetVerifier(identity view.Identity) (Verifier, error) // GetSigningIdentity returns the signer identity bound to the passed identity GetSigningIdentity(identity view.Identity) (SigningIdentity, error) // IsMe returns true if a signer was ever registered for the passed identity IsMe(identity view.Identity) bool }
SigService models a repository of sign and verify keys.
type Signer ¶
type Signer interface { // Sign signs message bytes and returns the signature or an error on failure. Sign(message []byte) ([]byte, error) }
Signer is an interface which wraps the Sign method.
type SigningIdentity ¶
type SigningIdentity interface { VerifyingIdentity // Sign signs message bytes and returns the signature or an error on failure. Sign(message []byte) ([]byte, error) GetPublicVersion() VerifyingIdentity }
type TransactionFilter ¶
TransactionFilter is used to filter unknown transactions. If the filter accepts, the transaction is processed by the commit pipeline anyway.
type TxValidationStatus ¶
type TxValidationStatus[V comparable] struct { TxID TxID ValidationCode V Message string }
type ValidationCode ¶
type ValidationCode interface { comparable }
type ValidationCodeProvider ¶
type ValidationCodeProvider[V ValidationCode] interface { ToInt32(V) int32 FromInt32(int32) V Unknown() V Busy() V Valid() V Invalid() V NotFound() V }
type Vault ¶
type Vault[V comparable] interface { // NewQueryExecutor gives handle to a query executor. // A client can obtain more than one 'QueryExecutor's for parallel execution. // Any synchronization should be performed at the implementation level if required NewQueryExecutor() (QueryExecutor, error) // NewRWSet returns a RWSet for this ledger. // A client may obtain more than one such simulator; they are made unique // by way of the supplied txid NewRWSet(txID TxID) (RWSet, error) // GetRWSet returns a RWSet for this ledger whose content is unmarshalled // from the passed bytes. // A client may obtain more than one such simulator; they are made unique // by way of the supplied txid GetRWSet(txID TxID, rwset []byte) (RWSet, error) SetDiscarded(txID TxID, message string) error Status(txID TxID) (V, string, error) Statuses(txIDs ...TxID) ([]TxValidationStatus[V], error) // DiscardTx discards the transaction with the given transaction id. // If no error occurs, invoking Status on the same transaction id will return the Invalid flag. DiscardTx(txID TxID, message string) error CommitTX(ctx context.Context, txID TxID, block BlockNum, index TxNum) error }
Vault models a key value store that can be updated by committing rwsets
type Verifier ¶
type Verifier interface { // Verify verifies the signature over the passed message. Verify(message, sigma []byte) error }
Verifier is an interface which wraps the Verify method.
type VerifyingIdentity ¶
type VersionedMetadataValue ¶
type VersionedMetadataValue struct { Version RawVersion Metadata Metadata }
type VersionedRead ¶
type VersionedRead struct { Key PKey Raw RawValue Version RawVersion }
type VersionedResultsIterator ¶
type VersionedResultsIterator = collections.Iterator[*VersionedRead]
type VersionedValue ¶
type VersionedValue struct { Raw RawValue Version RawVersion }