Synchronous Client¶
-
class
pyfactcast.client.sync.
FactStore
(client=None)¶ The pythonic way of representing a factstore
- Parameters
client (Optional[RemoteFactStoreStub], optional) – A remote client stub that points towards the server. It will be provisioned on use if None. Defaults to None.
-
enumerate_namespaces
()¶ List all namespaces the current user has access to.
- Returns
All namespaces available to the current user.
- Return type
List[str]
-
enumerate_types
(namespace)¶ Provide a list of all event types of a given namespace.
- Parameters
namespace (str) – The namespace to enumerate.
- Returns
All event types in the given namespace.
- Return type
List[str]
-
publish
(*, fact, conditional=False)¶ Publishes a fact.
- Parameters
fact (Fact) – The fact to publish
conditional (bool, optional) – Whether or not the publish is conditional. Defaults to False.
- Raises
NotImplementedError – Conditional publication has not been implemented yet.
- Return type
None
-
serial_of
(*, fact_id)¶ Returns the serial id of the fact with the given UUID.
If the fact does not exist will return None.
- Parameters
fact_id (UUID) – The UUID of the fact you need a serial for.
- Returns
The serial of the fact as string or None.
- Return type
Optional[str]
-
subscribe
(*, subscription_specs, continuous=False, from_now=False, after_fact=None)¶ Creates a fact stream subscription.
- Parameters
subscription_specs (Iterable[SubscriptionSpec]) – Used select namespaces and to filter the stream for specific versions and types of events.
continuous (bool, optional) – If True the connection will stay open and stream new facts as they are received from the factstore. Defaults to False.
from_now (bool, optional) – If True events will only be retrieved from now going forward i.e. you will not get any history. Defaults to False.
after_fact (Optional[UUID], optional) – If given and it exists, you will only get facts published after the given fact instead of from the beginning of time onwards. Defaults to None.
- Returns
The resulting fact stream.
- Return type
Iterable[Fact]