Package io.dapr.actors.runtime
Class ActorStateManager
java.lang.Object
io.dapr.actors.runtime.ActorStateManager
Manages state changes of a given Actor instance.
All changes are cached in-memory until save() is called.
-
Method Summary
Modifier and TypeMethodDescription<T> reactor.core.publisher.Mono<Void>Adds a given key/value to the Actor's state store's cache.voidclear()Clears all changes not yet saved to state store.reactor.core.publisher.Mono<Boolean>Checks if a given state exists in state store or cache.<T> reactor.core.publisher.Mono<T>Fetches the most recent value for the given state, including cached value.<T> reactor.core.publisher.Mono<T>Fetches the most recent value for the given state, including cached value.reactor.core.publisher.Mono<Void>Removes a given state from state store's cache.reactor.core.publisher.Mono<Void>save()Saves all changes to state store.<T> reactor.core.publisher.Mono<Void>Updates a given key/value pair in the state store's cache.
-
Method Details
-
add
Adds a given key/value to the Actor's state store's cache.- Type Parameters:
T- Type of the object being added.- Parameters:
stateName- Name of the state being added.value- Value to be added.- Returns:
- Asynchronous void operation.
-
get
Fetches the most recent value for the given state, including cached value.- Type Parameters:
T- Type being fetched.- Parameters:
stateName- Name of the state.clazz- Class type for the value being fetched.- Returns:
- Asynchronous response with fetched object.
-
get
Fetches the most recent value for the given state, including cached value.- Type Parameters:
T- Type being fetched.- Parameters:
stateName- Name of the state.type- Class type for the value being fetched.- Returns:
- Asynchronous response with fetched object.
-
set
Updates a given key/value pair in the state store's cache.- Type Parameters:
T- Type of the value being set.- Parameters:
stateName- Name of the state being updated.value- Value to be set for given state.- Returns:
- Asynchronous void result.
-
remove
Removes a given state from state store's cache.- Parameters:
stateName- State being stored.- Returns:
- Asynchronous void result.
-
contains
Checks if a given state exists in state store or cache.- Parameters:
stateName- State being checked.- Returns:
- Asynchronous boolean result indicating whether state is present.
-
save
Saves all changes to state store.- Returns:
- Asynchronous void result.
-
clear
public void clear()Clears all changes not yet saved to state store.
-