Interface FDBRecordStoreBase.BaseBuilder<M extends Message,R extends FDBRecordStoreBase<M>>
-
- Type Parameters:
M
- type used to represent stored recordsR
- type of built record store
- All Known Implementing Classes:
FDBRecordStore.Builder
,FDBTypedRecordStore.Builder
- Enclosing interface:
- FDBRecordStoreBase<M extends Message>
public static interface FDBRecordStoreBase.BaseBuilder<M extends Message,R extends FDBRecordStoreBase<M>>
Builder forFDBRecordStoreBase
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description R
build()
Build the record store.FDBRecordStoreBase.BaseBuilder<M,R>
copyBuilder()
Make a copy of this builder.default R
create()
Synchronous version ofcreateAsync()
.default CompletableFuture<R>
createAsync()
Opens a newFDBRecordStore
instance in the given path with the given meta-data.default R
createOrOpen()
Synchronous version ofcreateOrOpenAsync()
.default R
createOrOpen(FDBRecordStoreBase.StoreExistenceCheck existenceCheck)
Synchronous version ofcreateOrOpenAsync(FDBRecordStoreBase.StoreExistenceCheck)
.default CompletableFuture<R>
createOrOpenAsync()
Opens aFDBRecordStore
instance in the given path with the given meta-data.CompletableFuture<R>
createOrOpenAsync(FDBRecordStoreBase.StoreExistenceCheck existenceCheck)
Opens aFDBRecordStore
instance in the given path with the given meta-data.FDBRecordContext
getContext()
Get the record context (transaction) to use for the record store.int
getFormatVersion()
Get the storage format version for this store.IndexMaintainerRegistry
getIndexMaintainerRegistry()
Get the registry of index maintainers to be used by the record store.IndexMaintenanceFilter
getIndexMaintenanceFilter()
Get theindex filter
to be used by the record store.RecordMetaDataProvider
getMetaDataProvider()
Get the provider for the record store's meta-data.FDBMetaDataStore
getMetaDataStore()
Get theFDBMetaDataStore
to use as the source of meta-data.FDBRecordStoreBase.PipelineSizer
getPipelineSizer()
Get theobject
to be used to determine the depth of pipelines run by the record store.RecordSerializer<M>
getSerializer()
Get the serializer used to convert records into byte arrays.FDBRecordStoreStateCache
getStoreStateCache()
Get the store state cache to be used by the record store.SubspaceProvider
getSubspaceProvider()
Get the subspace provider.FDBRecordStoreBase.UserVersionChecker
getUserVersionChecker()
Get thefunction
to be used to check the meta-data version of the record store.default R
open()
Synchronous version ofopenAsync()
.default CompletableFuture<R>
openAsync()
Opens an existingFDBRecordStore
instance in the given path with the given meta-data.FDBRecordStoreBase.BaseBuilder<M,R>
setContext(FDBRecordContext context)
Set the record context (transaction) to use for the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setFormatVersion(int formatVersion)
Set the storage format version for this store.FDBRecordStoreBase.BaseBuilder<M,R>
setIndexMaintainerRegistry(IndexMaintainerRegistry indexMaintainerRegistry)
Set the registry of index maintainers to be used by the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setIndexMaintenanceFilter(IndexMaintenanceFilter indexMaintenanceFilter)
Set theindex filter
to be used by the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setKeySpacePath(KeySpacePath keySpacePath)
Set the key space path to use for the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setMetaDataProvider(RecordMetaDataProvider metaDataProvider)
Set the provider for the record store's meta-data.FDBRecordStoreBase.BaseBuilder<M,R>
setMetaDataStore(FDBMetaDataStore metaDataStore)
Set theFDBMetaDataStore
to use as the source of meta-data.FDBRecordStoreBase.BaseBuilder<M,R>
setPipelineSizer(FDBRecordStoreBase.PipelineSizer pipelineSizer)
Set theobject
to be used to determine the depth of pipelines run by the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setSerializer(RecordSerializer<M> serializer)
Set the serializer used to convert records into byte arrays.FDBRecordStoreBase.BaseBuilder<M,R>
setStoreStateCache(FDBRecordStoreStateCache storeStateCache)
Set the store state cache to be used by the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setSubspace(Subspace subspace)
Set the subspace to use for the record store.FDBRecordStoreBase.BaseBuilder<M,R>
setSubspaceProvider(SubspaceProvider subspaceProvider)
Set the subspace provider from a subspace provider.FDBRecordStoreBase.BaseBuilder<M,R>
setUserVersionChecker(FDBRecordStoreBase.UserVersionChecker userVersionChecker)
Set thefunction
to be used to check the meta-data version of the record store.default R
uncheckedOpen()
Synchronous version ofuncheckedOpenAsync()
.CompletableFuture<R>
uncheckedOpenAsync()
-
-
-
Method Detail
-
getSerializer
@Nullable RecordSerializer<M> getSerializer()
Get the serializer used to convert records into byte arrays.- Returns:
- the serializer to use
-
setSerializer
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setSerializer(@Nonnull RecordSerializer<M> serializer)
Set the serializer used to convert records into byte arrays.- Parameters:
serializer
- the serializer to use- Returns:
- this builder
-
getFormatVersion
int getFormatVersion()
Get the storage format version for this store.- Returns:
- the format version to use
-
setFormatVersion
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setFormatVersion(int formatVersion)
Set the storage format version for this store. Normally, this should be set to the highest format version supported by all code that may access the record store.open()
will set the store's format version tomax(max_supported_version, current_version)
. This is to support cases where the target cannot be changed everywhere at once and some instances write the new version before others know that they are licensed to do so. It is still critically important that all instances know how to handle the new version before any instance allows it. When installing a new version of the record layer library that includes a format change, first install everywhere having arranged forsetFormatVersion(int)
to be called with the old format version. Then, after that install is complete, change to the newer version.- Parameters:
formatVersion
- the format version to use- Returns:
- this builder
-
getMetaDataProvider
@Nullable RecordMetaDataProvider getMetaDataProvider()
Get the provider for the record store's meta-data.- Returns:
- the meta-data source to use
-
setMetaDataProvider
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setMetaDataProvider(@Nullable RecordMetaDataProvider metaDataProvider)
Set the provider for the record store's meta-data. IfsetMetaDataStore(com.apple.foundationdb.record.provider.foundationdb.FDBMetaDataStore)
is also called, the provider will only be used to initialize the meta-data store when it is empty. The record store will be built using the store as its provider.- Parameters:
metaDataProvider
- the meta-data source to use- Returns:
- this builder
-
getMetaDataStore
@Nullable FDBMetaDataStore getMetaDataStore()
Get theFDBMetaDataStore
to use as the source of meta-data.- Returns:
- the meta-data store to use
-
setMetaDataStore
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setMetaDataStore(@Nullable FDBMetaDataStore metaDataStore)
Set theFDBMetaDataStore
to use as the source of meta-data. IfsetMetaDataProvider(com.apple.foundationdb.record.RecordMetaDataProvider)
is also called, it will be used to seed the store.- Parameters:
metaDataStore
- the meta-data store to use- Returns:
- this builder
-
getContext
@Nullable FDBRecordContext getContext()
Get the record context (transaction) to use for the record store.- Returns:
- context the record context / transaction to use
-
setContext
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setContext(@Nullable FDBRecordContext context)
Set the record context (transaction) to use for the record store.- Parameters:
context
- the record context / transaction to use- Returns:
- this builder
-
getSubspaceProvider
@Nullable SubspaceProvider getSubspaceProvider()
Get the subspace provider.- Returns:
- the subspace provider
-
setSubspaceProvider
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setSubspaceProvider(@Nullable SubspaceProvider subspaceProvider)
Set the subspace provider from a subspace provider.- Parameters:
subspaceProvider
- the subspace provider- Returns:
- this builder
-
setSubspace
@Nonnull @API(UNSTABLE) FDBRecordStoreBase.BaseBuilder<M,R> setSubspace(@Nullable Subspace subspace)
Set the subspace to use for the record store. The record store is allowed to use the entire subspace, so it should not overlap any other record store's subspace. It is preferred tosetKeySpacePath(com.apple.foundationdb.record.provider.foundationdb.keyspace.KeySpacePath)
rather than this because key space path provides more meaningful logs.- Parameters:
subspace
- the subspace to use- Returns:
- this builder
-
setKeySpacePath
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setKeySpacePath(@Nullable KeySpacePath keySpacePath)
Set the key space path to use for the record store. The record store is allowed to use the entire subspace, so it should not overlap any other record store's subspace. Note: The context should be set before setting the key space path.- Parameters:
keySpacePath
- the key space path to use- Returns:
- this builder
-
getUserVersionChecker
@Nullable FDBRecordStoreBase.UserVersionChecker getUserVersionChecker()
Get thefunction
to be used to check the meta-data version of the record store.- Returns:
- the checker function to use
-
setUserVersionChecker
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setUserVersionChecker(@Nullable FDBRecordStoreBase.UserVersionChecker userVersionChecker)
Set thefunction
to be used to check the meta-data version of the record store.- Parameters:
userVersionChecker
- the checker function to use- Returns:
- this builder
-
getIndexMaintainerRegistry
@Nonnull IndexMaintainerRegistry getIndexMaintainerRegistry()
Get the registry of index maintainers to be used by the record store.- Returns:
- the index registry to use
-
setIndexMaintainerRegistry
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setIndexMaintainerRegistry(@Nonnull IndexMaintainerRegistry indexMaintainerRegistry)
Set the registry of index maintainers to be used by the record store.- Parameters:
indexMaintainerRegistry
- the index registry to use- Returns:
- this builder
- See Also:
FDBRecordStore.getIndexMaintainer(com.apple.foundationdb.record.metadata.Index)
,RecordMetaDataBuilder.setIndexMaintainerRegistry(com.apple.foundationdb.record.provider.foundationdb.IndexMaintainerRegistry)
-
getIndexMaintenanceFilter
@Nonnull IndexMaintenanceFilter getIndexMaintenanceFilter()
Get theindex filter
to be used by the record store.- Returns:
- the index filter to use
-
setIndexMaintenanceFilter
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setIndexMaintenanceFilter(@Nonnull IndexMaintenanceFilter indexMaintenanceFilter)
Set theindex filter
to be used by the record store.- Parameters:
indexMaintenanceFilter
- the index filter to use- Returns:
- this builder
-
getPipelineSizer
@Nonnull FDBRecordStoreBase.PipelineSizer getPipelineSizer()
Get theobject
to be used to determine the depth of pipelines run by the record store.- Returns:
- the sizer to use
-
setPipelineSizer
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setPipelineSizer(@Nonnull FDBRecordStoreBase.PipelineSizer pipelineSizer)
Set theobject
to be used to determine the depth of pipelines run by the record store.- Parameters:
pipelineSizer
- the sizer to use- Returns:
- this builder
- See Also:
FDBRecordStoreBase.getPipelineSize(com.apple.foundationdb.record.PipelineOperation)
-
getStoreStateCache
@API(EXPERIMENTAL) @Nullable FDBRecordStoreStateCache getStoreStateCache()
Get the store state cache to be used by the record store. If the builder returnsnull
, the produced record store will use the default store state cache provided by theFDBDatabase
when initializing the record store state.- Returns:
- the store state cached used by this record store of
null
if it uses the database default
-
setStoreStateCache
@API(EXPERIMENTAL) @Nonnull FDBRecordStoreBase.BaseBuilder<M,R> setStoreStateCache(@Nonnull FDBRecordStoreStateCache storeStateCache)
Set the store state cache to be used by the record store. Ifnull
is provided or if this method is never called, the produced record store will use the default store state cache provided by theFDBDatabase
.- Parameters:
storeStateCache
- the store state cache to used by this record store ornull
to specify that this should use the database default- Returns:
- this builder
-
copyBuilder
@Nonnull FDBRecordStoreBase.BaseBuilder<M,R> copyBuilder()
Make a copy of this builder. This can be used to share enough of the state to connect to the same record store several times in different transactions.builder = FDBRecordStore.newBuilder().setMetaDataProvider(metadata).setSubspace(subspace) store1 = builder.copyBuilder().setContext(context1).build() store2 = builder.copyBuilder().setContext(context2).build()
- Returns:
- a new builder with the same state as this builder
-
build
@Nonnull R build()
Build the record store.- Returns:
- a new record store with the desired state.
-
uncheckedOpen
@Nonnull default R uncheckedOpen()
Synchronous version ofuncheckedOpenAsync()
.- Returns:
- a store with the appropriate parameters set
-
create
@Nonnull default R create()
Synchronous version ofcreateAsync()
.- Returns:
- a store with the appropriate parameters set
-
open
@Nonnull default R open()
Synchronous version ofopenAsync()
.- Returns:
- a store with the appropriate parameters set
-
createOrOpen
@Nonnull default R createOrOpen()
Synchronous version ofcreateOrOpenAsync()
.- Returns:
- a store with the appropriate parameters set
-
createOrOpen
@Nonnull default R createOrOpen(@Nonnull FDBRecordStoreBase.StoreExistenceCheck existenceCheck)
Synchronous version ofcreateOrOpenAsync(FDBRecordStoreBase.StoreExistenceCheck)
.- Parameters:
existenceCheck
- whether the store must already exist- Returns:
- an open record store
-
uncheckedOpenAsync
@Nonnull CompletableFuture<R> uncheckedOpenAsync()
Opens aFDBRecordStore
instance without callingFDBRecordStore.checkVersion(com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase.UserVersionChecker, com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase.StoreExistenceCheck)
.- Returns:
- a future that will contain a store with the appropriate parameters set when ready
-
createAsync
@Nonnull default CompletableFuture<R> createAsync()
Opens a newFDBRecordStore
instance in the given path with the given meta-data. The store must not have already been written to the specified subspace.- Returns:
- a future that will contain a store with the appropriate parameters set when ready
-
openAsync
@Nonnull default CompletableFuture<R> openAsync()
Opens an existingFDBRecordStore
instance in the given path with the given meta-data. The store must have already been written to the specified subspace.- Returns:
- a future that will contain a store with the appropriate parameters set when ready
-
createOrOpenAsync
@Nonnull default CompletableFuture<R> createOrOpenAsync()
Opens aFDBRecordStore
instance in the given path with the given meta-data.- Returns:
- a future that will contain a store with the appropriate parameters set when ready
-
createOrOpenAsync
@Nonnull CompletableFuture<R> createOrOpenAsync(@Nonnull FDBRecordStoreBase.StoreExistenceCheck existenceCheck)
Opens aFDBRecordStore
instance in the given path with the given meta-data.- Parameters:
existenceCheck
- whether the store must already exist- Returns:
- a future that will contain a store with the appropriate parameters set when ready
-
-