Struct puff_rs::context::PuffContext
source · pub struct PuffContext { /* private fields */ }Expand description
The central control structure for dispatching tasks onto coroutine workers. All tasks in the same runtime will have access to the same dispatcher. The dispatcher contains a reference to the parent Tokio Runtime as well as references to all coroutine workers.
Implementations
sourceimpl PuffContext
impl PuffContext
sourcepub fn empty(handle: Handle) -> PuffContext
pub fn empty(handle: Handle) -> PuffContext
Creates an empty RuntimeDispatcher with no active threads for testing.
sourcepub fn new(handle: Handle) -> PuffContext
pub fn new(handle: Handle) -> PuffContext
Creates a new RuntimeDispatcher using the supplied RuntimeConfig.
sourcepub fn new_with_options(
handle: Handle,
redis: Option<RedisClient>,
postgres: Option<PostgresClient>,
python_dispatcher: Option<PythonDispatcher>,
pubsub_client: Option<PubSubClient>,
task_queue_client: Option<TaskQueue>,
gql_root: Option<Arc<RootNode<'static, PuffGqlObject, PuffGqlObject, PuffGqlObject, AggroScalarValue>>>,
http_client: Option<PyHttpClient>
) -> PuffContext
pub fn new_with_options(
handle: Handle,
redis: Option<RedisClient>,
postgres: Option<PostgresClient>,
python_dispatcher: Option<PythonDispatcher>,
pubsub_client: Option<PubSubClient>,
task_queue_client: Option<TaskQueue>,
gql_root: Option<Arc<RootNode<'static, PuffGqlObject, PuffGqlObject, PuffGqlObject, AggroScalarValue>>>,
http_client: Option<PyHttpClient>
) -> PuffContext
Creates a new RuntimeDispatcher using the supplied RuntimeConfig. This function will start
the number of coroutine_threads specified in your config. Includes options.
sourcepub fn pubsub(&self) -> PubSubClient
pub fn pubsub(&self) -> PubSubClient
The global configured PubSubClient
sourcepub fn http_client(&self) -> PyHttpClient
pub fn http_client(&self) -> PyHttpClient
The global configured reqwest::Client
sourcepub fn task_queue(&self) -> TaskQueue
pub fn task_queue(&self) -> TaskQueue
The global configured PubSubClient
sourcepub fn python_dispatcher(&self) -> PythonDispatcher
pub fn python_dispatcher(&self) -> PythonDispatcher
A Handle into the multi-threaded async runtime
sourcepub fn redis(&self) -> RedisClient
pub fn redis(&self) -> RedisClient
The configured redis client. Panics if not enabled.
sourcepub fn postgres(&self) -> PostgresClient
pub fn postgres(&self) -> PostgresClient
The configured postgres client. Panics if not enabled.
Trait Implementations
sourceimpl Clone for PuffContext
impl Clone for PuffContext
sourcefn clone(&self) -> PuffContext
fn clone(&self) -> PuffContext
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more