State API
quixstreams.state.base.state
State
Primary interface for working with key-value state data from StreamingDataFrame
State.get
Get the value for key if key is present in the state, else default
Arguments:
key
: keydefault
: default value to return if the key is not found
Returns:
value or None if the key is not found and default
is not provided
State.set
Set value for the key.
Arguments:
key
: keyvalue
: value
State.delete
Delete value for the key.
This function always returns None
, even if value is not found.
Arguments:
key
: key
State.exists
Check if the key exists in state.
Arguments:
key
: key
Returns:
True if key exists, False otherwise
TransactionState
TransactionState.__init__
Simple key-value state to be provided into StreamingDataFrame
functions
Arguments:
transaction
: instance ofPartitionTransaction
TransactionState.get
Get the value for key if key is present in the state, else default
Arguments:
key
: keydefault
: default value to return if the key is not found
Returns:
value or None if the key is not found and default
is not provided
TransactionState.set
Set value for the key.
Arguments:
key
: keyvalue
: value
TransactionState.delete
Delete value for the key.
This function always returns None
, even if value is not found.
Arguments:
key
: key
TransactionState.exists
Check if the key exists in state.
Arguments:
key
: key
Returns:
True if key exists, False otherwise
quixstreams.state.rocksdb.options
RocksDBOptions
RocksDB database options.
Arguments:
dumps
: function to dump data to JSONloads
: function to load data from JSONopen_max_retries
: number of times to retry opening the database if it's locked by another process. To disable retrying, pass 0open_retry_backoff
: number of seconds to wait between each retry. Please seerocksdict.Options
for a complete description of other options.
RocksDBOptions.to_options
Convert parameters to rocksdict.Options
Returns:
instance of rocksdict.Options