Class FilesystemClaimCheckStore
- All Implemented Interfaces:
ClaimCheckStore
Useful where the filesystem is shared and durable — an NFS mount, a persistent volume — and the honest middle ground between a map and object storage. On a container's local disk it is the in-memory store with extra steps: the consumer is on another host and finds nothing.
Object storage is the usual right answer, and a store in front of S3 or Azure Blob Storage is three short methods. This one exists because "write it to the mount everything already has" is a real deployment and not a bad one.
Writes are atomic
The payload is written to a temporary file and moved into place. Without that, a consumer fast enough to read the key before the writer finished gets a truncated payload and a parse error somewhere unhelpful — and messaging is exactly the arrangement that makes a consumer that fast normal rather than unlikely.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
FilesystemClaimCheckStore
- Parameters:
directory- where payloads are written; created if it is not there
-
-
Method Details
-
put
Description copied from interface:ClaimCheckStoreStores a payload.- Specified by:
putin interfaceClaimCheckStore- Parameters:
content- the bytes- Returns:
- the key the message will carry, which must be unique for the life of the store
-
get
Description copied from interface:ClaimCheckStoreRedeems a claim check.- Specified by:
getin interfaceClaimCheckStore- Parameters:
key- what the message carried- Returns:
- the payload, or empty when the store no longer holds it — which is retention having expired underneath a message that outlived it
-
delete
Description copied from interface:ClaimCheckStoreRemoves a payload.Not called by the codec. Deleting on read would break the second consumer of the same message, and deleting on acknowledgement would break a replay — so when a payload may be removed is a retention decision, and retention decisions belong to whoever owns the data.
- Specified by:
deletein interfaceClaimCheckStore- Parameters:
key- what to remove
-
toString
-