Class FDBTypedRecordStore<M extends Message>
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.FDBTypedRecordStore<M>
-
- Type Parameters:
M
- type used to represent stored records
- All Implemented Interfaces:
FDBRecordStoreBase<M>
,RecordMetaDataProvider
@API(MAINTAINED) public class FDBTypedRecordStore<M extends Message> extends Object implements FDBRecordStoreBase<M>
A type-safe record store. Takes a serializer that operates on a specific message type and an underlying record store and makes operations for reading and writing records type-safe while only operating on that one type. The record store can contain other record types which can be accessed using a different typed record store with the same underlying untyped record store.- See Also:
FDBRecordStore
,FDBRecordStoreBase
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FDBTypedRecordStore.Builder<M extends Message>
A builder forFDBTypedRecordStore
.-
Nested classes/interfaces inherited from interface com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase
FDBRecordStoreBase.BaseBuilder<M extends Message,R extends FDBRecordStoreBase<M>>, FDBRecordStoreBase.PipelineSizer, FDBRecordStoreBase.RecordExistenceCheck, FDBRecordStoreBase.StoreExistenceCheck, FDBRecordStoreBase.UserVersionChecker, FDBRecordStoreBase.VersionstampSaveBehavior
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FDBTypedRecordStore(FDBRecordStore untypedStore, RecordSerializer<M> typedSerializer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecordReadConflict(Tuple primaryKey)
Add a read conflict as if one had read the record with the given primary key.void
addRecordWriteConflict(Tuple primaryKey)
Add a write conflict as if one had modified the record with the given primary key.FDBTypedRecordStore.Builder<M>
asBuilder()
CompletableFuture<Integer>
countRecords(Tuple low, Tuple high, EndpointType lowEndpoint, EndpointType highEndpoint, byte[] continuation, ScanProperties scanProperties)
Count the number of records in the database in a range.void
deleteAllRecords()
Delete all the data in the record store.CompletableFuture<Boolean>
deleteRecordAsync(Tuple primaryKey)
Async version ofFDBRecordStoreBase.deleteRecord(com.apple.foundationdb.tuple.Tuple)
.CompletableFuture<Void>
deleteRecordsWhereAsync(QueryComponent component)
CompletableFuture<Tuple>
evaluateAggregateFunction(List<String> recordTypeNames, IndexAggregateFunction aggregateFunction, TupleRange range, IsolationLevel isolationLevel)
Evaluate anIndexAggregateFunction
against a range of the store.<T> CompletableFuture<T>
evaluateIndexRecordFunction(EvaluationContext evaluationContext, IndexRecordFunction<T> function, FDBRecord<M> record)
Evaluate aIndexRecordFunction
against a record.<T> CompletableFuture<T>
evaluateStoreFunction(EvaluationContext evaluationContext, StoreRecordFunction<T> function, FDBRecord<M> record)
Evaluate aStoreRecordFunction
against a record.FDBRecordContext
getContext()
Get the record context (transaction) to use for the record store.FDBRecordStoreBase.PipelineSizer
getPipelineSizer()
Get the function for computing the number of elements to allow in the asynchronous pipeline for an operation of the given type.RecordMetaData
getRecordMetaData()
Provide an instance ofRecordMetaData
.RecordSerializer<M>
getSerializer()
Get the serializer used to convert records into byte arrays.CompletableFuture<Long>
getSnapshotRecordCount(KeyExpression key, Key.Evaluated value)
Get the number of records in a portion of the record store determined by a group key expression.CompletableFuture<Long>
getSnapshotRecordCountForRecordType(String recordTypeName)
Get the number of records in the record store of the given record type.SubspaceProvider
getSubspaceProvider()
Get the subspace provider.FDBRecordStore
getUntypedRecordStore()
Get the untyped record store associated with this possibly typed store.CompletableFuture<FDBStoredRecord<M>>
loadRecordInternal(Tuple primaryKey, ExecuteState executeState, boolean snapshot)
static <M extends Message>
FDBTypedRecordStore.Builder<M>newBuilder()
Create a new typed record store builder.static <M extends Message>
FDBTypedRecordStore.Builder<M>newBuilder(RecordSerializer<M> serializer)
Create a new typed record store builder.static <M extends Message,U extends Message,B extends Message.Builder>
FDBTypedRecordStore.Builder<M>newBuilder(Descriptors.FieldDescriptor fieldDescriptor, Supplier<B> builderSupplier, Predicate<U> tester, Function<U,M> getter, BiConsumer<B,M> setter)
Create a new typed record store builder.static <M extends Message,U extends Message,B extends Message.Builder>
FDBTypedRecordStore.Builder<M>newBuilder(Descriptors.FileDescriptor fileDescriptor, Descriptors.FieldDescriptor fieldDescriptor, Supplier<B> builderSupplier, Predicate<U> tester, Function<U,M> getter, BiConsumer<B,M> setter)
Create a new typed record store builder.RecordQueryPlan
planQuery(RecordQuery query)
Plan a query.CompletableFuture<Void>
preloadRecordAsync(Tuple primaryKey)
Get record into FDB RYW cache.CompletableFuture<Boolean>
recordExistsAsync(Tuple primaryKey, IsolationLevel isolationLevel)
Check if a record exists in the record store with the given primary key.CompletableFuture<Void>
resolveUniquenessViolation(Index index, Tuple valueKey, Tuple primaryKey)
Removes all of the records that have the given value set as their index value (and are thus causing a uniqueness violation) except for the one that has the given primary key (if the key is notnull
).CompletableFuture<FDBStoredRecord<M>>
saveRecordAsync(M record, FDBRecordStoreBase.RecordExistenceCheck existenceCheck, FDBRecordVersion version, FDBRecordStoreBase.VersionstampSaveBehavior behavior)
RecordCursor<IndexEntry>
scanIndex(Index index, IndexScanType scanType, TupleRange range, byte[] continuation, ScanProperties scanProperties)
Scan the entries in an index.RecordCursor<FDBStoredRecord<M>>
scanRecords(Tuple low, Tuple high, EndpointType lowEndpoint, EndpointType highEndpoint, byte[] continuation, ScanProperties scanProperties)
Scan the records in the database in a range.RecordCursor<RecordIndexUniquenessViolation>
scanUniquenessViolations(Index index, TupleRange range, byte[] continuation, ScanProperties scanProperties)
Scan the list of uniqueness violations identified for an index.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase
countRecords, coveredIndexQueriedRecord, deleteRecord, deleteRecordsWhere, deleteRecordsWhere, deleteRecordsWhereAsync, evaluateAggregateFunction, evaluateAggregateFunction, evaluateRecordFunction, evaluateRecordFunction, evaluateStoreFunction, executeQuery, executeQuery, executeQuery, executeQuery, fetchIndexRecords, fetchIndexRecords, fetchIndexRecords, fetchIndexRecords, getExecutor, getPipelineSize, getSnapshotRecordCount, getSnapshotRecordUpdateCount, getSnapshotRecordUpdateCount, getTimer, getTypedRecordStore, hasIndexEntryRecord, hasIndexEntryRecord, insertRecord, insertRecordAsync, loadIndexEntryRecord, loadIndexEntryRecord, loadIndexEntryRecord, loadIndexEntryRecord, loadRecord, loadRecord, loadRecordAsync, loadRecordAsync, queriedRecord, queriedRecord, recordExists, recordExists, recordExistsAsync, resolveUniquenessViolation, saveRecord, saveRecord, saveRecord, saveRecord, saveRecord, saveRecordAsync, saveRecordAsync, saveRecordAsync, saveRecordAsync, scanIndex, scanIndexRecords, scanIndexRecords, scanIndexRecords, scanIndexRecords, scanIndexRecords, scanIndexRecords, scanIndexRecordsBetween, scanIndexRecordsEqual, scanRecords, scanRecords, scanUniquenessViolations, scanUniquenessViolations, scanUniquenessViolations, scanUniquenessViolations, scanUniquenessViolations, scanUniquenessViolations, scanUniquenessViolations, updateRecord, updateRecordAsync
-
-
-
-
Constructor Detail
-
FDBTypedRecordStore
protected FDBTypedRecordStore(@Nonnull FDBRecordStore untypedStore, @Nonnull RecordSerializer<M> typedSerializer)
-
-
Method Detail
-
getUntypedRecordStore
public FDBRecordStore getUntypedRecordStore()
Description copied from interface:FDBRecordStoreBase
Get the untyped record store associated with this possibly typed store.- Specified by:
getUntypedRecordStore
in interfaceFDBRecordStoreBase<M extends Message>
- Returns:
- an untyped record store
-
getRecordMetaData
@Nonnull public RecordMetaData getRecordMetaData()
Description copied from interface:RecordMetaDataProvider
Provide an instance ofRecordMetaData
. Implementors should assume that this method will be called frequently, so it may be necessary to cache the result if generating theRecordMetaData
is expensive.- Specified by:
getRecordMetaData
in interfaceRecordMetaDataProvider
- Returns:
- an instance of
RecordMetaData
-
getContext
@Nonnull public FDBRecordContext getContext()
Description copied from interface:FDBRecordStoreBase
Get the record context (transaction) to use for the record store.- Specified by:
getContext
in interfaceFDBRecordStoreBase<M extends Message>
- Returns:
- context the record context / transaction to use
-
getSubspaceProvider
@Nullable public SubspaceProvider getSubspaceProvider()
Description copied from interface:FDBRecordStoreBase
Get the subspace provider.- Specified by:
getSubspaceProvider
in interfaceFDBRecordStoreBase<M extends Message>
- Returns:
- the subspace provider
-
getSerializer
@Nonnull public RecordSerializer<M> getSerializer()
Description copied from interface:FDBRecordStoreBase
Get the serializer used to convert records into byte arrays.- Specified by:
getSerializer
in interfaceFDBRecordStoreBase<M extends Message>
- Returns:
- the serializer to use
-
saveRecordAsync
@Nonnull public CompletableFuture<FDBStoredRecord<M>> saveRecordAsync(@Nonnull M record, @Nonnull FDBRecordStoreBase.RecordExistenceCheck existenceCheck, @Nullable FDBRecordVersion version, @Nonnull FDBRecordStoreBase.VersionstampSaveBehavior behavior)
Description copied from interface:FDBRecordStoreBase
Async version ofFDBRecordStoreBase.saveRecord(Message, RecordExistenceCheck, FDBRecordVersion, VersionstampSaveBehavior)
.- Specified by:
saveRecordAsync
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
record
- the record to saveexistenceCheck
- when to throw an exception if a record with the same primary key does or does not already existversion
- the associated record versionbehavior
- the save behavior w.r.t. the givenversion
- Returns:
- a future that completes with the stored record form of the saved record
-
loadRecordInternal
@Nonnull public CompletableFuture<FDBStoredRecord<M>> loadRecordInternal(@Nonnull Tuple primaryKey, @Nonnull ExecuteState executeState, boolean snapshot)
- Specified by:
loadRecordInternal
in interfaceFDBRecordStoreBase<M extends Message>
-
preloadRecordAsync
@Nonnull public CompletableFuture<Void> preloadRecordAsync(@Nonnull Tuple primaryKey)
Description copied from interface:FDBRecordStoreBase
Get record into FDB RYW cache. Caller needs to hold on to result until ready or else there is a chance it will get GC'ed and cancelled before then.- Specified by:
preloadRecordAsync
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
primaryKey
- the primary key for the record to retrieve- Returns:
- a future that will return
null
when the record is preloaded
-
recordExistsAsync
@Nonnull public CompletableFuture<Boolean> recordExistsAsync(@Nonnull Tuple primaryKey, @Nonnull IsolationLevel isolationLevel)
Description copied from interface:FDBRecordStoreBase
Check if a record exists in the record store with the given primary key. This is slightly more efficient than loading the record and checking if that record isnull
as it does not have to deserialize the record, though the record's contents are still read from the database and sent over the network.- Specified by:
recordExistsAsync
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
primaryKey
- the primary key of the recordisolationLevel
- the isolation level to use when reading- Returns:
- a future that will complete to
true
if some record in record store has that primary key andfalse
otherwise
-
addRecordReadConflict
public void addRecordReadConflict(@Nonnull Tuple primaryKey)
Description copied from interface:FDBRecordStoreBase
Add a read conflict as if one had read the record with the given primary key. This will cause this transaction to fail (with aFDBExceptions.FDBStoreTransactionConflictException
) if a concurrent transaction modifies the record with the provided primary key. This call however does not require performing any reads against the database, so it is faster and cheaper to perform than a real read. Note also that read-only operations are not checked for conflicts, so if this method is called, but the transaction performs no mutations, the transaction will never be failed with the above exception. Note also that this does not check that a record with this primary key actually exists in the database.One use case is that this can be used to promote a read from
IsolationLevel.SNAPSHOT
toIsolationLevel.SERIALIZABLE
. For example, if one performs a query atIsolationLevel.SNAPSHOT
and then uses a subset of the records to determine a few other writes, then one can add conflicts to only the records actually used.This method should be used with care and is advised only for those users who need extra control over conflict ranges.
- Specified by:
addRecordReadConflict
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
primaryKey
- the primary key of the record to add a read conflict on- See Also:
Transaction.addReadConflictRange(byte[], byte[])
-
addRecordWriteConflict
public void addRecordWriteConflict(@Nonnull Tuple primaryKey)
Description copied from interface:FDBRecordStoreBase
Add a write conflict as if one had modified the record with the given primary key. This will cause any concurrent transactions to fail (with aFDBExceptions.FDBStoreTransactionConflictException
) if they read the record with the provided primary key. This call however does not require performing any writes against the database, so it is faster and cheaper to perform than a real write. Note that this does not check if a record with this primary key actually exists in the database, and it does not update any indexes associated with the record. In this way, it is identical (in terms of conflicts) with overwriting the given record with itself, though it will not induce any disk I/O or cause any watches on the modified keys to fire.This method should be used with care and is advised only for those users who need extra control over conflict ranges.
- Specified by:
addRecordWriteConflict
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
primaryKey
- the primary key of the record to add a write conflict on- See Also:
Transaction.addWriteConflictRange(byte[], byte[])
-
scanRecords
@Nonnull public RecordCursor<FDBStoredRecord<M>> scanRecords(@Nullable Tuple low, @Nullable Tuple high, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
Description copied from interface:FDBRecordStoreBase
Scan the records in the database in a range.- Specified by:
scanRecords
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
low
- low point of scan rangehigh
- high point of scan pointlowEndpoint
- whether low point is inclusive or exclusivehighEndpoint
- whether high point is inclusive or exclusivecontinuation
- any continuation from a previous scanscanProperties
- skip, limit and other scan properties- Returns:
- a cursor that will scan everything in the range, picking up at continuation, and honoring the given scan properties
-
countRecords
@Nonnull public CompletableFuture<Integer> countRecords(@Nullable Tuple low, @Nullable Tuple high, @Nonnull EndpointType lowEndpoint, @Nonnull EndpointType highEndpoint, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
Description copied from interface:FDBRecordStoreBase
Count the number of records in the database in a range.- Specified by:
countRecords
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
low
- low point of scan rangehigh
- high point of scan pointlowEndpoint
- whether low point is inclusive or exclusivehighEndpoint
- whether high point is inclusive or exclusivecontinuation
- any continuation from a previous scanscanProperties
- skip, limit and other scan properties- Returns:
- a future that will complete with the number of records in the range
-
scanIndex
@Nonnull public RecordCursor<IndexEntry> scanIndex(@Nonnull Index index, @Nonnull IndexScanType scanType, @Nonnull TupleRange range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
Description copied from interface:FDBRecordStoreBase
Scan the entries in an index.- Specified by:
scanIndex
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
index
- the index to scanscanType
- the type of scan to performrange
- range to scancontinuation
- any continuation from a previous scanscanProperties
- skip, limit and other scan properties- Returns:
- a cursor that will scan the index, picking up at continuation, and honoring the given scan properties
-
scanUniquenessViolations
@Nonnull public RecordCursor<RecordIndexUniquenessViolation> scanUniquenessViolations(@Nonnull Index index, @Nonnull TupleRange range, @Nullable byte[] continuation, @Nonnull ScanProperties scanProperties)
Description copied from interface:FDBRecordStoreBase
Scan the list of uniqueness violations identified for an index. It looks only for violations within the given range subject to the given limit and (possibly) will go in reverse. They will be returned in an order that is grouped by the index value keys that they have in common and will be ordered within the grouping by the primary key.Because of how the data are stored, each primary key that is part of a uniqueness violation will appear at most once for each index key that is causing a violation. The associated existing key is going to be one of the other keys, but it might not be the only one. This means that the total number of violations per index key is capped at the number of records in the store (rather than the square), but it also means that the existing key data is of limited help.
- Specified by:
scanUniquenessViolations
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
index
- the index to scan the uniqueness violations ofrange
- the range of tuples to include in the scancontinuation
- any continuation from a previous scanscanProperties
- skip, limit and other scan properties- Returns:
- a cursor that will return uniqueness violations stored for the given index in the given store
-
resolveUniquenessViolation
@Nonnull public CompletableFuture<Void> resolveUniquenessViolation(@Nonnull Index index, @Nonnull Tuple valueKey, @Nullable Tuple primaryKey)
Description copied from interface:FDBRecordStoreBase
Removes all of the records that have the given value set as their index value (and are thus causing a uniqueness violation) except for the one that has the given primary key (if the key is notnull
). It also cleans up the set of uniqueness violations so that none of the remaining entries will be associated with the given value key.- Specified by:
resolveUniquenessViolation
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
index
- the index to resolve uniqueness violations forvalueKey
- the value of the index that is being removedprimaryKey
- the primary key of the record that should remain (ornull
to remove all of them)- Returns:
- a future that will complete when all of the records have been removed
-
deleteRecordAsync
@Nonnull public CompletableFuture<Boolean> deleteRecordAsync(@Nonnull Tuple primaryKey)
Description copied from interface:FDBRecordStoreBase
Async version ofFDBRecordStoreBase.deleteRecord(com.apple.foundationdb.tuple.Tuple)
.- Specified by:
deleteRecordAsync
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
primaryKey
- the primary key of the record to delete- Returns:
- a future that completes
true
if the record was present to be deleted
-
deleteAllRecords
public void deleteAllRecords()
Description copied from interface:FDBRecordStoreBase
Delete all the data in the record store.Everything except the store header and index state information is cleared from the database. This is is an efficient operation as all data are contiguous. This means that any disabled or write-only index will remain in its disabled or write-only state after all of the data are cleared. If one also wants to reset all index states, one can call
FDBRecordStore.rebuildAllIndexes()
, which should complete quickly on an empty record store. If one wants to remove the record store entirely (including the store header and all index states), one should callFDBRecordStore.deleteStore(FDBRecordContext, KeySpacePath)
instead of this method.Note that, at the moment, this operation also has the side effect of resetting
MAX_EVER
andMIN_EVER
indexes. See: Issue #398.- Specified by:
deleteAllRecords
in interfaceFDBRecordStoreBase<M extends Message>
- See Also:
FDBRecordStore.deleteStore(FDBRecordContext, KeySpacePath)
,FDBRecordStore.deleteStore(FDBRecordContext, Subspace)
-
deleteRecordsWhereAsync
@Nonnull public CompletableFuture<Void> deleteRecordsWhereAsync(@Nonnull QueryComponent component)
Description copied from interface:FDBRecordStoreBase
Async version ofFDBRecordStoreBase.deleteRecordsWhereAsync(com.apple.foundationdb.record.query.expressions.QueryComponent)
.- Specified by:
deleteRecordsWhereAsync
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
component
- the query filter for records to delete efficiently- Returns:
- a future that will be complete when the delete is done
-
getPipelineSizer
@Nonnull public FDBRecordStoreBase.PipelineSizer getPipelineSizer()
Description copied from interface:FDBRecordStoreBase
Get the function for computing the number of elements to allow in the asynchronous pipeline for an operation of the given type.- Specified by:
getPipelineSizer
in interfaceFDBRecordStoreBase<M extends Message>
- Returns:
- the pipeline sizer
-
getSnapshotRecordCount
@Nonnull public CompletableFuture<Long> getSnapshotRecordCount(@Nonnull KeyExpression key, @Nonnull Key.Evaluated value)
Description copied from interface:FDBRecordStoreBase
Get the number of records in a portion of the record store determined by a group key expression. There must be a suitably groupedCOUNT
type index defined.- Specified by:
getSnapshotRecordCount
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
key
- the grouping key expressionvalue
- the value ofkey
to match- Returns:
- a future that will complete to the number of records
-
getSnapshotRecordCountForRecordType
@Nonnull public CompletableFuture<Long> getSnapshotRecordCountForRecordType(@Nonnull String recordTypeName)
Description copied from interface:FDBRecordStoreBase
Get the number of records in the record store of the given record type. The record type must have aCOUNT
index defined for it.- Specified by:
getSnapshotRecordCountForRecordType
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
recordTypeName
- record type for which to count records- Returns:
- a future that will complete to the number of records
-
evaluateIndexRecordFunction
@Nonnull public <T> CompletableFuture<T> evaluateIndexRecordFunction(@Nonnull EvaluationContext evaluationContext, @Nonnull IndexRecordFunction<T> function, @Nonnull FDBRecord<M> record)
Description copied from interface:FDBRecordStoreBase
Evaluate aIndexRecordFunction
against a record.- Specified by:
evaluateIndexRecordFunction
in interfaceFDBRecordStoreBase<M extends Message>
- Type Parameters:
T
- the type of the result- Parameters:
evaluationContext
- evaluation context containing parameter bindingsfunction
- the function to evaluaterecord
- the record to evaluate against- Returns:
- a future that will complete with the result of evaluating the function against the record
-
evaluateStoreFunction
@Nonnull public <T> CompletableFuture<T> evaluateStoreFunction(@Nonnull EvaluationContext evaluationContext, @Nonnull StoreRecordFunction<T> function, @Nonnull FDBRecord<M> record)
Description copied from interface:FDBRecordStoreBase
Evaluate aStoreRecordFunction
against a record.- Specified by:
evaluateStoreFunction
in interfaceFDBRecordStoreBase<M extends Message>
- Type Parameters:
T
- the type of the result- Parameters:
evaluationContext
- evaluation context containing parameter bindingsfunction
- the function to evaluaterecord
- the record to evaluate against- Returns:
- a future that will complete with the result of evaluating the function against the record
-
evaluateAggregateFunction
@Nonnull public CompletableFuture<Tuple> evaluateAggregateFunction(@Nonnull List<String> recordTypeNames, @Nonnull IndexAggregateFunction aggregateFunction, @Nonnull TupleRange range, @Nonnull IsolationLevel isolationLevel)
Description copied from interface:FDBRecordStoreBase
Evaluate anIndexAggregateFunction
against a range of the store.- Specified by:
evaluateAggregateFunction
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
recordTypeNames
- record types for which to find a matching indexaggregateFunction
- the function to evaluaterange
- the range of records (group) for which to evaluateisolationLevel
- whether to use snapshot reads- Returns:
- a future that will complete with the result of evaluating the aggregate
-
planQuery
@Nonnull public RecordQueryPlan planQuery(@Nonnull RecordQuery query)
Description copied from interface:FDBRecordStoreBase
Plan a query.- Specified by:
planQuery
in interfaceFDBRecordStoreBase<M extends Message>
- Parameters:
query
- the query to plan- Returns:
- a query plan
- See Also:
RecordQueryPlanner.plan(com.apple.foundationdb.record.query.RecordQuery)
-
newBuilder
@Nonnull public static <M extends Message> FDBTypedRecordStore.Builder<M> newBuilder()
Create a new typed record store builder.- Type Parameters:
M
- generated Protobuf class for the record message type- Returns:
- an uninitialized builder
-
newBuilder
@Nonnull public static <M extends Message> FDBTypedRecordStore.Builder<M> newBuilder(@Nonnull RecordSerializer<M> serializer)
Create a new typed record store builder.- Type Parameters:
M
- generated Protobuf class for the record message type- Parameters:
serializer
- a typed serializer to use- Returns:
- an uninitialized builder
-
newBuilder
@Nonnull public static <M extends Message,U extends Message,B extends Message.Builder> FDBTypedRecordStore.Builder<M> newBuilder(@Nonnull Descriptors.FieldDescriptor fieldDescriptor, @Nonnull Supplier<B> builderSupplier, @Nonnull Predicate<U> tester, @Nonnull Function<U,M> getter, @Nonnull BiConsumer<B,M> setter)
Create a new typed record store builder.- Type Parameters:
M
- generated Protobuf class for the record message typeU
- generated Protobuf class for the union messageB
- generated Protobuf class for the union message's builder- Parameters:
fieldDescriptor
- field descriptor for the union field used to hold the target record typebuilderSupplier
- builder for the union message typetester
- predicate to determine whether an instance of the union message has the target record typegetter
- accessor to get record message instance from union message instancesetter
- access to store record message instance into union message instance- Returns:
- a builder using the given functions
-
newBuilder
@Nonnull public static <M extends Message,U extends Message,B extends Message.Builder> FDBTypedRecordStore.Builder<M> newBuilder(@Nonnull Descriptors.FileDescriptor fileDescriptor, @Nonnull Descriptors.FieldDescriptor fieldDescriptor, @Nonnull Supplier<B> builderSupplier, @Nonnull Predicate<U> tester, @Nonnull Function<U,M> getter, @Nonnull BiConsumer<B,M> setter)
Create a new typed record store builder.static final FDBTypedRecordStore.Builder<MyProto.MyRecord, MyProto.RecordTypeUnion, MyProto.RecordTypeUnion.Builder> BUILDER = FDBTypedRecordStore.newBuilder( MyProto.getDescriptor(), MyProto.RecordTypeUnion.getDescriptor().findFieldByNumber(MyProto.RecordTypeUnion._MYRECORD_FIELD_NUMBER), MyProto.RecordTypeUnion::newBuilder, MyProto.RecordTypeUnion::hasMyRecord, MyProto.RecordTypeUnion::getMyRecord, MyProto.RecordTypeUnion.Builder::setMyRecord) final FDBTypedRecordStore<MyProto.MyRecord, MyProto.RecordTypeUnion, MyProto.RecordTypeUnion.Builder> store = BUILDER.copyBuilder().setContext(ctx).setSubspace(s).createOrOpen(); final MyProto.MyRecord myrec1 = store.loadRecord(pkey).getRecord();
- Type Parameters:
M
- generated Protobuf class for the record message typeU
- generated Protobuf class for the union messageB
- generated Protobuf class for the union message's builder- Parameters:
fileDescriptor
- file descriptor for all record message typesfieldDescriptor
- field descriptor for the union field used to hold the target record typebuilderSupplier
- builder for the union message typetester
- predicate to determine whether an instance of the union message has the target record typegetter
- accessor to get record message instance from union message instancesetter
- access to store record message instance into union message instance- Returns:
- a builder using the given functions
-
asBuilder
@Nonnull public FDBTypedRecordStore.Builder<M> asBuilder()
-
-