Statestores

January 8, 2025 ยท View on GitHub

Statestores are the interface between the downstream storage/database system and the actor. They are configured by the user via environment variables or by the ActorSystem CRD (see Custom Resources section) and their sensitive data is stored in kubernetes secrets.

Below is a list of common global settings for all Statestores. These variables are automatically configured by our Kubernetes Operator Controller, but you can use them to configure your application for local development.

Environment VariableCRD AttributeSecret PropertyDefault Env ValueDefault CRD ValueMandatoryPossible Values
spec.statestore.credentialsSecretRefYes
PROXY_DATABASE_TYPEspec.statestore.typeYes
PROXY_DATABASE_NAMEdatabaseeigr-functions-dbeigr-functions-db
PROXY_DATABASE_USERNAMEusernameadminadmin
PROXY_DATABASE_SECRETpasswordadminadmin
PROXY_DATABASE_HOSThostlocalhostlocalhost
PROXY_DATABASE_PORTportadapter specificadapter specific
SPAWN_STATESTORE_KEYencryptionKeyYesopenssl rand -base64 32
PROXY_DATABASE_POOL_SIZEspec.statestore.pool.size6060
PROXY_DATABASE_QUEUE_TARGETspec.statestore.pool.queue1000010000
PROXY_DATABASE_SSLspec.statestore.sslfalsefalse
PROXY_DATABASE_SSL_VERIFYspec.statestore.ssl_verifyfalsefalse

NOTE: When running on top of Kubernetes you only need to set the CRD attributes of ActorSystem and Kubernetes secrets. The Operator will set the values of the environment variables according to the settings of these two mentioned places.

Actor State Checkpoints Restore

Spawn provides the ability to start Actors from a certain point in time. For this we use the concept of revision. A review happens whenever a state change is detected by the actor and a recording of the new state is made during a snapshot event. Each time this occurs an increment in the revision number will occur marking the state to that moment in time. Developers can therefore start any Actor from a specific point in time which is marked by a revision. How developers will do this will depend on the APIs exposed by the SDK's for each specific language, so to learn more about this feature, check the desired SDK page.

It is also worth mentioning that this feature depends on the implementation of each of our persistent storage adapters, so check the table in the section below to find out if the adapter for your database supports this feature.

Statestore Features

FeatureMariaDBMnesiaPostgres
Actor Fast key lookup:white_check_mark::white_check_mark::white_check_mark:
Actor State restore from Revision:white_check_mark::x::x:
Search by Actors Metadata:x::x::x:
Search by all changes of Actor states:white_check_mark::x::x:
Search by all Actor state changes by date:white_check_mark::x::x:
Snapshot Data Partition:white_check_mark::x::x:
State AES Encryption:white_check_mark::white_check_mark::white_check_mark:

Back to Index

Next: Activators

Previous: Custom Resources