Class LmdbStore
java.lang.Object
org.eclipse.rdf4j.sail.helpers.AbstractSail
org.eclipse.rdf4j.sail.helpers.AbstractNotifyingSail
org.eclipse.rdf4j.sail.lmdb.LmdbStore
- All Implemented Interfaces:
FederatedServiceResolverClient, NotifyingSail, Sail
@Experimental
public class LmdbStore
extends AbstractNotifyingSail
implements FederatedServiceResolverClient
A SAIL implementation using LMDB for storing and querying its data.
-
Field Summary
Fields inherited from class AbstractSail
connectionTimeOut, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_ITERATION_SYNC_THRESHOLD, initializationLockModifier and TypeFieldDescriptionprotected longConnection timeout on shutdown (in ms).protected static final longDefault connection timeout on shutdown: 20,000 milliseconds (20 seconds).protected static final longdefault value for the Iteration item sync thresholdprotected final ReentrantReadWriteLockLock used to synchronize the initialization state of a sail. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new LmdbStore with default settings.Creates a new LmdbStore with default settings.LmdbStore(File dataDir, LmdbStoreConfig config) LmdbStore(LmdbStoreConfig config) Creates a new LmdbStore. -
Method Summary
Modifier and TypeMethodDescriptionGets a CollectionFactory that may be optimized for this store and may or may not use disk or other resources.protected NotifyingSailConnectionReturns a store-specific SailConnection object.Gets theFederatedServiceResolverused by this client.booleanprotected LockgetTransactionLock(IsolationLevel level) This call will block whenIsolationLevels.NONEis provided when there are active transactions with a higher isolation and block when a higher isolation is provided when there are active transactions withIsolationLevels.NONEisolation.Gets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.protected voidInitializes this LmdbStore.booleanChecks whether this Sail object is writable, i.e. if the data contained in this Sail object can be changed.voidsetDataDir(File dataDir) Sets the data directory for the Sail.voidSets theEvaluationStrategyto use.voidOverrides theFederatedServiceResolverused by this instance, but the given resolver is not shutDown when this instance is.voidshutDown()Shuts down the Sail, giving it the opportunity to synchronize any stale data.protected voidDo store-specific operations to ensure proper shutdown of the store.Methods inherited from class AbstractNotifyingSail
addSailChangedListener, getConnection, notifySailChanged, removeSailChangedListenerModifier and TypeMethodDescriptionvoidaddSailChangedListener(SailChangedListener listener) Adds the specified SailChangedListener to receive events when the data in this Sail object changes.Opens a connection on the Sail which can be used to query and update data.voidNotifies all registered SailChangedListener's of changes to the contents of this Sail.voidremoveSailChangedListener(SailChangedListener listener) Removes the specified SailChangedListener so that it no longer receives events from this Sail object.Methods inherited from class AbstractSail
addSupportedIsolationLevel, connectionClosed, debugEnabled, getDataDir, getDefaultIsolationLevel, getDefaultQueryEvaluationMode, getIterationCacheSyncThreshold, getSupportedIsolationLevels, init, isInitialized, isTrackResultSize, removeSupportedIsolationLevel, setConnectionTimeOut, setDefaultIsolationLevel, setDefaultQueryEvaluationMode, setIterationCacheSyncThreshold, setSupportedIsolationLevels, setSupportedIsolationLevels, setTrackResultSize, toStringModifier and TypeMethodDescriptionprotected voidAppends the providedIsolationLevelsto the SAIL's list of supported isolation levels.protected voidconnectionClosed(SailConnection connection) Signals to the store that the supplied connection has been closed; called byAbstractSailConnection.close().protected static booleanGets the Sail's data directory.Retrieves the defaultIsolationLevellevel on which transactions in this Sail operate.longRetrieves the currently configured threshold for syncing query evaluation iteration caches to disk.Retrieve theIsolationLevels supported by this SAIL, ordered by increasing complexity.voidinit()Initializes the Sail.protected booleanChecks whether the Sail has been initialized.booleanReturns the status of the result size tracking for the query plan.protected voidRemoves all occurrences of the providedIsolationLevelsin the list of supported Isolation levels.voidsetConnectionTimeOut(long connectionTimeOut) Set connection timeout on shutdown (in ms).voidsetDefaultIsolationLevel(IsolationLevel defaultIsolationLevel) Sets the defaultIsolationLevelon which transactions in this Sail operate.voidsetDefaultQueryEvaluationMode(QueryEvaluationMode defaultQueryEvaluationMode) voidsetIterationCacheSyncThreshold(long iterationCacheSyncThreshold) Set the threshold for syncing query evaluation iteration caches to disk.protected voidsetSupportedIsolationLevels(List<IsolationLevel> supportedIsolationLevels) Sets the list of supportedIsolationLevelss for this SAIL.protected voidsetSupportedIsolationLevels(IsolationLevel... supportedIsolationLevels) Sets the list of supportedIsolationLevelss for this SAIL.voidsetTrackResultSize(boolean trackResultSize) Enable or disable results size tracking for the query plan.toString()
-
Constructor Details
-
LmdbStore
public LmdbStore()Creates a new LmdbStore with default settings. -
LmdbStore
Creates a new LmdbStore. -
LmdbStore
Creates a new LmdbStore with default settings. -
LmdbStore
-
-
Method Details
-
setDataDir
Description copied from interface:SailSets the data directory for the Sail. The Sail can use this directory for storage of data, parameters, etc. This directory must be set before the Sail is.invalid reference
initialized- Specified by:
setDataDirin interfaceSail- Overrides:
setDataDirin classAbstractSail
-
getEvaluationStrategyFactory
- Returns:
- Returns the
EvaluationStrategy.
-
getPageCardinalityEstimator
public boolean getPageCardinalityEstimator() -
setEvaluationStrategyFactory
Sets theEvaluationStrategyto use. -
getFederatedServiceResolver
Description copied from interface:FederatedServiceResolverClientGets theFederatedServiceResolverused by this client.- Specified by:
getFederatedServiceResolverin interfaceFederatedServiceResolverClient- Returns:
- Returns the SERVICE resolver.
-
setFederatedServiceResolver
Overrides theFederatedServiceResolverused by this instance, but the given resolver is not shutDown when this instance is.- Specified by:
setFederatedServiceResolverin interfaceFederatedServiceResolverClient- Parameters:
resolver- The SERVICE resolver to set.
-
initializeInternal
Initializes this LmdbStore.- Overrides:
initializeInternalin classAbstractSail- Throws:
SailException- If this LmdbStore could not be initialized using the parameters that have been set.
-
shutDownInternal
Description copied from class:AbstractSailDo store-specific operations to ensure proper shutdown of the store.- Specified by:
shutDownInternalin classAbstractSail- Throws:
SailException
-
shutDown
Description copied from interface:SailShuts down the Sail, giving it the opportunity to synchronize any stale data. Care should be taken that all initialized Sails are being shut down before an application exits to avoid potential loss of data. Once shut down, a Sail can no longer be used until it is re-initialized.- Specified by:
shutDownin interfaceSail- Overrides:
shutDownin classAbstractSail- Throws:
SailException- If the Sail object encountered an error or unexpected situation internally.
-
isWritable
public boolean isWritable()Description copied from interface:SailChecks whether this Sail object is writable, i.e. if the data contained in this Sail object can be changed.- Specified by:
isWritablein interfaceSail
-
getConnectionInternal
Description copied from class:AbstractSailReturns a store-specific SailConnection object.- Specified by:
getConnectionInternalin classAbstractNotifyingSail- Returns:
- A connection to the store.
- Throws:
SailException
-
getValueFactory
Description copied from interface:SailGets a ValueFactory object that can be used to create IRI-, blank node-, literal- and statement objects.- Specified by:
getValueFactoryin interfaceSail- Returns:
- a ValueFactory object for this Sail object.
-
getTransactionLock
This call will block whenIsolationLevels.NONEis provided when there are active transactions with a higher isolation and block when a higher isolation is provided when there are active transactions withIsolationLevels.NONEisolation. Store is either exclusively inIsolationLevels.NONEisolation with potentially zero or more transactions, or exclusively in higher isolation mode with potentially zero or more transactions.- Parameters:
level- indicating desired modeIsolationLevels.NONEor higher- Returns:
- Lock used to prevent Store from switching isolation modes
- Throws:
SailException
-
getCollectionFactory
Description copied from interface:SailGets a CollectionFactory that may be optimized for this store and may or may not use disk or other resources.- Specified by:
getCollectionFactoryin interfaceSail- Returns:
- a CollectionFactory
-