Documentation ¶
Index ¶
- Constants
- func GetOrionNetworkNames(sp view2.ServiceProvider) []string
- type AccessControl
- type Committer
- type DataRead
- type DataWrite
- type Envelope
- func (e *Envelope) Bytes() ([]byte, error)
- func (e *Envelope) Creator() []byte
- func (e *Envelope) FromBytes(raw []byte) error
- func (e *Envelope) MarshalJSON() ([]byte, error)
- func (e *Envelope) Nonce() []byte
- func (e *Envelope) Results() []byte
- func (e *Envelope) String() string
- func (e *Envelope) TxID() string
- func (e *Envelope) UnmarshalJSON(raw []byte) error
- type EnvelopeService
- type Finality
- type Flag
- type GetStateOpt
- type IdentityManager
- type Ledger
- type LoadedTransaction
- func (t *LoadedTransaction) CoSignAndClose() ([]byte, error)
- func (t *LoadedTransaction) Commit() error
- func (t *LoadedTransaction) ID() string
- func (t *LoadedTransaction) MustSignUsers() []string
- func (t *LoadedTransaction) Reads() map[string][]*DataRead
- func (t *LoadedTransaction) SignedUsers() []string
- func (t *LoadedTransaction) Writes() map[string][]*DataWrite
- type MetadataService
- type NetworkService
- func (n *NetworkService) Committer() *Committer
- func (n *NetworkService) EnvelopeService() *EnvelopeService
- func (n *NetworkService) Finality() *Finality
- func (n *NetworkService) IdentityManager() *IdentityManager
- func (n *NetworkService) MetadataService() *MetadataService
- func (n *NetworkService) Name() string
- func (n *NetworkService) ProcessorManager() *ProcessorManager
- func (n *NetworkService) SessionManager() *SessionManager
- func (n *NetworkService) TransactionManager() *TransactionManager
- func (n *NetworkService) Vault() *Vault
- type NetworkServiceProvider
- type ProcessTransaction
- type ProcessedTransaction
- type Processor
- type ProcessorManager
- type QueryExecutor
- func (qe *QueryExecutor) Done()
- func (qe *QueryExecutor) GetState(namespace string, key string) ([]byte, error)
- func (qe *QueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, uint64, uint64, error)
- func (qe *QueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (*ResultsIterator, error)
- type QueryIterator
- type RWSet
- func (r *RWSet) AppendRWSet(raw []byte, nss ...string) error
- func (r *RWSet) Bytes() ([]byte, error)
- func (r *RWSet) Clear(ns string) error
- func (r *RWSet) DeleteState(namespace string, key string) error
- func (r *RWSet) Done()
- func (r *RWSet) Equals(rws interface{}, nss ...string) error
- func (r *RWSet) GetReadAt(ns string, i int) (string, []byte, error)
- func (r *RWSet) GetReadKeyAt(ns string, i int) (string, error)
- func (r *RWSet) GetState(namespace string, key string, opts ...GetStateOpt) ([]byte, error)
- func (r *RWSet) GetStateMetadata(namespace, key string, opts ...GetStateOpt) (map[string][]byte, error)
- func (r *RWSet) GetWriteAt(ns string, i int) (string, []byte, error)
- func (r *RWSet) IsValid() error
- func (r *RWSet) Namespaces() []string
- func (r *RWSet) NumReads(ns string) int
- func (r *RWSet) NumWrites(ns string) int
- func (r *RWSet) RWS() driver.RWSet
- func (r *RWSet) SetState(namespace string, key string, value []byte) error
- func (r *RWSet) SetStateMetadata(namespace, key string, metadata map[string][]byte) error
- type Read
- type Request
- type ResultsIterator
- type Session
- type SessionManager
- type SessionQueryExecutor
- type Transaction
- func (d *Transaction) AddMustSignUser(userID string)
- func (d *Transaction) Commit(sync bool) (string, error)
- func (d *Transaction) Delete(db string, key string) error
- func (d *Transaction) Get(db string, key string) ([]byte, error)
- func (d *Transaction) Put(db string, key string, bytes []byte, a AccessControl) error
- func (d *Transaction) SignAndClose() ([]byte, error)
- type TransactionManager
- func (t *TransactionManager) CommitEnvelope(session *Session, envelope *Envelope) error
- func (t *TransactionManager) ComputeTxID(id *TxID) string
- func (t *TransactionManager) NewEnvelope() *Envelope
- func (t *TransactionManager) NewLoadedTransaction(env []byte, creator string) (*LoadedTransaction, error)
- func (t *TransactionManager) NewTransaction(txID string, creator string) (*Transaction, error)
- type TransientMap
- func (m TransientMap) Exists(key string) bool
- func (m TransientMap) Get(id string) []byte
- func (m TransientMap) GetState(key string, state interface{}) error
- func (m TransientMap) IsEmpty() bool
- func (m TransientMap) Set(key string, raw []byte) error
- func (m TransientMap) SetState(key string, state interface{}) error
- type TxID
- type TxStatusChangeListener
- type ValidationCode
- type Vault
- func (v *Vault) CommitTX(txid string, block uint64, indexInBloc int) error
- func (v *Vault) DiscardTx(txID string) error
- func (v *Vault) GetLastTxID() (string, error)
- func (v *Vault) GetRWSet(id string, results []byte) (*RWSet, error)
- func (v *Vault) NewQueryExecutor() (*QueryExecutor, error)
- func (v *Vault) NewRWSet(txid string) (*RWSet, error)
- func (v *Vault) Status(txID string) (ValidationCode, error)
- func (v *Vault) StoreEnvelope(id string, env []byte) error
- func (v *Vault) StoreTransaction(id string, raw []byte) error
- func (v *Vault) StoreTransient(id string, tm TransientMap) error
Constants ¶
const ( VALID = driver.VALID INVALID_MVCC_CONFLICT_WITHIN_BLOCK INVALID_MVCC_CONFLICT_WITH_COMMITTED_STATE INVALID_DATABASE_DOES_NOT_EXIST INVALID_NO_PERMISSION INVALID_INCORRECT_ENTRIES INVALID_UNAUTHORISED INVALID_MISSING_SIGNATURE )
Variables ¶
This section is empty.
Functions ¶
func GetOrionNetworkNames ¶
func GetOrionNetworkNames(sp view2.ServiceProvider) []string
Types ¶
type AccessControl ¶
type AccessControl = driver.AccessControl
type Committer ¶
type Committer struct {
// contains filtered or unexported fields
}
Committer models the committer service
func NewCommitter ¶
func (*Committer) SubscribeTxStatusChanges ¶
func (c *Committer) SubscribeTxStatusChanges(txID string, listener TxStatusChangeListener) error
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.
func (*Committer) UnsubscribeTxStatusChanges ¶
func (c *Committer) UnsubscribeTxStatusChanges(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.
type Envelope ¶
type Envelope struct {
// contains filtered or unexported fields
}
func (*Envelope) MarshalJSON ¶
func (*Envelope) UnmarshalJSON ¶
type EnvelopeService ¶
type EnvelopeService struct {
// contains filtered or unexported fields
}
func (*EnvelopeService) Exists ¶
func (e *EnvelopeService) Exists(txid string) bool
func (*EnvelopeService) LoadEnvelope ¶
func (e *EnvelopeService) LoadEnvelope(txid string) ([]byte, error)
func (*EnvelopeService) StoreEnvelope ¶
func (e *EnvelopeService) StoreEnvelope(txid string, env interface{}) error
type GetStateOpt ¶
type GetStateOpt int
const ( FromStorage GetStateOpt = iota FromIntermediate FromBoth )
type IdentityManager ¶
type IdentityManager struct {
// contains filtered or unexported fields
}
func (*IdentityManager) Me ¶
func (im *IdentityManager) Me() string
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
func (*Ledger) GetTransactionByID ¶
func (l *Ledger) GetTransactionByID(txID string) (*ProcessedTransaction, error)
type LoadedTransaction ¶
type LoadedTransaction struct {
// contains filtered or unexported fields
}
func (*LoadedTransaction) CoSignAndClose ¶
func (t *LoadedTransaction) CoSignAndClose() ([]byte, error)
func (*LoadedTransaction) Commit ¶
func (t *LoadedTransaction) Commit() error
func (*LoadedTransaction) ID ¶
func (t *LoadedTransaction) ID() string
func (*LoadedTransaction) MustSignUsers ¶
func (t *LoadedTransaction) MustSignUsers() []string
func (*LoadedTransaction) Reads ¶
func (t *LoadedTransaction) Reads() map[string][]*DataRead
func (*LoadedTransaction) SignedUsers ¶
func (t *LoadedTransaction) SignedUsers() []string
func (*LoadedTransaction) Writes ¶
func (t *LoadedTransaction) Writes() map[string][]*DataWrite
type MetadataService ¶
type MetadataService struct {
// contains filtered or unexported fields
}
func (*MetadataService) Exists ¶
func (m *MetadataService) Exists(txid string) bool
func (*MetadataService) LoadTransient ¶
func (m *MetadataService) LoadTransient(txid string) (TransientMap, error)
func (*MetadataService) StoreTransient ¶
func (m *MetadataService) StoreTransient(txid string, transientMap TransientMap) error
type NetworkService ¶
type NetworkService struct { SP view2.ServiceProvider // contains filtered or unexported fields }
NetworkService models a Orion Network
func GetDefaultONS ¶
func GetDefaultONS(sp view2.ServiceProvider) *NetworkService
GetDefaultONS returns the default Orion Network Service
func GetOrionNetworkService ¶
func GetOrionNetworkService(sp view2.ServiceProvider, id string) *NetworkService
GetOrionNetworkService returns the Orion Network Service for the passed id, nil if not found
func NewNetworkService ¶
func NewNetworkService(SP view2.ServiceProvider, ons driver.OrionNetworkService, name string) *NetworkService
func (*NetworkService) Committer ¶
func (n *NetworkService) Committer() *Committer
Committer returns the committer service
func (*NetworkService) EnvelopeService ¶
func (n *NetworkService) EnvelopeService() *EnvelopeService
func (*NetworkService) Finality ¶
func (n *NetworkService) Finality() *Finality
func (*NetworkService) IdentityManager ¶
func (n *NetworkService) IdentityManager() *IdentityManager
func (*NetworkService) MetadataService ¶
func (n *NetworkService) MetadataService() *MetadataService
func (*NetworkService) ProcessorManager ¶
func (n *NetworkService) ProcessorManager() *ProcessorManager
ProcessorManager returns the processor manager of this network
func (*NetworkService) SessionManager ¶
func (n *NetworkService) SessionManager() *SessionManager
func (*NetworkService) TransactionManager ¶
func (n *NetworkService) TransactionManager() *TransactionManager
TransactionManager returns the transaction manager of this network
func (*NetworkService) Vault ¶
func (n *NetworkService) Vault() *Vault
type NetworkServiceProvider ¶
type NetworkServiceProvider struct {
// contains filtered or unexported fields
}
func GetNetworkServiceProvider ¶
func GetNetworkServiceProvider(sp view2.ServiceProvider) *NetworkServiceProvider
func NewNetworkServiceProvider ¶
func NewNetworkServiceProvider(sp view2.ServiceProvider) *NetworkServiceProvider
func (*NetworkServiceProvider) NetworkService ¶
func (nsp *NetworkServiceProvider) NetworkService(id string) (*NetworkService, error)
type ProcessTransaction ¶
type ProcessedTransaction ¶
type ProcessedTransaction struct {
// contains filtered or unexported fields
}
ProcessedTransaction models a transaction that has been processed by Fabric
func (*ProcessedTransaction) TxID ¶
func (pt *ProcessedTransaction) TxID() string
TxID returns the transaction's id
func (*ProcessedTransaction) ValidationCode ¶
func (pt *ProcessedTransaction) ValidationCode() Flag
ValidationCode returns the transaction's validation code
type Processor ¶
type Processor interface {
Process(req Request, tx ProcessTransaction, rws *RWSet, ns string) error
}
type ProcessorManager ¶
type ProcessorManager struct {
// contains filtered or unexported fields
}
func (*ProcessorManager) AddProcessor ¶
func (pm *ProcessorManager) AddProcessor(ns string, p Processor) error
func (*ProcessorManager) SetDefaultProcessor ¶
func (pm *ProcessorManager) SetDefaultProcessor(p Processor) error
type QueryExecutor ¶
type QueryExecutor struct {
// contains filtered or unexported fields
}
func (*QueryExecutor) Done ¶
func (qe *QueryExecutor) Done()
func (*QueryExecutor) GetState ¶
func (qe *QueryExecutor) GetState(namespace string, key string) ([]byte, error)
func (*QueryExecutor) GetStateMetadata ¶
func (*QueryExecutor) GetStateRangeScanIterator ¶
func (qe *QueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (*ResultsIterator, error)
type QueryIterator ¶
type QueryIterator struct {
// contains filtered or unexported fields
}
type RWSet ¶
type RWSet struct {
// contains filtered or unexported fields
}
func (*RWSet) DeleteState ¶
DeleteState deletes the given namespace and key
func (*RWSet) GetReadAt ¶
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.
func (*RWSet) GetStateMetadata ¶
func (*RWSet) GetWriteAt ¶
GetWriteAt returns the i-th write (key, value) in the namespace ns of this rwset.
func (*RWSet) Namespaces ¶
Namespaces returns the namespace labels in this rwset.
type ResultsIterator ¶
type ResultsIterator struct {
// contains filtered or unexported fields
}
ResultsIterator models an query result iterator
func (*ResultsIterator) Close ¶
func (r *ResultsIterator) Close()
Close releases resources occupied by the iterator
func (*ResultsIterator) Next ¶
func (r *ResultsIterator) Next() (*Read, error)
Next returns the next item in the result set. The `QueryResult` is expected to be nil when the iterator gets exhausted
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) QueryExecutor ¶
func (s *Session) QueryExecutor(db string) (*SessionQueryExecutor, error)
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
SessionManager is a session manager that allows the developer to access orion directly
func (*SessionManager) NewSession ¶
func (sm *SessionManager) NewSession(id string) (*Session, error)
NewSession creates a new session to orion using the passed identity
type SessionQueryExecutor ¶
type SessionQueryExecutor struct {
// contains filtered or unexported fields
}
func (*SessionQueryExecutor) GetDataByRange ¶
func (d *SessionQueryExecutor) GetDataByRange(startKey, endKey string, limit uint64) (*QueryIterator, error)
GetDataByRange executes a range query. 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.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) AddMustSignUser ¶
func (d *Transaction) AddMustSignUser(userID string)
func (*Transaction) Put ¶
func (d *Transaction) Put(db string, key string, bytes []byte, a AccessControl) error
func (*Transaction) SignAndClose ¶
func (d *Transaction) SignAndClose() ([]byte, error)
type TransactionManager ¶
type TransactionManager struct {
// contains filtered or unexported fields
}
func (*TransactionManager) CommitEnvelope ¶
func (t *TransactionManager) CommitEnvelope(session *Session, envelope *Envelope) error
func (*TransactionManager) ComputeTxID ¶
func (t *TransactionManager) ComputeTxID(id *TxID) string
func (*TransactionManager) NewEnvelope ¶
func (t *TransactionManager) NewEnvelope() *Envelope
func (*TransactionManager) NewLoadedTransaction ¶
func (t *TransactionManager) NewLoadedTransaction(env []byte, creator string) (*LoadedTransaction, error)
func (*TransactionManager) NewTransaction ¶
func (t *TransactionManager) NewTransaction(txID string, creator string) (*Transaction, error)
type TransientMap ¶
func (TransientMap) Exists ¶
func (m TransientMap) Exists(key string) bool
func (TransientMap) Get ¶
func (m TransientMap) Get(id string) []byte
func (TransientMap) GetState ¶
func (m TransientMap) GetState(key string, state interface{}) error
func (TransientMap) IsEmpty ¶
func (m TransientMap) IsEmpty() bool
func (TransientMap) SetState ¶
func (m TransientMap) SetState(key string, state interface{}) error
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 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 struct {
// contains filtered or unexported fields
}
Vault models a key-value store that can be updated by committing rwsets
func (*Vault) GetLastTxID ¶
GetLastTxID returns the last transaction id committed
func (*Vault) NewQueryExecutor ¶
func (v *Vault) NewQueryExecutor() (*QueryExecutor, error)
func (*Vault) StoreTransient ¶
func (v *Vault) StoreTransient(id string, tm TransientMap) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
generic/vault/mocks
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
services
|
|