Package com.rpl.rama
Interface PState
- All Superinterfaces:
PartitionedObject
Interface for thread-safe PState clients. These are also known as "foreign PStates". A PState
client is retrieved using a
Static methods on this class implement schemas for use when declaring a PState in a module with
RamaClusterManager on a real cluster or
InProcessCluster in a test environment.
Static methods on this class implement schemas for use when declaring a PState in a module with
pstate.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder-style interface for specifying options when declaring a PState in a modulestatic interfaceBuilder-style interface for declaring options on a migrated schema declared withmigrated(java.lang.Object, java.lang.String, com.rpl.rama.ops.RamaFunction1<?, ?>)static interfaceBuilder-style interface for declaring options on PState schemas -
Method Summary
Modifier and TypeMethodDescriptionstatic PState.SchemafixedKeysSchema(Object... keyAndSchemas) Declare schema for map with different schema for each key.static PState.SchemalistSchema(PState.Schema valueSchema) Declare a list schemastatic PState.SchemalistSchema(Class valClass) Declare a list schemastatic PState.SchemamapSchema(Class keyClass, PState.Schema valueSchema) Declare a map schemastatic PState.SchemaDeclare a map schemastatic PState.MigratedSchemamigrated(Object schema, String migrationId, RamaFunction1<?, ?> migrationFunction) Declares a migration at a location in a PState schema.<T> ProxyState<T> Reactive query of PState withPaththat must navigate to exactly one value.<T> ProxyState<T> proxy(Path path, ProxyState.Callback<T> callback) Reactive query of PState withPaththat must navigate to exactly one value.<T> ProxyState<T> Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value.<T> ProxyState<T> proxy(Object partitioningKey, Path path, ProxyState.Callback<T> callback) Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value.<T> CompletableFuture<ProxyState<T>> proxyAsync(Path path) Reactive query of PState withPaththat must navigate to exactly one value.<T> CompletableFuture<ProxyState<T>> proxyAsync(Path path, ProxyState.Callback<T> callback) Reactive query of PState withPaththat must navigate to exactly one value.<T> CompletableFuture<ProxyState<T>> proxyAsync(Object partitioningKey, Path path) Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value.<T> CompletableFuture<ProxyState<T>> proxyAsync(Object partitioningKey, Path path, ProxyState.Callback<T> callback) Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value.<T> List<T> Queries PState withPath.<T> List<T> Queries PState withPathusing explicit partitioning key.<T> CompletableFuture<List<T>> selectAsync(Path path) Queries PState withPath.<T> CompletableFuture<List<T>> selectAsync(Object partitioningKey, Path path) Queries PState withPathusing explicit partitioning key.<T> TQueries PState withPaththat must navigate to exactly one value.<T> TQueries PState using explicit partitioning key withPaththat must navigate to exactly one value.<T> CompletableFuture<T> selectOneAsync(Path path) Queries PState withPaththat must navigate to exactly one value.<T> CompletableFuture<T> selectOneAsync(Object partitioningKey, Path path) Queries PState using explicit partitioning key withPaththat must navigate to exactly one value.static PState.SchemaDeclare a set schemaMethods inherited from interface com.rpl.rama.PartitionedObject
getObjectInfo
-
Method Details
-
migrated
static PState.MigratedSchema migrated(Object schema, String migrationId, RamaFunction1<?, ?> migrationFunction) Declares a migration at a location in a PState schema. This can only be used at positions within a PState that are serialized as a whole, e.g. the value of a subindexed map or the value of a top level map. Migrations are instantaneous in that after a module update all reads will return fully migrated results. The supplied migration function is applied on reads while Rama migrates the values on disk in the background.- Parameters:
schema- The new schema for this location in the PStatemigrationId- Used to determine if a migration should be restarted or continue where it left off when the module is updated mid-migration. If this remains the same, it continues where it left off. Otherwise, it restarts from the beginning of the PState.migrationFunction- A function that converts values at that position from the old schema to the new schema. It must be idempotent, as it may be called on either a migrated or unmigrated value.- Returns:
- Object for declaring options for the migrated schema
- See Also:
-
mapSchema
Declare a map schema- Parameters:
keyClass- Type of keys in mapvalueSchema- Type of values in map
-
mapSchema
Declare a map schema- Parameters:
keyClass- Type of keys in mapvalueSchema- Schema for nested data structures for map values
-
setSchema
Declare a set schema- Parameters:
valClass- Type of values in set
-
listSchema
Declare a list schema- Parameters:
valClass- Type of values in list
-
listSchema
Declare a list schema- Parameters:
valueSchema- Schema for values in list
-
fixedKeysSchema
Declare schema for map with different schema for each key. Specified keys are the only ones allowed when writing, but they're all optional. Example:PState.fixedKeysSchema("a", Long.class, "b", PState.setSchema(String.class)- Parameters:
keyAndSchemas- Alternating declarations of keys and theClassorPState.Schemaschema for that key
-
select
Queries PState withPath. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins. Blocking operation.- Type Parameters:
T- Type of navigated values- Parameters:
path- Query path- Returns:
- List of navigated values
- See Also:
-
select
Queries PState withPathusing explicit partitioning key. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins.Blocking operation.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query path- Returns:
- List of navigated values
- See Also:
-
selectOne
Queries PState withPaththat must navigate to exactly one value. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins. Blocking operation.- Type Parameters:
T- Type of navigated value- Parameters:
path- Query path- Returns:
- Navigated value
- See Also:
-
selectOne
Queries PState using explicit partitioning key withPaththat must navigate to exactly one value. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins. Blocking operation.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query path- Returns:
- Navigated value
- See Also:
-
selectAsync
Queries PState withPath. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins. Non-blocking operation.- Type Parameters:
T- Type of navigated values- Parameters:
path- Query path- Returns:
- Future for list of navigated values
- See Also:
-
selectAsync
Queries PState withPathusing explicit partitioning key. Select is allowed to yield during execution, and the query is done on a stable view of he PState at its value when the query begins. Non-blocking operation.- Type Parameters:
T- Type of navigated values- Parameters:
partitioningKey- Explicit partitioning keypath- Query path- Returns:
- Future for list of navigated values
- See Also:
-
selectOneAsync
Queries PState withPaththat must navigate to exactly one value. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins. Non-blocking operation.- Type Parameters:
T- Type of navigated value- Parameters:
path- Query path- Returns:
- Future for navigated value
- See Also:
-
selectOneAsync
Queries PState using explicit partitioning key withPaththat must navigate to exactly one value. Select is allowed to yield during execution, and the query is done on a stable view of the PState at its value when the query begins. Non-blocking operation.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query path- Returns:
- Future for navigated value
- See Also:
-
proxy
Reactive query of PState withPaththat must navigate to exactly one value. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Blocks until initial query finishes, then receives fine-grained updates to returnedProxyStatein background.- Type Parameters:
T- Type of navigated value- Parameters:
path- Query path- Returns:
- Reactive value
- See Also:
-
proxy
Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value. Blocks until initial query finishes, then receives fine-grained updates to returnedProxyStatein background.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query path- Returns:
- Reactive value
- See Also:
-
proxy
Reactive query of PState withPaththat must navigate to exactly one value. Receives fine-grained information about changes to value via provided callback. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Blocks until initial query finishes, then receives fine-grained updates in background.- Type Parameters:
T- Type of navigated value- Parameters:
path- Query pathcallback- Function that receives fine-grained information about changes. Callbacks run on a separate dedicated thread.- Returns:
- Reactive value
- See Also:
-
proxy
Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value. Receives fine-grained information about changes to value via provided callback. Blocks until initial query finishes, then receives fine-grained updates in background.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query pathcallback- Function that receives fine-grained information about changes. Callbacks run on a separate dedicated thread.- Returns:
- Reactive value
- See Also:
-
proxyAsync
Reactive query of PState withPaththat must navigate to exactly one value. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Non-blocking. OnceProxyStateis delivered to returned future, theProxyStatereceives fine-grained updates in background.- Type Parameters:
T- Type of navigated value- Parameters:
path- Query path- Returns:
- Future for reactive value
- See Also:
-
proxyAsync
Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value. Non-blocking. OnceProxyStateis delivered to returned future, theProxyStatereceives fine-grained updates in background.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query path- Returns:
- Future for reactive value
- See Also:
-
proxyAsync
Reactive query of PState withPaththat must navigate to exactly one value. Receives fine-grained information about changes to value via provided callback. If PState has more than one partition,Pathmust start withkeynavigator and query will extract that key as partitioning key. Non-blocking. OnceProxyStateis delivered to returned future, theProxyStatereceives fine-grained updates in background.- Type Parameters:
T- Type of navigated value- Parameters:
path- Query pathcallback- Function that receives fine-grained information about changes. Callbacks run on a separate dedicated thread.- Returns:
- Future for reactive value
- See Also:
-
proxyAsync
<T> CompletableFuture<ProxyState<T>> proxyAsync(Object partitioningKey, Path path, ProxyState.Callback<T> callback) Reactive query of PState using explicit partitioning key withPaththat must navigate to exactly one value. Receives fine-grained information about changes to value via provided callback. Non-blocking. OnceProxyStateis delivered to returned future, theProxyStatereceives fine-grained updates in background.- Type Parameters:
T- Type of navigated value- Parameters:
partitioningKey- Explicit partitioning keypath- Query pathcallback- Function that receives fine-grained information about changes. Callbacks run on a separate dedicated thread.- Returns:
- Future for reactive value
- See Also:
-