Trait dsrc::Factory
[−]
[src]
pub trait Factory { fn create(
self,
logger: &Logger,
handle: Handle,
channel: UpdateSender
) -> (Box<Dsrc>, LocalBoxFuture<(), ()>); }
A factory for data source.
This trait is used to create a data source of one kind.
Required Methods
fn create(
self,
logger: &Logger,
handle: Handle,
channel: UpdateSender
) -> (Box<Dsrc>, LocalBoxFuture<(), ()>)
self,
logger: &Logger,
handle: Handle,
channel: UpdateSender
) -> (Box<Dsrc>, LocalBoxFuture<(), ()>)
Creates a new instance of the data source.
Params
logger
: Used for general logging output. It is expected the factory creates a child logger for the new source and names it appropriately (eg. sets thecontext
variable).handle
: A handle to the core, if the data source needs to spawn some futures.channel
: A channel the data source shall push live updates into.
Result
- The new data source.
- A future signaling termination or error of the data source. The data source should
generally not terminate, as that causes termination of the whole aggregator. If there's
no meaningful way to provide such future,
futures::future::empty
might be appropriate.