public interface AddressScopedStorage
AddressScopedStorage
is used for reading and writing persistent values that is managed
by Stateful Functions for fault-tolerance and consistency.
All access to the storage is scoped to the current invoked function instance, identified by
the instance's Address
. This means that within an invocation, function instances may only
access it's own persisted values through this storage.
Modifier and Type | Method and Description |
---|---|
<T> java.util.Optional<T> |
get(ValueSpec<T> spec)
|
<T> void |
remove(ValueSpec<T> spec)
|
<T> void |
set(ValueSpec<T> spec,
T value)
|
<T> java.util.Optional<T> get(ValueSpec<T> spec)
T
- the type of the value.spec
- the ValueSpec
to read the value for.Optional.empty()
if there was not prior value set.IllegalStorageAccessException
- if the provided ValueSpec
is not recognized by
the storage (e.g., if it wasn't registered for the accessing function).<T> void set(ValueSpec<T> spec, T value)
T
- the type of the value.spec
- the ValueSpec
to write the new value for.value
- the new value to set.IllegalStorageAccessException
- if the provided ValueSpec
is not recognized by
the storage (e.g., if it wasn't registered for the accessing function).<T> void remove(ValueSpec<T> spec)
ValueSpec
, scoped to the current invoked
Address
.
After removing the value, calling get(ValueSpec)
for the same spec will return an
Optional.empty()
.
T
- the type of the value.spec
- the ValueSpec
to remove the prior value for.IllegalStorageAccessException
- if the provided ValueSpec
is not recognized by
the storage (e.g., if it wasn't registered for the accessing function).Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.