Interface KVImplementation<C>
- Type Parameters:
C- configuration object type
- All Known Implementing Classes:
ArrayKVImplementation,BerkeleyKVImplementation,CockroachKVImplementation,FoundationKVImplementation,LevelDBKVImplementation,LMDBKVImplementation,MemoryKVImplementation,MSSQLKVImplementation,MVStoreKVImplementation,MySQLKVImplementation,RaftKVImplementation,SimpleKVImplementation,SpannerKVImplementation,SQLDriverKVImplementation,SQLiteKVImplementation,XMLKVImplementation,XodusKVImplementation
KVDatabase and/or AtomicKVStore implementations.
Instances of this class provide information about how to configure and instantiate some
technology-specific implementation of the KVDatabase and/or AtomicKVStore
interfaces.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddOptions(joptsimple.OptionParser parser) Add implementation-specific command line options.buildConfig(joptsimple.OptionSet options) Build a configuration from implementation-specific command line options, if any were given.default AtomicKVStorecreateAtomicKVStore(C config) Create anAtomicKVStoreusing the specified configuration.default KVDatabasecreateKVDatabase(C config, KVDatabase kvdb, AtomicKVStore kvstore) Create anKVDatabaseusing the specified configuration.Get the configuration object type for this instance.getDescription(C config) Generate a short, human-readable description of theKVDatabaseinstance configured as given.default booleanprovidesAtomicKVStore(C config) Determine whether thisKVImplementationincludes an implementation of theAtomicKVStoreinterface.default booleanprovidesKVDatabase(C config) Determine whether thisKVImplementationincludes an implementation of theKVDatabaseinterface.default booleanrequiresAtomicKVStore(C config) Determine whether this instance'sKVDatabaseimplementation requires an underlyingAtomicKVStore.default booleanrequiresKVDatabase(C config) Determine whether this instance'sKVDatabaseimplementation requires some other underlyingKVDatabase.
-
Method Details
-
getConfigType
Get the configuration object type for this instance.- Returns:
- config type
-
addOptions
void addOptions(joptsimple.OptionParser parser) Add implementation-specific command line options.All of the added options must be optional, because multiple key/value implementations will be available when the command line is parsed, and the presence of implementation-specific options determines which one(s) are chosen.
- Parameters:
parser- command line flag parser- Throws:
IllegalArgumentException- ifparseris null
-
buildConfig
Build a configuration from implementation-specific command line options, if any were given.If none of this implementation's options were provided, then this method must return null.
- Parameters:
options- parsed command line options- Returns:
- corresponding configuration, or null if this implementation was not configured
- Throws:
joptsimple.OptionException- if invalid options were givenIllegalArgumentException- if invalid options were givenIllegalArgumentException- ifoptionsis null
-
providesAtomicKVStore
Determine whether thisKVImplementationincludes an implementation of theAtomicKVStoreinterface.The implementation in
KVImplementationreturn false.- Parameters:
config- implementation configuration returned bybuildConfig()- Returns:
- true if this instance can create an
AtomicKVStore - Throws:
IllegalArgumentException- ifconfigis null
-
providesKVDatabase
Determine whether thisKVImplementationincludes an implementation of theKVDatabaseinterface.The implementation in
KVImplementationreturn false.- Parameters:
config- implementation configuration returned bybuildConfig()- Returns:
- true if this instance can create an
KVDatabase - Throws:
IllegalArgumentException- ifconfigis null
-
createKVDatabase
Create anKVDatabaseusing the specified configuration.The implementation in
KVImplementationalways throwsUnsupportedOperationException.- Parameters:
config- implementation configuration returned bybuildConfig()kvdb- requiredKVDatabase; will be null unlessrequiresKVDatabase(C)returned truekvstore- requiredAtomicKVStore; will be null unlessrequiresAtomicKVStore(C)returned true- Returns:
- new
KVDatabaseinstance - Throws:
UnsupportedOperationException- ifprovidesKVDatabase(C)returns falseIllegalArgumentException- ifconfigis null
-
createAtomicKVStore
Create anAtomicKVStoreusing the specified configuration.The implementation in
KVImplementationinvokescreateKVDatabase()and constructs anAtomicKVDatabasefrom the result. Implementations that natively support theAtomicKVDatabaseinterface should override this method.- Parameters:
config- implementation configuration returned bybuildConfig()- Returns:
- new
AtomicKVStoreinstance - Throws:
IllegalArgumentException- ifconfigis null
-
requiresAtomicKVStore
Determine whether this instance'sKVDatabaseimplementation requires an underlyingAtomicKVStore.This method and
requiresKVDatabase()may not both return true.The implementation in
KVImplementationreturn false.- Parameters:
config- implementation configuration returned bybuildConfig()- Returns:
- true if the implementation relies on an underlying
AtomicKVStore - Throws:
IllegalArgumentException- ifconfigis null
-
requiresKVDatabase
Determine whether this instance'sKVDatabaseimplementation requires some other underlyingKVDatabase.This method and
requiresAtomicKVStore()may not both return true.The implementation in
KVImplementationreturn false.- Parameters:
config- implementation configuration returned bybuildConfig()- Returns:
- true if the implementation relies on an underlying
KVDatabase - Throws:
IllegalArgumentException- ifconfigis null
-
getDescription
Generate a short, human-readable description of theKVDatabaseinstance configured as given.- Parameters:
config- implementation configuration returned bybuildConfig()- Returns:
- human-readable description
-