orion

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCustodian

func GetCustodian(cp configProvider, network string) (string, error)

func InstallViews

func InstallViews(viewRegistry ResponderRegistry, dbManager *DBManager, statusCache TxStatusResponseCache) error

func IsCustodian

func IsCustodian(cp configProvider) (bool, error)

func LookupKey

func LookupKey(context view.Context, request *LookupKeyRequest) ([]byte, error)

func NewCommitterBasedFLMProvider added in v0.4.0

func NewCommitterBasedFLMProvider(onsp *orion.NetworkServiceProvider, tracerProvider trace.TracerProvider, viewManager *view2.Manager) *committerBasedFLMProvider

func NewOrionDriver added in v0.4.0

func NewOrionDriver(
	onsProvider *orion.NetworkServiceProvider,
	viewRegistry driver2.Registry,
	viewManager *view.Manager,
	vaultProvider *vault2.Provider,
	configProvider *view.ConfigService,
	configService *config.Service,
	identityProvider view2.IdentityProvider,
	filterProvider *common.AcceptTxInDBFilterProvider,
	tmsProvider *token.ManagementServiceProvider,
	tracerProvider trace.TracerProvider,
) driver.Driver

func NewSpentTokenExecutorProvider added in v0.4.0

func NewSpentTokenExecutorProvider(viewManager *view2.Manager, keyTranslator translator.KeyTranslator) *spentTokenFetcherProvider

func NewTokenExecutorProvider added in v0.4.0

func NewTokenExecutorProvider(viewManager *view2.Manager) *tokenFetcherProvider

func ReadPublicParameters

func ReadPublicParameters(context token.ServiceProvider, network, namespace string) ([]byte, error)

Types

type ApprovalRequest

type ApprovalRequest struct {
	Network   string
	Namespace string
	TxID      string
	Request   []byte
}

type ApprovalResponse

type ApprovalResponse struct {
	Envelope []byte
}

type BroadcastRequest

type BroadcastRequest struct {
	Network string
	Blob    []byte
}

type BroadcastResponderView

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

func (*BroadcastResponderView) Call

func (r *BroadcastResponderView) Call(context view.Context) (interface{}, error)

type BroadcastResponse

type BroadcastResponse struct {
	Err string
}

type BroadcastView

type BroadcastView struct {
	DBManager *DBManager
	Network   string
	Blob      interface{}
}

func NewBroadcastView

func NewBroadcastView(dbManager *DBManager, network string, blob interface{}) *BroadcastView

func (*BroadcastView) Call

func (r *BroadcastView) Call(context view.Context) (interface{}, error)

type Certification

type Certification struct {
	Interactive *InteractiveCertification `yaml:"interactive,omitempty"`
}

type Custodian

type Custodian struct {
	ID      string `yaml:"id"`
	Enabled bool   `yaml:"enabled,omitempty"`
}

type DBManager added in v0.4.0

type DBManager struct {
	OrionNetworkProvider *orion.NetworkServiceProvider
	IsCustodian          bool
	ConfigProvider       configProvider

	SMMutex         sync.RWMutex
	SessionManagers map[string]*SessionManager
}

func NewDBManager added in v0.4.0

func NewDBManager(onp *orion.NetworkServiceProvider, cp configProvider, isCustodian bool) *DBManager

func (*DBManager) GetSessionManager added in v0.4.0

func (d *DBManager) GetSessionManager(network string) (*SessionManager, error)

type Driver

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

func NewDriver added in v0.4.0

func NewDriver(
	onsProvider *orion.NetworkServiceProvider,
	viewRegistry driver2.Registry,
	viewManager *view.Manager,
	vaultProvider *vault2.Provider,
	configProvider *view.ConfigService,
	configService *config.Service,
	identityProvider view2.IdentityProvider,
	filterProvider *common.AcceptTxInDBFilterProvider,
	tmsProvider *token.ManagementServiceProvider,
	tokenQueryExecutorProvider driver.TokenQueryExecutorProvider,
	spentTokenQueryExecutorProvider driver.SpentTokenQueryExecutorProvider,
	tracerProvider trace.TracerProvider,
	keyTranslator translator.KeyTranslator,
	flmProvider FinalityListenerManagerProvider,
) *Driver

func (*Driver) New

func (d *Driver) New(network, _ string) (driver.Network, error)

type FinalityListener added in v0.4.0

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

func (*FinalityListener) OnStatus added in v0.4.0

func (t *FinalityListener) OnStatus(ctx context.Context, txID string, status int, message string)

type FinalityListenerManager added in v0.4.0

type FinalityListenerManager driver.FinalityListenerManager

type FinalityListenerManagerProvider added in v0.4.0

type FinalityListenerManagerProvider interface {
	NewManager(network string, dbManager *DBManager) (FinalityListenerManager, error)
}

type GetTMSProviderFunc added in v0.4.0

type GetTMSProviderFunc = func() *token.ManagementServiceProvider

type GetTokenRequestFunc added in v0.4.0

type GetTokenRequestFunc = func(tms *token.ManagementService, txID string) ([]byte, error)

type GetTokensFunc added in v0.4.0

type GetTokensFunc = func() (*tokens.Tokens, error)

type Identity

type Identity struct {
	ID      string `yaml:"id"`
	Default bool   `yaml:"default,omitempty"`
	Type    string `yaml:"type"`
	Path    string `yaml:"path"`
}

type IdentityProvider

type IdentityProvider interface {
	DefaultIdentity() view.Identity
}

type InteractiveCertification

type InteractiveCertification struct {
	IDs []string `yaml:"ids,omitempty"`
}

type LedgerWrapper

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

func (*LedgerWrapper) GetState

func (l *LedgerWrapper) GetState(id token2.ID) ([]byte, error)

type LookupKeyRequest

type LookupKeyRequest struct {
	Network      string
	Namespace    string
	StartingTxID string
	Key          string
	Timeout      time.Duration
}

func (*LookupKeyRequest) String

func (l *LookupKeyRequest) String() string

type LookupKeyRequestRespondView

type LookupKeyRequestRespondView struct{}

func (*LookupKeyRequestRespondView) Call

func (v *LookupKeyRequestRespondView) Call(context view.Context) (interface{}, error)

type LookupKeyRequestView

type LookupKeyRequestView struct {
	*LookupKeyRequest
}

func NewLookupKeyRequestView

func NewLookupKeyRequestView(network string, namespace string, startingTxID string, key string, timeout time.Duration) *LookupKeyRequestView

func (*LookupKeyRequestView) Call

func (v *LookupKeyRequestView) Call(context view.Context) (interface{}, error)

type LookupKeyResponse

type LookupKeyResponse struct {
	Raw []byte
}

type Network

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

func NewNetwork

func NewNetwork(
	viewManager *view2.Manager,
	tmsProvider *token2.ManagementServiceProvider,
	ip IdentityProvider,
	n *orion.NetworkService,
	newVault NewVaultFunc,
	nsFinder common2.Configuration,
	filterProvider common2.TransactionFilterProvider[*common2.AcceptTxInDBsFilter],
	dbManager *DBManager,
	flm FinalityListenerManager,
	tokenQueryExecutor driver.TokenQueryExecutor,
	spentTokenQueryExecutor driver.SpentTokenQueryExecutor,
	tracerProvider trace.TracerProvider,
	keyTranslator translator.KeyTranslator,
) *Network

func (*Network) AddFinalityListener added in v0.4.0

func (n *Network) AddFinalityListener(namespace string, txID string, listener driver.FinalityListener) error

func (*Network) AreTokensSpent

func (n *Network) AreTokensSpent(context context.Context, namespace string, tokenIDs []*token.ID, meta []string) ([]bool, error)

func (*Network) Broadcast

func (n *Network) Broadcast(ctx context.Context, blob interface{}) error

func (*Network) Channel

func (n *Network) Channel() string

func (*Network) ComputeTxID

func (n *Network) ComputeTxID(id *driver.TxID) string

func (*Network) Connect added in v0.4.0

func (n *Network) Connect(ns string) ([]token2.ServiceOption, error)

func (*Network) FetchPublicParameters

func (n *Network) FetchPublicParameters(namespace string) ([]byte, error)

func (*Network) GetTransient

func (n *Network) GetTransient(id string) (driver.TransientMap, error)

func (*Network) Ledger

func (n *Network) Ledger() (driver.Ledger, error)

func (*Network) LocalMembership

func (n *Network) LocalMembership() driver.LocalMembership

func (*Network) LookupTransferMetadataKey

func (n *Network) LookupTransferMetadataKey(namespace string, startingTxID string, key string, timeout time.Duration, _ bool) ([]byte, error)

func (*Network) Name

func (n *Network) Name() string

func (*Network) NewEnvelope

func (n *Network) NewEnvelope() driver.Envelope

func (*Network) Normalize added in v0.4.0

func (n *Network) Normalize(opt *token2.ServiceOptions) (*token2.ServiceOptions, error)

func (*Network) ProcessNamespace added in v0.3.0

func (n *Network) ProcessNamespace(namespace string) error

func (*Network) QueryTokens

func (n *Network) QueryTokens(context context.Context, namespace string, IDs []*token.ID) ([][]byte, error)

func (*Network) RemoveFinalityListener added in v0.4.0

func (n *Network) RemoveFinalityListener(txID string, listener driver.FinalityListener) error

func (*Network) RequestApproval

func (n *Network) RequestApproval(context view.Context, tms *token2.ManagementService, requestRaw []byte, signer view.Identity, txID driver.TxID) (driver.Envelope, error)

func (*Network) StoreTransient

func (n *Network) StoreTransient(id string, transient driver.TransientMap) error

func (*Network) TokenVault added in v0.4.0

func (n *Network) TokenVault(namespace string) (driver.TokenVault, error)

func (*Network) TransientExists

func (n *Network) TransientExists(id string) bool

type NewVaultFunc added in v0.4.0

type NewVaultFunc = func(network, channel, namespace string) (driver.TokenVault, error)

type ONS

type ONS interface {
	Name() string
	MetadataService() *orion.MetadataService
}

type Orion

type Orion struct {
	Custodian *Custodian `yaml:"custodian,omitempty"`
}

type PublicParamsRequest

type PublicParamsRequest struct {
	Network   string
	Namespace string
}

type PublicParamsRequestResponderView

type PublicParamsRequestResponderView struct{}

func (*PublicParamsRequestResponderView) Call

func (v *PublicParamsRequestResponderView) Call(context view.Context) (interface{}, error)

type PublicParamsRequestView

type PublicParamsRequestView struct {
	Network   string
	Namespace string
	// contains filtered or unexported fields
}

func NewPublicParamsRequestView

func NewPublicParamsRequestView(network string, namespace string) *PublicParamsRequestView

func (*PublicParamsRequestView) Call

func (v *PublicParamsRequestView) Call(context view.Context) (interface{}, error)

type PublicParamsResponse

type PublicParamsResponse struct {
	Raw []byte
}

type QueryTokensRequest

type QueryTokensRequest struct {
	Network   string
	Namespace string
	IDs       []*token2.ID
}

type QueryTokensResponse

type QueryTokensResponse struct {
	Content [][]byte
}

type RWSWrapper

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

func NewRWSWrapper

func NewRWSWrapper(r *orion.RWSet) *RWSWrapper

func (*RWSWrapper) Bytes

func (r *RWSWrapper) Bytes() ([]byte, error)

func (*RWSWrapper) DeleteState

func (r *RWSWrapper) DeleteState(namespace string, key string) error

func (*RWSWrapper) Done

func (r *RWSWrapper) Done()

func (*RWSWrapper) Equals

func (r *RWSWrapper) Equals(right interface{}, namespace string) error

func (*RWSWrapper) GetState

func (r *RWSWrapper) GetState(namespace string, key string) ([]byte, error)

func (*RWSWrapper) SetState

func (r *RWSWrapper) SetState(namespace string, key string, value []byte) error

type RWSetProcessor

type RWSetProcessor struct {
	GetTokens       GetTokensFunc
	GetTMSProvider  GetTMSProviderFunc
	GetTokenRequest GetTokenRequestFunc
	// contains filtered or unexported fields
}

func NewTokenRWSetProcessor

func NewTokenRWSetProcessor(network string, ns string, GetTokens GetTokensFunc, GetTMSProvider GetTMSProviderFunc, GetTokenRequest GetTokenRequestFunc) *RWSetProcessor

func (*RWSetProcessor) Process

type ReadOnlyRWSWrapper

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

func (*ReadOnlyRWSWrapper) DeleteState

func (r *ReadOnlyRWSWrapper) DeleteState(namespace string, key string) error

func (*ReadOnlyRWSWrapper) GetState

func (r *ReadOnlyRWSWrapper) GetState(namespace string, key string) ([]byte, error)

func (*ReadOnlyRWSWrapper) SetState

func (r *ReadOnlyRWSWrapper) SetState(namespace string, key string, value []byte) error

type RequestApprovalResponderView

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

func (*RequestApprovalResponderView) Call

func (r *RequestApprovalResponderView) Call(context view.Context) (interface{}, error)

type RequestApprovalView

type RequestApprovalView struct {
	DBManager  *DBManager
	Network    string
	Namespace  string
	RequestRaw []byte
	Signer     view.Identity
	TxID       string
}

func NewRequestApprovalView

func NewRequestApprovalView(
	dbManager *DBManager,
	network string,
	namespace string,
	requestRaw []byte,
	signer view.Identity,
	txID string,
) *RequestApprovalView

func (*RequestApprovalView) Call

func (r *RequestApprovalView) Call(context view.Context) (interface{}, error)

type RequestQueryTokensResponderView

type RequestQueryTokensResponderView struct{}

func (*RequestQueryTokensResponderView) Call

func (r *RequestQueryTokensResponderView) Call(context view.Context) (interface{}, error)

type RequestQueryTokensView

type RequestQueryTokensView struct {
	Network   string
	Namespace string
	IDs       []*token2.ID
}

func NewRequestQueryTokensView

func NewRequestQueryTokensView(network string, namespace string, IDs []*token2.ID) *RequestQueryTokensView

func (*RequestQueryTokensView) Call

func (r *RequestQueryTokensView) Call(context view.Context) (interface{}, error)

type RequestSpentTokensResponderView

type RequestSpentTokensResponderView struct{}

func (*RequestSpentTokensResponderView) Call

func (r *RequestSpentTokensResponderView) Call(context view.Context) (interface{}, error)

type RequestSpentTokensView

type RequestSpentTokensView struct {
	Network   string
	Namespace string
	IDs       []string
}

func NewRequestSpentTokensView

func NewRequestSpentTokensView(network string, namespace string, IDs []string) *RequestSpentTokensView

func (*RequestSpentTokensView) Call

func (r *RequestSpentTokensView) Call(context view.Context) (interface{}, error)

type RequestTxStatusResponderView

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

func (*RequestTxStatusResponderView) Call

func (r *RequestTxStatusResponderView) Call(context view.Context) (interface{}, error)

type RequestTxStatusView

type RequestTxStatusView struct {
	Network   string
	Namespace string
	TxID      string
	// contains filtered or unexported fields
}

func NewRequestTxStatusView

func NewRequestTxStatusView(network string, namespace string, txID string, dbManager *DBManager) *RequestTxStatusView

func (*RequestTxStatusView) Call

func (r *RequestTxStatusView) Call(context view.Context) (interface{}, error)

type ResponderRegistry added in v0.4.0

type ResponderRegistry interface {
	RegisterResponder(responder view2.View, initiatedBy interface{}) error
}

type SessionManager added in v0.4.0

type SessionManager struct {
	Orion       *orion.NetworkService
	CustodianID string
	// contains filtered or unexported fields
}

func NewSessionManager added in v0.4.0

func NewSessionManager(dbManager *DBManager, network string) (*SessionManager, error)

func (*SessionManager) GetSession added in v0.4.0

func (s *SessionManager) GetSession() (os *orion.Session, err error)

func (*SessionManager) PublicParameters added in v0.4.0

func (s *SessionManager) PublicParameters(tds *driver.TokenDriverService, namespace string) (driver.PublicParameters, error)

func (*SessionManager) ReadPublicParameters added in v0.4.0

func (s *SessionManager) ReadPublicParameters(namespace string) ([]byte, error)

type SpentTokensRequest

type SpentTokensRequest struct {
	Network   string
	Namespace string
	IDs       []string
}

type SpentTokensResponse

type SpentTokensResponse struct {
	Flags []bool
}

type StatusFetcher added in v0.4.0

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

func NewStatusFetcher added in v0.4.0

func NewStatusFetcher(dbManager *DBManager, keyTranslator translator.KeyTranslator) *StatusFetcher

func (*StatusFetcher) FetchCode added in v0.4.0

func (r *StatusFetcher) FetchCode(network string, txID driver.TxID) (driver2.ValidationCode, error)

func (*StatusFetcher) FetchStatus added in v0.4.0

func (r *StatusFetcher) FetchStatus(network, namespace string, txID driver.TxID) (*TxStatusResponse, error)

type TMS

type TMS struct {
	Network       string         `yaml:"network,omitempty"`
	Channel       string         `yaml:"channel,omitempty"`
	Namespace     string         `yaml:"namespace,omitempty"`
	Orion         *Orion         `yaml:"orion,omitempty"`
	Certification *Certification `yaml:"certification,omitempty"`
	Wallets       *Wallets       `yaml:"wallets,omitempty"`
}

type Transaction added in v0.4.0

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

func (*Transaction) Channel added in v0.4.0

func (t *Transaction) Channel() string

func (*Transaction) ID added in v0.4.0

func (t *Transaction) ID() string

func (*Transaction) Namespace added in v0.4.0

func (t *Transaction) Namespace() string

func (*Transaction) Network added in v0.4.0

func (t *Transaction) Network() string

func (*Transaction) Request added in v0.4.0

func (t *Transaction) Request() *token.Request

type TxRWSWrapper

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

func (*TxRWSWrapper) DeleteState

func (r *TxRWSWrapper) DeleteState(namespace string, key string) error

func (*TxRWSWrapper) GetState

func (r *TxRWSWrapper) GetState(namespace string, key string) ([]byte, error)

func (*TxRWSWrapper) SetState

func (r *TxRWSWrapper) SetState(namespace string, key string, value []byte) error

type TxStatusRequest

type TxStatusRequest struct {
	Network   string
	Namespace string
	TxID      string
}

type TxStatusResponse

type TxStatusResponse struct {
	Status                driver.ValidationCode
	TokenRequestReference []byte
}

type TxStatusResponseCache added in v0.4.0

type TxStatusResponseCache interface {
	Get(key string) (*TxStatusResponse, bool)
	GetOrLoad(key string, loader func() (*TxStatusResponse, error)) (*TxStatusResponse, bool, error)
	Add(key string, value *TxStatusResponse)
}

type Wallets

type Wallets struct {
	DefaultCacheSize int         `yaml:"DefaultCacheSize,omitempty"`
	Certifiers       []*Identity `yaml:"certifiers,omitempty"`
	Owners           []*Identity `yaml:"owners,omitempty"`
	Issuers          []*Identity `yaml:"issuers,omitempty"`
	Auditors         []*Identity `yaml:"auditors,omitempty"`
}

Jump to

Keyboard shortcuts

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