Documentation
¶
Index ¶
- type AccessControl
- type ByNum
- type Committer
- type DataRead
- type DataTx
- type DataWrite
- type DeliveryService
- type Envelope
- type EnvelopeService
- type Finality
- type Flag
- type GetStateOpt
- type Identity
- type IdentityManager
- type Ledger
- type LoadedDataTx
- type MetadataService
- type OrionNetworkService
- type OrionNetworkServiceProvider
- type ProcessTransaction
- type Processor
- type ProcessorManager
- type Query
- type QueryExecutor
- type QueryIterator
- type RWSExtractor
- type RWSet
- type Request
- type SeekEnd
- type SeekPos
- type SeekStart
- type Session
- type SessionManager
- type TXIDStore
- type TransactionManager
- type TransactionService
- type TransactionStatusChanged
- type TransientMap
- type TxID
- type TxStatusChangeListener
- type TxidIterator
- type ValidationCode
- type Vault
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessControl ¶
type AccessControl = interface{}
type ByNum ¶
type ByNum struct {
Txid string
Code ValidationCode
}
type Committer ¶
type Committer interface {
// SubscribeTxStatusChanges registers a listener for transaction status changes for the passed transaction id.
// If the transaction id is empty, the listener will be called for all transactions.
SubscribeTxStatusChanges(txID string, listener TxStatusChangeListener) error
// UnsubscribeTxStatusChanges unregisters a listener for transaction status changes for the passed transaction id.
// If the transaction id is empty, the listener will be called for all transactions.
UnsubscribeTxStatusChanges(txID string, listener TxStatusChangeListener) error
}
Committer models the committer service
type DeliveryService ¶
type DeliveryService interface {
// StartDelivery starts the delivery
StartDelivery(context.Context) error
// Stop stops delivery
Stop()
}
DeliveryService models the delivery service
type EnvelopeService ¶
type Finality ¶
type Finality interface {
// IsFinal takes in input a transaction id and waits for its confirmation.
// with the respect to the passed context that can be used to set a deadline
// for the waiting time.
IsFinal(ctx context.Context, txID string) error
// IsFinalForParties takes in input a transaction id and an array of identities.
// The identities are contacted to gather information about the finality of the
// passed transaction
IsFinalForParties(txID string, parties ...view.Identity) error
}
type GetStateOpt ¶
type GetStateOpt int
const ( FromStorage GetStateOpt = iota FromIntermediate FromBoth )
type IdentityManager ¶
type LoadedDataTx ¶
type MetadataService ¶
type MetadataService interface {
Exists(txid string) bool
StoreTransient(txid string, transientMap TransientMap) error
LoadTransient(txid string) (TransientMap, error)
}
type OrionNetworkService ¶
type OrionNetworkService interface {
Name() string
IdentityManager() IdentityManager
SessionManager() SessionManager
TransactionManager() TransactionManager
TransactionService() TransactionService
MetadataService() MetadataService
Vault() Vault
EnvelopeService() EnvelopeService
ProcessorManager() ProcessorManager
Finality() Finality
Committer() Committer
DeliveryService() DeliveryService
}
OrionNetworkService gives access to a Orion network components
type OrionNetworkServiceProvider ¶
type OrionNetworkServiceProvider interface {
Names() []string
DefaultName() string
// OrionNetworkService returns a OrionNetworkService instance for the passed parameters
OrionNetworkService(id string) (OrionNetworkService, error)
}
func GetOrionNetworkServiceProvider ¶
func GetOrionNetworkServiceProvider(ctx view2.ServiceProvider) OrionNetworkServiceProvider
type ProcessTransaction ¶
type Processor ¶
type Processor interface {
Process(req Request, tx ProcessTransaction, rws RWSet, ns string) error
}
type ProcessorManager ¶
type Query ¶
type Query interface {
// GetDataByRange executes a range query on a given database. The startKey is
// inclusive but endKey is not. When the startKey is an empty string, it denotes
// `fetch keys from the beginning` while an empty endKey denotes `fetch keys till the
// the end`. The limit denotes the number of records to be fetched in total. However,
// when the limit is set to 0, it denotes no limit. The iterator returned by
// GetDataByRange is used to retrieve the records.
GetDataByRange(dbName, startKey, endKey string, limit uint64) (QueryIterator, error)
}
Query allows the developer to perform queries over the orion database
type QueryExecutor ¶
type QueryIterator ¶
type QueryIterator interface {
// Next returns the next record. If there is no more records, it would return a nil value
// and a false value.
Next() (string, []byte, uint64, uint64, bool, error)
}
QueryIterator is an iterator over the results of a query
type RWSExtractor ¶
type RWSExtractor interface {
Extract(tx []byte) (ProcessTransaction, RWSet, error)
}
type RWSet ¶
type RWSet interface {
IsValid() error
Clear(ns string) error
// SetState sets the given value for the given namespace and key.
SetState(namespace string, key string, value []byte) error
GetState(namespace string, key string, opts ...GetStateOpt) ([]byte, error)
// DeleteState deletes the given namespace and key
DeleteState(namespace string, key string) error
GetStateMetadata(namespace, key string, opts ...GetStateOpt) (map[string][]byte, error)
// SetStateMetadata sets the metadata associated with an existing key-tuple <namespace, key>
SetStateMetadata(namespace, key string, metadata map[string][]byte) error
GetReadKeyAt(ns string, i int) (string, 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 string, i int) (string, []byte, error)
// GetWriteAt returns the i-th write (key, value) in the namespace ns of this rwset.
GetWriteAt(ns string, i int) (string, []byte, error)
// NumReads returns the number of reads in the namespace ns of this rwset.
NumReads(ns string) int
// NumWrites returns the number of writes in the namespace ns of this rwset.
NumWrites(ns string) int
// Namespaces returns the namespace labels in this rwset.
Namespaces() []string
AppendRWSet(raw []byte, nss ...string) error
Bytes() ([]byte, error)
Done()
Equals(rws interface{}, nss ...string) error
}
type Session ¶
type Session interface {
// DataTx returns a data transaction for the passed id
DataTx(txID string) (DataTx, error)
LoadDataTx(env interface{}) (LoadedDataTx, error)
Ledger() (Ledger, error)
Query() (Query, error)
}
Session let the developer access orion
type SessionManager ¶
type SessionManager interface {
// NewSession creates a new session to orion using the passed identity
NewSession(id string) (Session, error)
}
SessionManager is a session manager that allows the developer to access orion directly
type TXIDStore ¶
type TXIDStore interface {
GetLastTxID() (string, error)
Iterator(pos interface{}) (TxidIterator, error)
}
type TransactionManager ¶
type TransactionService ¶
type TransactionStatusChanged ¶
type TransactionStatusChanged struct {
ThisTopic string
TxID string
VC ValidationCode
}
TransactionStatusChanged is the message sent when the status of a transaction changes
func (*TransactionStatusChanged) Message ¶
func (t *TransactionStatusChanged) Message() interface{}
Message returns the message itself
func (*TransactionStatusChanged) Topic ¶
func (t *TransactionStatusChanged) Topic() string
Topic returns the topic for the message
type TransientMap ¶
type TxStatusChangeListener ¶
type TxStatusChangeListener interface {
// OnStatusChange is called when the status of a transaction changes
OnStatusChange(txID string, status int) error
}
TxStatusChangeListener is the interface that must be implemented to receive transaction status change notifications
type TxidIterator ¶
type ValidationCode ¶
type ValidationCode int
const ( Valid ValidationCode // Transaction is valid and committed Invalid // Transaction is invalid and has been discarded Busy // Transaction does not yet have a validity state Unknown // Transaction is unknown HasDependencies // Transaction is unknown but has known dependencies )
type Vault ¶
type Vault interface {
GetLastTxID() (string, error)
NewQueryExecutor() (QueryExecutor, error)
NewRWSet(txid string) (RWSet, error)
GetRWSet(id string, results []byte) (RWSet, error)
Status(txID string) (ValidationCode, error)
DiscardTx(txid string) error
CommitTX(txid string, block uint64, indexInBloc int) error
}
Vault models a key value store that can be updated by committing rwsets