State Management
Stateful
Klave enables strongly consistent stateful application through a distributed ledger that is a NoSQL key/value store. Modifying the state of your application is done through transaction and querying the state of your application is done via Query. Your application deployed on Klave is a collection of queries and transactions.
Transaction
A transaction is a request that will modify the state of your app. On Klave, transaction are executed in order (totally ordered) and strongly consistent. Transaction are deterministic by design to avoid a ledger fork and are therefore more limited in what you can do within their scope (non-deterministic business logic, etc.) compared to query. Transaction are executed on all nodes of a TEEs cluster to keep the application state synchronised. This means that transactions are more expensive to run and less scalable compared to query.
Query
A Query is a request that will not modify the state of your app. It corresponds to an eventually consistent read of the state of your app if you get data from the ledger or any other logic that are not modifying the state of your app. Query can be non-deterministic and will run on a single node of a TEEs cluster rather than the whole cluster. They are therefore less expensive to run, and more scalable (sharding by node) than transaction.
Application API
Your app's API on Klave is a collections of query and transaction. Ensure you read the SDK section to understand what are the limitations and what can be used within the context of a query or transaction.