Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Importers = make(map[string]Constructor)
Importers are the constructors to build importer plugins.
Functions ¶
func Register ¶
func Register(name string, constructor Constructor)
Register is used to register Constructor implementations. This mechanism allows for loose coupling between the configuration and the implementation. It is extremely similar to the way sql.DB drivers are configured and used.
Types ¶
type Constructor ¶
type Constructor interface { // New should return an instantiation of a Importer. // Configuration values should be passed and can be processed during `Init()`. New() Importer }
Constructor must be implemented by each Importer. It provides a basic no-arg constructor for instances of an ImporterImpl.
func ImporterBuilderByName ¶
func ImporterBuilderByName(name string) (Constructor, error)
ImporterBuilderByName returns a Importer constructor for the name provided
type Importer ¶
type Importer interface { // PluginMetadata implement this interface. conduit.PluginMetadata // Init will initialize each importer with a given config. This config will contain the Unmarhsalled config file specific to this plugin. // It is called during initialization of an importer plugin such as setting up network connections, file buffers etc. // Importers will also be responsible for returning a valid Genesis object pointer Init(ctx context.Context, cfg plugins.PluginConfig, logger *logrus.Logger) (*sdk.Genesis, error) // Config returns the configuration options used to create an Importer. Initialized during Init. Config() string // Close function is used for closing network connections, files, flushing buffers etc. Close() error // GetBlock given any round number-rnd fetches the block at that round // It returns an object of type BlockData defined in data GetBlock(rnd uint64) (data.BlockData, error) }
Importer defines the interface for importer plugins
type ImporterConstructorFunc ¶
type ImporterConstructorFunc func() Importer
ImporterConstructorFunc is Constructor implementation for importers
func (ImporterConstructorFunc) New ¶
func (f ImporterConstructorFunc) New() Importer
New initializes an importer constructor
Click to show internal directories.
Click to hide internal directories.