orion

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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

This section is empty.

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 NewCommitter(c driver.Committer) *Committer

func (*Committer) AddFinalityListener added in v0.4.0

func (c *Committer) AddFinalityListener(txID string, listener FinalityListener) error

AddFinalityListener registers a listener for transaction status for the passed transaction id. If the status is already valid or invalid, the listener is called immediately. When the listener is invoked, then it is also removed. The transaction id must not be empty.

func (*Committer) AddTransactionFilter added in v0.4.0

func (c *Committer) AddTransactionFilter(filter TransactionFilter) error

AddTransactionFilter adds a new transaction filter to this commit pipeline. The transaction filter is used to check if an unknown transaction needs to be processed anyway

func (*Committer) RemoveFinalityListener added in v0.4.0

func (c *Committer) RemoveFinalityListener(txID string, listener FinalityListener) error

RemoveFinalityListener unregisters the passed listener.

type DataRead

type DataRead = driver.DataRead

type DataTx added in v0.4.0

type DataTx struct {
	// contains filtered or unexported fields
}

func (*DataTx) AddMustSignUser added in v0.4.0

func (d *DataTx) AddMustSignUser(userID string)

func (*DataTx) Commit added in v0.4.0

func (d *DataTx) Commit(sync bool) (string, error)

func (*DataTx) Delete added in v0.4.0

func (d *DataTx) Delete(db string, key string) error

func (*DataTx) Get added in v0.4.0

func (d *DataTx) Get(db string, key string) ([]byte, error)

func (*DataTx) Put added in v0.4.0

func (d *DataTx) Put(db string, key string, bytes []byte, a driver.AccessControl) error

func (*DataTx) SignAndClose added in v0.4.0

func (d *DataTx) SignAndClose() ([]byte, error)

type DataWrite

type DataWrite = driver.DataWrite

type Envelope

type Envelope struct {
	// contains filtered or unexported fields
}

func (*Envelope) Bytes

func (e *Envelope) Bytes() ([]byte, error)

func (*Envelope) Creator

func (e *Envelope) Creator() []byte

func (*Envelope) FromBytes

func (e *Envelope) FromBytes(raw []byte) error

func (*Envelope) MarshalJSON

func (e *Envelope) MarshalJSON() ([]byte, error)

func (*Envelope) Nonce

func (e *Envelope) Nonce() []byte

func (*Envelope) Results

func (e *Envelope) Results() []byte

func (*Envelope) String

func (e *Envelope) String() string

func (*Envelope) TxID

func (e *Envelope) TxID() string

func (*Envelope) UnmarshalJSON

func (e *Envelope) UnmarshalJSON(raw []byte) error

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 Finality

type Finality struct {
	// contains filtered or unexported fields
}

func (*Finality) IsFinal

func (c *Finality) IsFinal(ctx context.Context, txID string) error

type FinalityListener added in v0.4.0

type FinalityListener = driver.FinalityListener

FinalityListener is the interface that must be implemented to receive transaction status change notifications

type Flag

type Flag = driver.Flag

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 {
	// contains filtered or unexported fields
}

NetworkService models an Orion network

func GetDefaultONS

func GetDefaultONS(sp view2.ServiceProvider) (*NetworkService, error)

GetDefaultONS returns the default Orion Network Service

func GetOrionNetworkService

func GetOrionNetworkService(sp view2.ServiceProvider, id string) (*NetworkService, error)

GetOrionNetworkService returns the Orion Network Service for the passed id, nil if not found

func NewNetworkService

func NewNetworkService(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) Name

func (n *NetworkService) Name() string

Name of this network

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, error)

func NewNetworkServiceProvider

func NewNetworkServiceProvider(onsProvider driver.OrionNetworkServiceProvider) *NetworkServiceProvider

func (*NetworkServiceProvider) NetworkService

func (nsp *NetworkServiceProvider) NetworkService(id string) (*NetworkService, error)

type ProcessTransaction

type ProcessTransaction interface {
	Network() string
	ID() string
	FunctionAndParameters() (string, []string)
}

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 QueryIterator

type QueryIterator struct {
	// contains filtered or unexported fields
}

func (*QueryIterator) Next

func (i *QueryIterator) Next() (string, []byte, uint64, uint64, bool, error)

type RWSet

type RWSet struct {
	driver.RWSet
}

func NewRWSet added in v0.4.0

func NewRWSet(rws driver.RWSet) *RWSet

func (*RWSet) Equals

func (r *RWSet) Equals(rws interface{}, nss ...string) error

type Request

type Request interface {
	ID() string
}

type Session

type Session struct {
	// contains filtered or unexported fields
}

func (*Session) DataTx added in v0.4.0

func (s *Session) DataTx(id string) (*DataTx, error)

func (*Session) Ledger

func (s *Session) Ledger() (*Ledger, error)

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) Get

func (d *SessionQueryExecutor) Get(key string) ([]byte, error)

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) Commit

func (d *Transaction) Commit(sync bool) (string, error)

func (*Transaction) Delete

func (d *Transaction) Delete(db string, key string) error

func (*Transaction) Get

func (d *Transaction) Get(db string, key string) ([]byte, error)

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 TransactionFilter added in v0.4.0

type TransactionFilter = driver.TransactionFilter

TransactionFilter is used to filter unknown transactions. If the filter accepts, the transaction is processed by the commit pipeline anyway.

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)

func (*TransactionManager) NewTransactionFromSession added in v0.4.0

func (t *TransactionManager) NewTransactionFromSession(session *Session, txID string) (*Transaction, error)

type TransientMap

type TransientMap map[string][]byte

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) Set

func (m TransientMap) Set(key string, raw []byte) error

func (TransientMap) SetState

func (m TransientMap) SetState(key string, state interface{}) error

type TxID

type TxID struct {
	Nonce   []byte
	Creator []byte
}

func (*TxID) String

func (t *TxID) String() string

type Vault

type Vault interface {
	StoreEnvelope(id string, env interface{}) error
	StoreTransaction(id string, raw []byte) error
	StoreTransient(id string, tm driver.TransientMap) error
	Status(txID string) (driver.ValidationCode, string, error)
	DiscardTx(txID string, message string) error
	GetLastTxID() (string, error)
	NewRWSet(txid string) (*RWSet, error)
	GetRWSet(id string, results []byte) (*RWSet, error)
	CommitTX(ctx context.Context, txid string, block driver.BlockNum, indexInBloc driver.TxNum) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL