Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextProvider ¶
type FabricSmartClientNode ¶
type FabricSmartClientNode interface {
ServiceProvider
ViewRegistry
ContextProvider
ViewClient
Start() error
Stop()
}
type Factory ¶
type Factory interface {
// NewView returns an instance of the View interface build using the passed argument.
NewView(in []byte) (view.View, error)
}
Factory is used to create instances of the View interface
type ServiceOption ¶
type ServiceOption func(*ServiceOptions) error
func WithChannel ¶
func WithChannel(channel string) ServiceOption
func WithNetwork ¶
func WithNetwork(network string) ServiceOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ServiceOption
type ServiceOptions ¶
func CompileServiceOptions ¶
func CompileServiceOptions(opts ...ServiceOption) (*ServiceOptions, error)
type ServiceProvider ¶
type ViewClient ¶
type ViewClient interface {
// CallView takes in input a view factory identifier, fid, and an input, in, and invokes the
// factory f bound to fid on input in. The view returned by the factory is invoked on
// a freshly created context. This call is blocking until the result is produced or
// an error is returned.
CallView(fid string, in []byte) (interface{}, error)
// Initiate takes in input a view factory identifier, fid, and an input, in, and invokes the
// factory f bound to fid on input in. The view returned by the factory is invoked on
// a freshly created context whose identifier, cid, is immediately returned.
// This call is non-blocking.
Initiate(fid string, in []byte) (string, error)
// Track takes in input a context identifier, cid, and returns the latest
// status of the context as set by the views using it.
Track(cid string) string
// IsTxFinal takes in input a transaction id and return nil if the transaction has been committed,
// an error otherwise.
IsTxFinal(txid string, opts ...ServiceOption) error
}
type ViewRegistry ¶
type ViewRegistry interface {
// RegisterFactory binds an id to a View Factory
RegisterFactory(id string, factory Factory) error
// RegisterResponder binds a responder to an initiator.
// The responder is the view that will be called when the initiator (initiatedBy) contacts the FSC node where
// this RegisterResponder is invoked.
// The argument initiatedBy can be a view or a view identifier.
// If a view is passed, its identifier is computed and used to register the responder.
RegisterResponder(responder view.View, initiatedBy interface{}) error
// RegisterResponderWithIdentity binds the pair <responder, id> to an initiator.
// The responder is the view that will be called when the initiator (initiatedBy) contacts the FSC node where
// this RegisterResponderWithIdentity is invoked.
// The argument initiatedBy can be a view or a view identifier.
// If a view is passed, its identifier is computed and used to register the responder.
RegisterResponderWithIdentity(responder view.View, id view.Identity, initiatedBy view.View) error
}
ViewRegistry keeps track of the available views and view factories
Click to show internal directories.
Click to hide internal directories.