Interface StateStore
- All Known Implementing Classes:
AppendLogStateStore,InMemoryStateStore,JsonFileStateStore
Modules read from and write to the store so that one AWS SDK call can affect the response to a later call. The store has no AWS knowledge — modules are responsible for translating between the AWS API protocol and store operations.
Keys follow a path-like hierarchy:
{serviceId}/{resource-type}/{name}[/{subresource}/{id}] For example:
sqs/queues/my-queue/messages/abc-123s3/buckets/my-bucket/objects/my-keysecrets/my-secret
The store does not enforce key prefixing — scoping by service ID is a module-authoring convention.
The admin REST API, CLI, and management console read from the store via get(java.lang.String) and
list(java.lang.String). They never write directly — all writes flow through module code triggered by AWS
SDK calls.
Implementations must be thread-safe. The AWS SDK may fire concurrent requests and multiple modules share the same store instance.
Values must be JSON-serialisable. A value is read back as its original concrete type,
including after a restart of a persistent store, so the type a module puts is the type it
can cast the result of get to.
-
Method Summary
Modifier and TypeMethodDescriptionvoidDelete all entries whose key begins withprefix.voidclearAll()Delete all entries in the store across all services.voidDelete a single entry.Retrieve the value stored underkey, ornullif the key does not exist.List all keys whose path begins withprefix.voidStore a value underkey.
-
Method Details
-
put
Store a value underkey. Overwrites any existing entry at the same key.- Parameters:
key- path-style key, e.g."sqs/queues/my-queue/messages/abc-123"value- the value to store; must be JSON-serialisable- Throws:
NullPointerException- ifkeyorvalueis nullCloudStubStateException- if a persistent store fails to write to disk
-
get
Retrieve the value stored underkey, ornullif the key does not exist.- Parameters:
key- path-style key- Returns:
- the stored value, or
null
-
list
List all keys whose path begins withprefix. Passing"sqs/"lists every key the SQS module has written.- Parameters:
prefix- key prefix to match- Returns:
- sorted list of matching keys; empty if none match
-
delete
Delete a single entry. No-op if the key does not exist.- Parameters:
key- the key to delete
-
clear
Delete all entries whose key begins withprefix. Passing"sqs/"clears all SQS state.- Parameters:
prefix- the key prefix to clear
-
clearAll
void clearAll()Delete all entries in the store across all services. Called by the global reset endpoint.
-