Documentation
¶
Index ¶
- func Get(ct ContextType, params map[string]any) (types.BlockchainContext, error)
- func GetDefault(params map[string]any) (types.BlockchainContext, error)
- func Register(ct ContextType, constructor ContextConstructor) error
- func SetDefault(ct ContextType) error
- type ContextConstructor
- type ContextType
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(ct ContextType, params map[string]any) (types.BlockchainContext, error)
Get returns a new instance of the specified context type
func GetDefault ¶
func GetDefault(params map[string]any) (types.BlockchainContext, error)
GetDefault returns a new instance of the default context type
func Register ¶
func Register(ct ContextType, constructor ContextConstructor) error
Register adds a new BlockchainContext implementation to the registry
Types ¶
type ContextConstructor ¶
type ContextConstructor func(params map[string]any) types.BlockchainContext
ContextConstructor is a function type that creates a new BlockchainContext instance
type ContextType ¶
type ContextType string
ContextType represents the type of blockchain context
const ( // MemoryContextType represents in-memory context implementation MemoryContextType ContextType = "memory" // DBContextType represents database-backed context implementation DBContextType ContextType = "db" )
func DefaultContextType ¶
func DefaultContextType() ContextType
DefaultContextType returns the current default context type
func ListRegistered ¶
func ListRegistered() []ContextType
ListRegistered returns a list of all registered context types
type Registry ¶
type Registry interface { // Register adds a new BlockchainContext implementation to the registry Register(ct ContextType, constructor ContextConstructor) error // SetDefault sets the default context type SetDefault(ct ContextType) error // Get returns a new instance of the specified context type Get(ct ContextType, params map[string]any) (types.BlockchainContext, error) // GetDefault returns a new instance of the default context type GetDefault(params map[string]any) (types.BlockchainContext, error) // DefaultContextType returns the current default context type DefaultContextType() ContextType // ListRegistered returns a list of all registered context types ListRegistered() []ContextType }
Registry defines the interface for managing BlockchainContext implementations
Click to show internal directories.
Click to hide internal directories.