faust.stores.base

Base class for table storage drivers.

class faust.stores.base.Store(url: Union[str, yarl.URL], app: faust.types.app.AppT, table: faust.types.tables.CollectionT, *, table_name: str = '', key_type: Union[Type[faust.types.models.ModelT], Type[bytes], Type[str]] = None, value_type: Union[Type[faust.types.models.ModelT], Type[bytes], Type[str]] = None, key_serializer: Union[faust.types.codecs.CodecT, str, None] = None, value_serializer: Union[faust.types.codecs.CodecT, str, None] = None, options: Mapping[str, Any] = None, **kwargs: Any) → None[source]

Base class for table storage drivers.

persisted_offset(tp: faust.types.tuples.TP) → Optional[int][source]

Return the persisted offset for this topic and partition.

Return type

Optional[int]

set_persisted_offset(tp: faust.types.tuples.TP, offset: int) → None[source]

Set the persisted offset for this topic and partition.

Return type

None

async need_active_standby_for(tp: faust.types.tuples.TP) → bool[source]

Return True if we have a copy of standby from elsewhere.

Return type

bool

async on_rebalance(table: faust.types.tables.CollectionT, assigned: Set[faust.types.tuples.TP], revoked: Set[faust.types.tuples.TP], newly_assigned: Set[faust.types.tuples.TP]) → None[source]

Handle rebalancing of the cluster.

Return type

None

async on_recovery_completed(active_tps: Set[faust.types.tuples.TP], standby_tps: Set[faust.types.tuples.TP]) → None[source]

Signal that table recovery completed.

Return type

None

property label

Return short description of this store. :rtype: str

logger = <Logger faust.stores.base (WARNING)>
class faust.stores.base.SerializedStore(url: Union[str, yarl.URL], app: faust.types.app.AppT, table: faust.types.tables.CollectionT, *, table_name: str = '', key_type: Union[Type[faust.types.models.ModelT], Type[bytes], Type[str]] = None, value_type: Union[Type[faust.types.models.ModelT], Type[bytes], Type[str]] = None, key_serializer: Union[faust.types.codecs.CodecT, str, None] = None, value_serializer: Union[faust.types.codecs.CodecT, str, None] = None, options: Mapping[str, Any] = None, **kwargs: Any) → None[source]

Base class for table storage drivers requiring serialization.

apply_changelog_batch(batch: Iterable[faust.types.events.EventT], to_key: Callable[Any, KT], to_value: Callable[Any, VT]) → None[source]

Apply batch of events from changelog topic to this store.

Return type

None

keys() → collections.abc.KeysView[source]

Return view of keys in the K/V store.

Return type

KeysView

values() → collections.abc.ValuesView[source]

Return view of values in the K/V store.

Return type

ValuesView

items() → collections.abc.ItemsView[source]

Return view of items in the K/V store as (key, value) pairs.

Return type

ItemsView

clear() → None[source]

Clear all data from this K/V store.

Return type

None

logger = <Logger faust.stores.base (WARNING)>