public final class GuavaDataStore<T extends Object>


The class that wraps around DataStore to provide an interface that returns ListenableFutures for DataStore reads and writes.

Summary

Nested types

public final class GuavaDataStore.Builder<T extends Object>

Builder class for a GuavaDataStore that works on a single process.

Public methods

final @NonNull ListenableFuture<@NonNull T>

Returns a ListenableFuture to get the latest persisted data.

final @NonNull ListenableFuture<@NonNull T>
updateDataAsync(@NonNull Function1<@NonNull input, @NonNull T> transform)

Returns a ListenableFuture to update the data using the provided transform.

Public methods

getDataAsync

Added in 1.2.0-alpha01
public final @NonNull ListenableFuture<@NonNull T> getDataAsync()

Returns a ListenableFuture to get the latest persisted data. It is not blocked by any ongoing updates.

updateDataAsync

Added in 1.2.0-alpha01
public final @NonNull ListenableFuture<@NonNull T> updateDataAsync(@NonNull Function1<@NonNull input, @NonNull T> transform)

Returns a ListenableFuture to update the data using the provided transform. The transform is given the latest persisted data to produce its output, which is then persisted and returned. Concurrent updates are serialized (at most one update running at a time).