Source Classes
See User-Defined Source for general information about implementing the UDSource
and SourceFactory
classes. This section describes information that is specific to the C++ API.
In addition to the examples in this section, see C++ Example: Cancelable UDSource.
UDSource API
The API provides the following methods for extension by subclasses:
virtual void setup(ServerInterface &srvInterface); virtual StreamState process(ServerInterface &srvInterface, DataBuffer &output)=0; virtual void cancel(ServerInterface &srvInterface); virtual void destroy(ServerInterface &srvInterface); virtual vint getSize(); virtual std::string getUri();
ContinuousUDSource API
The ContinuousUDSource
class extends UDSource
and adds the following methods for extension by subclasses:
virtual void initialize(ServerInterface &srvInterface); virtual void run(); virtual void deinitialize(ServerInterface &srvInterface);
SourceFactory API
The API provides the following methods for extension by subclasses:
virtual void plan(ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt); // must implement exactly one of prepareUDSources() or prepareUDSourcesExecutor() virtual std::vector< UDSource * > prepareUDSources(ServerInterface &srvInterface, NodeSpecifyingPlanContext &planCtxt); virtual std::vector< UDSource * > prepareUDSourcesExecutor(ServerInterface &srvInterface, ExecutorPlanContext &planCtxt); virtual void getParameterType(ServerInterface &srvInterface, SizedColumnTypes ¶meterTypes); virtual bool isSourceApportionable(); ssize_t getDesiredThreads(ServerInterface &srvInterface, ExecutorPlanContext &planContext);
After creating your SourceFactory
, you must register it with the RegisterFactory
macro.