bec_lib.connector.ConnectorBase#

class ConnectorBase(store)[source]#

Bases: PubSubInterface, StoreInterface

ConnectorBase defines the interface for a connector

Methods

delete

Delete a key

execute_pipeline

Execute a pipeline

get

Get a value

keys

Get keys that match the pattern

log_error

send an error as log

log_message

send a log message

log_warning

send a warning

lpush

Push a message to the left of the list

lrange

Get a range of values from the list

lset

Set a value in the list at the given index

pipeline

Create a pipeline for batch operations

poll_messages

Poll for new messages, receive them and execute callbacks

raise_warning

Raise a warning

raw_send

Send a raw message without using the BECMessage class

register

Register a callback for a topic or pattern

rpush

Push a message to the right of the list

send

Send a message

set

Set a value

set_and_publish

Set a value and publish it

shutdown

Shutdown the connector

unregister

Unregister a callback for a topic or pattern

xadd

Add a message to the stream

xrange

Read from the stream

xread

Read from the stream

abstract delete(topic, pipe=None)#

Delete a key

abstract execute_pipeline(pipeline)#

Execute a pipeline

abstract get(topic: str, pipe=None)#

Get a value

abstract keys(pattern: str) list#

Get keys that match the pattern

log_error(msg)[source]#

send an error as log

log_message(msg)[source]#

send a log message

log_warning(msg)[source]#

send a warning

abstract lpush(topic: str, msg: str, pipe=None, max_size: int | None = None, expire: int | None = None) None#

Push a message to the left of the list

abstract lrange(topic: str, start: int, end: int, pipe=None)#

Get a range of values from the list

abstract lset(topic: str, index: int, msg: str, pipe=None) None#

Set a value in the list at the given index

abstract pipeline()#

Create a pipeline for batch operations

abstract poll_messages(timeout=None)#

Poll for new messages, receive them and execute callbacks

raise_warning(msg)[source]#

Raise a warning

abstract raw_send(topic: str, msg: bytes) None#

Send a raw message without using the BECMessage class

abstract register(topics=None, patterns=None, cb=None, start_thread=True, **kwargs)#

Register a callback for a topic or pattern

abstract rpush(topic: str, msg: str, pipe=None) int#

Push a message to the right of the list

abstract send(topic: str, msg: BECMessage) None#

Send a message

abstract set(topic: str, msg, pipe=None, expire: int | None = None) None#

Set a value

set_and_publish(topic: str, msg, pipe=None, expire: int | None = None) None[source]#

Set a value and publish it

shutdown()[source]#

Shutdown the connector

abstract unregister(topics=None, pattern=None, cb=None)#

Unregister a callback for a topic or pattern

abstract xadd(topic: str, msg_dict: dict, max_size=None, pipe=None, expire: int | None = None)#

Add a message to the stream

abstract xrange(topic: str, min: str, max: str, count: int | None = None, pipe=None)#

Read from the stream

abstract xread(topic: str, id: str | None = None, count: int | None = None, block: int | None = None, pipe=None, from_start=False) list#

Read from the stream