Class ODatabaseDocumentEmbedded
- All Implemented Interfaces:
ODatabaseDocument,OQueryLifecycleListener,ODatabase<ORecord>,ODatabaseDocumentInternal,ODatabaseInternal<ORecord>,ODatabaseSession,OBackupable,Closeable,AutoCloseable
- Direct Known Subclasses:
ODatabaseDocumentDistributed,ODatabaseDocumentEmbeddedPooled
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.ODatabase
ODatabase.ATTRIBUTES, ODatabase.STATUS -
Field Summary
Fields inherited from class com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract
activeQueries, componentsFactory, currentTx, databaseOwner, hooks, hooksByScope, inHook, initialized, loadedRecordsCount, localCache, maxRecordLoadMs, maxRidbagPrefetchMs, metadata, minRecordLoadMs, minRidbagPrefetchMs, properties, queryState, recordType, retainRecords, ridbagPrefetchCount, serializer, sharedContext, status, totalRecordLoadMs, totalRidbagPrefetchMs, unmodifiableHooks, url, userFields inherited from interface com.orientechnologies.orient.core.db.document.ODatabaseDocument
TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintaddBlobCluster(String iClusterName, Object... iParameters) Add a cluster for blob records.intaddCluster(String iClusterName, int iRequestedId) Adds a new cluster.intaddCluster(String iClusterName, Object... iParameters) Adds a new cluster.voidaddRidbagPrefetchStats(long execTimeMs) protected voidvoidvoidvoidafterReadOperations(OIdentifiable identifiable) protected voidvoidbackup(OutputStream out, Map<String, Object> options, Callable<Object> callable, OCommandOutputListener iListener, int compressionLevel, int bufferSize) Executes a backup of the database.beforeCreateOperations(OIdentifiable id, String iClusterName) voidbeforeDeleteOperations(OIdentifiable id, String iClusterName) booleanbeforeReadOperations(OIdentifiable identifiable) beforeUpdateOperations(OIdentifiable id, String iClusterName) voidceilingPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) <DB extends ODatabaseDocument>
DBcheckSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object iResourceSpecific) Checks if the operation on a resource is allowed for the current user.<DB extends ODatabaseDocument>
DBcheckSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object... iResourcesSpecific) Checks if the operation against multiple resources is allowed for the current user.<DB extends ODatabaseDocument>
DBcheckSecurity(ORule.ResourceGeneric resourceGeneric, String resourceSpecific, int iOperation) Checks if the operation on a resource is allowed for the current user.Executes a generic (idempotent or non idempotent) command.Executes a generic (idempotent or non idempotent) command.commandLikeLegacy(String query, Map<Object, Object> params) voidcopy()Returns a copy of current database if it's open.longcountClusterElements(int iClusterId) Counts all the entities in the specified cluster id.longcountClusterElements(int[] iClusterIds) Counts all the entities in the specified cluster ids.longcountClusterElements(String iClusterName) Counts all the entities in the specified cluster name.longprotected voidcreateMetadata(OSharedContext shared) createSBTree(int clusterId, UUID ownerUUID) Deletes a document.directRead(ORecordId rid, String fetchPlan, boolean ignoreCache, int recordVersion) booleandropCluster(int clusterId) Drops a cluster by its id.booleandropCluster(String iClusterName) Drops a cluster by its name.booleandropClusterInternal(int clusterId) protected booleandropClusterInternal(String iClusterName) voidExecute a script in a specified query language.Execute a script of a specified query language The result set has to be closed after usage
Sample usage:voidexecuteDeleteRecord(OIdentifiable identifiable, int iVersion, boolean iRequired) This method is internal, it can be subject to signature change or be removed, do not use.<RET extends ORecord>
RETexecuteReadRecord(ORecordId rid, ORecord iRecord, int recordVersion, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, RecordReader recordReader) This method is internal, it can be subject to signature change or be removed, do not use.floorPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) voidfreeze()Flush all indexes and cached storage content to the disk.voidfreeze(boolean throwException) Flush all indexes and cached storage content to the disk.long[]getClusterDataRange(int currentClusterId) getClusterName(ORecord record) getClusterRecordConflictStrategy(int clusterId) longgetClusterRecordSizeById(int clusterId) Returns the total size of records contained in the cluster defined by its id.longgetClusterRecordSizeByName(String clusterName) Returns the total size of records contained in the cluster defined by its name.int[]getClustersIds(Set<String> filterClusters) Returns the current record conflict strategy.longgetLastClusterPosition(int clusterId) getRecordMetadata(ORID rid) Internal.longgetSize()Returns the total size of the records in the database.getStats()Returns the underlying storage implementation.getViewFromCluster(int cluster) higherPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) incrementalBackup(String path) Performs incremental backup of database content to the selected folder.voidinit(OrientDBConfig config, OSharedContext sharedContext) protected voidvoidinternalClose(boolean recycle) voidinternalCommit(OTransactionInternal transaction) Executed the commit on the storage hiding away storage concepts from the transactionvoidinternalCommitPreallocate(OTransactionOptimistic oTransactionOptimistic) voidinternalCreate(OrientDBConfig config, OSharedContext ctx) voidinternalLockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY lockingStrategy) voidinternalLockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY lockingStrategy, long timeout) voidinternalOpen(OAuthenticationInfo authenticationInfo) voidinternalOpen(String iUserName, String iUserPassword) voidinternalOpen(String iUserName, String iUserPassword, boolean checkPassword) voidinternalUnlockRecord(OIdentifiable iRecord) booleanisClosed()Checks if the database is closed.booleanlive(String query, OLiveQueryResultListener listener, Object... args) Subscribe a query as a live query for future create/update event with the referred conditionslive(String query, OLiveQueryResultListener listener, Map<String, ?> args) Subscribe a query as a live query for future create/update event with the referred conditionsprotected void<RET extends ORecord>
RETPessimistic lock a record.<RET extends ORecord>
RETPessimistic lock a record.lowerPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) query(OInternalExecutionPlan plan, Map<Object, Object> params) Executes an SQL query.Executes an SQL query (idempotent).voidqueryStarted(String id, OResultSet resultSet) voidqueryStartUsingViewCluster(int clusterId) voidqueryStartUsingViewIndex(String index) readIfVersionIsNotLatest(ORecordId rid, String fetchPlan, boolean ignoreCache, int recordVersion) voidvoidrelease()Allows to execute write-related commands on DB.voidreload()Reloads the database information like the cluster list.voidreplaceStorage(OStorage iNewStorage) Internal only: replace the storage with a new one.voidvoidrestore(InputStream in, Map<String, Object> options, Callable<Object> callable, OCommandOutputListener iListener) Executes a restore of a database backup.<T> TsendSequenceAction(OSequenceAction action) <DB extends ODatabase>
DBset(ODatabase.ATTRIBUTES iAttribute, Object iValue) Sets a database attribute valuesetConflictStrategy(ORecordConflictStrategy iResolver) Overrides record conflict strategy.setConflictStrategy(String iStrategyName) Overrides record conflict strategy selecting the strategy by name.<DB extends ODatabase>
DBvoidsetDefaultClusterId(int addCluster) voidvoidtruncateClass(String name) longtruncateClass(String name, boolean polimorfic) voidtruncateCluster(String clusterName) Removes all data in the cluster with given name.longtruncateClusterInternal(String clusterName) voidPessimistic unlockMethods inherited from class com.orientechnologies.orient.core.db.document.ODatabaseDocumentAbstract
activateOnCurrentThread, assignAndCheckCluster, beforeCommitOperations, beforeRollbackOperations, begin, begin, browseClass, browseClass, browseCluster, browseCluster, browseCluster, callbackHookFailure, callbackHookFinalize, callbackHooks, callbackHookSuccess, callOnCloseListeners, callOnDropListeners, callOnOpenListeners, checkForClusterPermissions, checkIfActive, checkOpenness, checkRecordClass, checkSecurity, cleanOutRecord, clearDocumentTracking, close, closeActiveQueries, commit, commit, countClass, countClass, countClass, countView, delete, delete, executeWithRetries, executeWithRetries, executeWithRetries, existsCluster, get, getActiveQueries, getActiveQuery, getBlobClusterIds, getClusterIdByName, getClusterNameById, getClusterNames, getClusters, getCollectionsChanges, getConfiguration, getDatabaseOwner, getDefaultClusterId, getDefaultSerializer, getDictionary, getHooks, getListeners, getLocalCache, getMetadata, getName, getProperties, getProperty, getRecord, getRecordType, getSerializer, getSerializerFactory, getSharedContext, getStatus, getStorageVersions, getTransaction, getType, getUnderlying, getURL, getUser, init, isActiveOnCurrentThread, isClusterEdge, isClusterVertex, isClusterView, isPooled, isPrefetchRecords, isUseLightweightEdges, isValidationEnabled, load, load, load, load, load, load, loadIfVersionIsNotLatest, newBlob, newBlob, newEdge, newEdge, newElement, newElement, newElement, newEmbeddedElement, newEmbeddedElement, newInstance, newInstance, newLightweightEdge, newRegularEdge, newVertex, newVertex, pessimisticLockChecks, queryClosed, queryStarted, rawBegin, registerHook, registerHook, reload, reload, reload, reload, reloadUser, resetInitialization, rollback, rollback, save, save, save, setCurrentDatabaseInThreadLocal, setDatabaseOwner, setDefaultSerializer, setDefaultTransactionMode, setInternal, setPrefetchRecords, setProperty, setSerializer, setStatus, setStatusInternal, setUseLightweightEdges, setUser, setValidationEnabled, swapTx, unregisterHookMethods inherited from class com.orientechnologies.common.listener.OListenerManger
browseListeners, getListenersCopy, registerListener, resetListeners, unregisterListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.db.ODatabase
createClass, executeWithRetry, getClass, registerListener, unregisterListenerMethods inherited from interface com.orientechnologies.orient.core.db.document.ODatabaseDocument
createClassIfNotExist, createEdgeClass, createVertexClass, newEdge, newVertex, reloadMethods inherited from interface com.orientechnologies.orient.core.db.ODatabaseDocumentInternal
getHaStatus, getStorageId, indexQuery, isDistributed, isLocalEnv, isRemote, queryOnNode, realClose, remoteRollback, removeHaServer, reuse, sync, syncCommitMethods inherited from interface com.orientechnologies.orient.core.db.ODatabaseInternal
createInterruptTimerTask, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, isShardedMethods inherited from interface com.orientechnologies.orient.core.db.document.OQueryLifecycleListener
queryClosed
-
Constructor Details
-
ODatabaseDocumentEmbedded
-
-
Method Details
-
internalOpen
-
internalOpen
-
internalOpen
-
callOnCreateListeners
public void callOnCreateListeners() -
loadMetadata
protected void loadMetadata()- Specified by:
loadMetadatain classODatabaseDocumentAbstract
-
set
Description copied from interface:ODatabaseSets a database attribute value -
setCustom
- Specified by:
setCustomin interfaceODatabaseDocumentInternal
-
copy
Returns a copy of current database if it's open. The returned instance can be used by another thread without affecting current instance. The database copy is not set in thread local.- Specified by:
copyin interfaceODatabaseDocumentInternal
-
isClosed
public boolean isClosed()Description copied from interface:ODatabaseChecks if the database is closed. -
rebuildIndexes
public void rebuildIndexes() -
installHooksEmbedded
protected void installHooksEmbedded() -
getStorage
Description copied from interface:ODatabaseInternalReturns the underlying storage implementation.- Specified by:
getStoragein interfaceODatabaseInternal<ORecord>- Returns:
- The underlying storage implementation
- See Also:
-
getStorageInfo
- Specified by:
getStorageInfoin interfaceODatabaseInternal<ORecord>
-
replaceStorage
Description copied from interface:ODatabaseInternalInternal only: replace the storage with a new one.- Specified by:
replaceStoragein interfaceODatabaseInternal<ORecord>- Parameters:
iNewStorage- The new storage to use. Usually it's a wrapped instance of the current cluster.
-
query
Description copied from interface:ODatabaseExecutes an SQL query. The result set has to be closed after usage
Sample usage:OResultSet rs = db.query("SELECT FROM V where name = ?", "John"); while(rs.hasNext()){ OResult item = rs.next(); ... } rs.close(); -
query
Description copied from interface:ODatabaseExecutes an SQL query (idempotent). The result set has to be closed after usage
Sample usage:Map<String, Object> params = new HashMapMap<>(); params.put("name", "John"); OResultSet rs = db.query("SELECT FROM V where name = :name", params); while(rs.hasNext()){ OResult item = rs.next(); ... } rs.close(); -
command
Description copied from interface:ODatabaseExecutes a generic (idempotent or non idempotent) command. The result set has to be closed after usage
Sample usage:OResultSet rs = db.command("INSERT INTO Person SET name = ?", "John"); ... rs.close(); -
queryLikeLegacy
public List<ODocument> queryLikeLegacy(String query, Map<Object, Object> params, int limit, String fetchPlan) - Specified by:
queryLikeLegacyin interfaceODatabaseDocumentInternal
-
commandLikeLegacy
- Specified by:
commandLikeLegacyin interfaceODatabaseDocumentInternal
-
executeLikeLegacy
- Specified by:
executeLikeLegacyin interfaceODatabaseDocumentInternal
-
command
Description copied from interface:ODatabaseExecutes a generic (idempotent or non idempotent) command. The result set has to be closed after usage
Sample usage:Map<String, Object> params = new HashMapMap<>(); params.put("name", "John"); OResultSet rs = db.query("INSERT INTO Person SET name = :name", params); ... rs.close(); -
execute
Description copied from interface:ODatabaseExecute a script in a specified query language. The result set has to be closed after usage
Sample usage:String script = "INSERT INTO Person SET name = 'foo', surname = ?;"+ "INSERT INTO Person SET name = 'bar', surname = ?;"+ "INSERT INTO Person SET name = 'baz', surname = ?;";OResultSet rs = db.execute("sql", script, "Surname1", "Surname2", "Surname3"); ... rs.close();
-
execute
Description copied from interface:ODatabaseExecute a script of a specified query language The result set has to be closed after usage
Sample usage:Map<String, Object> params = new HashMapMap<>(); params.put("surname1", "Jones"); params.put("surname2", "May"); params.put("surname3", "Ali");String script = "INSERT INTO Person SET name = 'foo', surname = :surname1;"+ "INSERT INTO Person SET name = 'bar', surname = :surname2;"+ "INSERT INTO Person SET name = 'baz', surname = :surname3;";
OResultSet rs = db.execute("sql", script, params); ... rs.close();
-
query
-
queryStartUsingViewCluster
public void queryStartUsingViewCluster(int clusterId) - Specified by:
queryStartUsingViewClusterin interfaceODatabaseDocumentInternal
-
queryStartUsingViewIndex
- Specified by:
queryStartUsingViewIndexin interfaceODatabaseDocumentInternal
-
queryStarted
- Specified by:
queryStartedin interfaceOQueryLifecycleListener
-
getConfig
-
live
Description copied from interface:ODatabaseSubscribe a query as a live query for future create/update event with the referred conditions -
live
Description copied from interface:ODatabaseSubscribe a query as a live query for future create/update event with the referred conditions -
addBlobCluster
Description copied from interface:ODatabaseDocumentAdd a cluster for blob records.- Specified by:
addBlobClusterin interfaceODatabase<ORecord>- Specified by:
addBlobClusterin interfaceODatabaseDocument- Parameters:
iClusterName- Cluster nameiParameters- Additional parameters to pass to the factories- Returns:
- Cluster id
-
executeDeleteRecord
This method is internal, it can be subject to signature change or be removed, do not use. @Internal- Specified by:
executeDeleteRecordin interfaceODatabaseDocumentInternal
-
beforeCreateOperations
- Specified by:
beforeCreateOperationsin interfaceODatabaseDocumentInternal- Returns:
- null if nothing changed the instance if has been modified or replaced
-
beforeUpdateOperations
- Specified by:
beforeUpdateOperationsin interfaceODatabaseDocumentInternal- Returns:
- null if nothing changed the instance if has been modified or replaced
-
delete
Deletes a document. Behavior depends by the current running transaction if any. If no transaction is running then the record is deleted immediately. If an Optimistic transaction is running then the record will be deleted at commit time. The current transaction will continue to see the record as deleted, while others not. If a Pessimistic transaction is running, then an exclusive lock is acquired against the record. Current transaction will continue to see the record as deleted, while others cannot access to it since it's locked.If MVCC is enabled and the version of the document is different by the version stored in the database, then a
OConcurrentModificationExceptionexception is thrown. -
beforeDeleteOperations
- Specified by:
beforeDeleteOperationsin interfaceODatabaseDocumentInternal
-
afterCreateOperations
- Specified by:
afterCreateOperationsin interfaceODatabaseDocumentInternal
-
afterUpdateOperations
- Specified by:
afterUpdateOperationsin interfaceODatabaseDocumentInternal
-
afterDeleteOperations
- Specified by:
afterDeleteOperationsin interfaceODatabaseDocumentInternal
-
afterReadOperations
- Specified by:
afterReadOperationsin interfaceODatabaseDocumentInternal
-
beforeReadOperations
- Specified by:
beforeReadOperationsin interfaceODatabaseDocumentInternal- Returns:
- true if the record should be skipped
-
afterCommitOperations
protected void afterCommitOperations()- Overrides:
afterCommitOperationsin classODatabaseDocumentAbstract
-
afterRollbackOperations
protected void afterRollbackOperations()- Overrides:
afterRollbackOperationsin classODatabaseDocumentAbstract
-
saveAll
- Specified by:
saveAllin interfaceODatabaseDocumentInternal
-
getClusterName
- Specified by:
getClusterNamein interfaceODatabaseDocumentInternal
-
getViewFromCluster
- Specified by:
getViewFromClusterin interfaceODatabaseDocumentInternal- Overrides:
getViewFromClusterin classODatabaseDocumentAbstract
-
executeReadRecord
public <RET extends ORecord> RET executeReadRecord(ORecordId rid, ORecord iRecord, int recordVersion, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, RecordReader recordReader) This method is internal, it can be subject to signature change or be removed, do not use. @Internal- Specified by:
executeReadRecordin interfaceODatabaseDocumentInternal- Specified by:
executeReadRecordin classODatabaseDocumentAbstract
-
internalLockRecord
- Specified by:
internalLockRecordin interfaceODatabaseDocumentInternal
-
internalLockRecord
public void internalLockRecord(OIdentifiable iRecord, OStorage.LOCKING_STRATEGY lockingStrategy, long timeout) -
internalUnlockRecord
- Specified by:
internalUnlockRecordin interfaceODatabaseDocumentInternal
-
lock
Description copied from interface:ODatabasePessimistic lock a record.In case of lock inside the transaction the lock will be release by the commit operation, In case of lock outside a transaction unlock need to be call manually.
- Specified by:
lockin interfaceODatabase<ORecord>- Parameters:
recordId- the id of the record that need to be locked- Returns:
- the record updated to the last state after the lock.
- Throws:
OLockException- In case of deadlock detected
-
lock
public <RET extends ORecord> RET lock(ORID recordId, long timeout, TimeUnit timeoutUnit) throws OLockException Description copied from interface:ODatabasePessimistic lock a record.- Specified by:
lockin interfaceODatabase<ORecord>- Parameters:
recordId- the id of the record that need to be lockedtimeout- for the record lockingtimeoutUnit- relative for the timeout- Returns:
- the record updated to the last state after the lock.
- Throws:
OLockException- In case of deadlock detected
-
unlock
Description copied from interface:ODatabasePessimistic unlock- Specified by:
unlockin interfaceODatabase<ORecord>- Parameters:
recordId- the id of the record to unlock- Throws:
OLockException- if the record is not locked.
-
sendSequenceAction
public <T> T sendSequenceAction(OSequenceAction action) throws ExecutionException, InterruptedException - Specified by:
sendSequenceActionin interfaceODatabaseDocumentInternal- Throws:
ExecutionExceptionInterruptedException
-
checkSecurity
public <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric resourceGeneric, String resourceSpecific, int iOperation) Checks if the operation on a resource is allowed for the current user.- Specified by:
checkSecurityin interfaceODatabaseDocument- Parameters:
resourceGeneric- Generic Resource where to execute the operationiOperation- Operation to execute against the resource- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
checkSecurity
public <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object... iResourcesSpecific) Checks if the operation against multiple resources is allowed for the current user. The check is made in two steps:- Access to all the resource as *
- Access to the specific target resources
- Specified by:
checkSecurityin interfaceODatabaseDocument- Parameters:
iResourceGeneric- Resource where to execute the operation, i.e.: database.clustersiOperation- Operation to execute against the resourceiResourcesSpecific- Target resources as an array of Objects, i.e.: ["employee", 2] to specify cluster name and id.- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
checkSecurity
public <DB extends ODatabaseDocument> DB checkSecurity(ORule.ResourceGeneric iResourceGeneric, int iOperation, Object iResourceSpecific) Checks if the operation on a resource is allowed for the current user. The check is made in two steps:- Access to all the resource as *
- Access to the specific target resource
- Specified by:
checkSecurityin interfaceODatabaseDocument- Parameters:
iResourceGeneric- Resource where to execute the operation, i.e.: database.clustersiOperation- Operation to execute against the resourceiResourceSpecific- Target resource, i.e.: "employee" to specify the cluster name.- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
addCluster
Description copied from interface:ODatabaseAdds a new cluster.- Specified by:
addClusterin interfaceODatabase<ORecord>- Parameters:
iClusterName- Cluster nameiParameters- Additional parameters to pass to the factories- Returns:
- Cluster id
-
addCluster
Description copied from interface:ODatabaseAdds a new cluster.- Specified by:
addClusterin interfaceODatabase<ORecord>- Parameters:
iClusterName- Cluster nameiRequestedId- requested id of the cluster- Returns:
- Cluster id
-
getConflictStrategy
Description copied from interface:ODatabaseReturns the current record conflict strategy.- Specified by:
getConflictStrategyin interfaceODatabase<ORecord>
-
setConflictStrategy
Description copied from interface:ODatabaseOverrides record conflict strategy selecting the strategy by name.- Specified by:
setConflictStrategyin interfaceODatabase<ORecord>- Parameters:
iStrategyName- ORecordConflictStrategy strategy name- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
setConflictStrategy
Description copied from interface:ODatabaseOverrides record conflict strategy.- Specified by:
setConflictStrategyin interfaceODatabase<ORecord>- Parameters:
iResolver- ORecordConflictStrategy implementation- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
getClusterRecordSizeByName
Description copied from interface:ODatabaseReturns the total size of records contained in the cluster defined by its name.- Specified by:
getClusterRecordSizeByNamein interfaceODatabase<ORecord>- Parameters:
clusterName- Cluster name- Returns:
- Total size of records contained.
-
getClusterRecordSizeById
public long getClusterRecordSizeById(int clusterId) Description copied from interface:ODatabaseReturns the total size of records contained in the cluster defined by its id.- Specified by:
getClusterRecordSizeByIdin interfaceODatabase<ORecord>- Parameters:
clusterId- Cluster id- Returns:
- The name of searched cluster.
-
countClusterElements
public long countClusterElements(int iClusterId) Counts all the entities in the specified cluster id.- Specified by:
countClusterElementsin interfaceODatabase<ORecord>- Parameters:
iClusterId- Cluster id- Returns:
- Total number of entities contained in the specified cluster
-
countClusterElements
public long countClusterElements(int[] iClusterIds) Counts all the entities in the specified cluster ids.- Specified by:
countClusterElementsin interfaceODatabase<ORecord>- Parameters:
iClusterIds- Array of cluster ids Cluster id- Returns:
- Total number of entities contained in the specified clusters
-
countClusterElements
Counts all the entities in the specified cluster name.- Specified by:
countClusterElementsin interfaceODatabase<ORecord>- Parameters:
iClusterName- Cluster name- Returns:
- Total number of entities contained in the specified cluster
-
dropCluster
Description copied from interface:ODatabaseDrops a cluster by its name. Physical clusters will be completely deleted- Specified by:
dropClusterin interfaceODatabase<ORecord>- Parameters:
iClusterName- the name of the cluster- Returns:
- true if has been removed, otherwise false
-
dropClusterInternal
-
dropCluster
public boolean dropCluster(int clusterId) Description copied from interface:ODatabaseDrops a cluster by its id. Physical clusters will be completely deleted.- Specified by:
dropClusterin interfaceODatabase<ORecord>- Parameters:
clusterId- id of cluster to delete- Returns:
- true if has been removed, otherwise false
-
dropClusterInternal
public boolean dropClusterInternal(int clusterId) - Specified by:
dropClusterInternalin interfaceODatabaseDocumentInternal
-
getSize
public long getSize()Description copied from interface:ODatabaseReturns the total size of the records in the database. -
getStats
- Specified by:
getStatsin interfaceODatabaseInternal<ORecord>
-
addRidbagPrefetchStats
public void addRidbagPrefetchStats(long execTimeMs) - Specified by:
addRidbagPrefetchStatsin interfaceODatabaseInternal<ORecord>
-
resetRecordLoadStats
public void resetRecordLoadStats()- Specified by:
resetRecordLoadStatsin interfaceODatabaseInternal<ORecord>
-
incrementalBackup
Description copied from interface:ODatabasePerforms incremental backup of database content to the selected folder. This is thread safe operation and can be done in normal operational mode.If it will be first backup of data full content of database will be copied into folder otherwise only changes after last backup in the same folder will be copied.
- Specified by:
incrementalBackupin interfaceODatabase<ORecord>- Parameters:
path- Path to backup folder.- Returns:
- File name of the backup
- Throws:
UnsupportedOperationException
-
getRecordMetadata
- Specified by:
getRecordMetadatain interfaceODatabase<ORecord>
-
freeze
public void freeze(boolean throwException) Flush all indexes and cached storage content to the disk.After this call users can perform only select queries. All write-related commands will queued till
ODatabaseDocument.release()command will be called or exception will be thrown on attempt to modify DB data. Concrete behaviour depends onthrowExceptionparameter.IMPORTANT: This command is not reentrant.
- Specified by:
freezein interfaceODatabase<ORecord>- Specified by:
freezein interfaceODatabaseDocument- Parameters:
throwException- IftrueOModificationOperationProhibitedExceptionexception will be thrown in case of write command will be performed.
-
freeze
public void freeze()Flush all indexes and cached storage content to the disk.After this call users can perform only select queries. All write-related commands will queued till
ODatabaseDocument.release()command will be called.Given command waits till all on going modifications in indexes or DB will be finished.
IMPORTANT: This command is not reentrant.
- Specified by:
freezein interfaceODatabase<ORecord>- Specified by:
freezein interfaceODatabaseDocument- See Also:
-
release
public void release()Allows to execute write-related commands on DB. Called afterODatabaseDocument.freeze()command.- Specified by:
releasein interfaceODatabase<ORecord>- Specified by:
releasein interfaceODatabaseDocument- See Also:
-
backup
public List<String> backup(OutputStream out, Map<String, Object> options, Callable<Object> callable, OCommandOutputListener iListener, int compressionLevel, int bufferSize) throws IOExceptionDescription copied from interface:OBackupableExecutes a backup of the database. During the backup the database will be frozen in read-only mode.- Specified by:
backupin interfaceOBackupable- Parameters:
out- OutputStream used to write the backup content. Use a FileOutputStream to make the backup persistent on diskoptions- Backup options as Map<String, Object> objectcallable- Callback to execute when the database is lockediListener- Listener called for backup messagescompressionLevel- ZIP Compression level between 1 (the minimum) and 9 (maximum). The bigger is the compression, the smaller will be the final backup content, but will consume more CPU and time to executebufferSize- Buffer size in bytes, the bigger is the buffer, the more efficient will be the compression- Throws:
IOException- See Also:
-
restore
public void restore(InputStream in, Map<String, Object> options, Callable<Object> callable, OCommandOutputListener iListener) throws IOExceptionDescription copied from interface:OBackupableExecutes a restore of a database backup. During the restore the database will be frozen in read-only mode.- Specified by:
restorein interfaceOBackupable- Parameters:
in- InputStream used to read the backup content. Use a FileInputStream to read a backup on a diskoptions- Backup options as Map<String, Object> objectcallable- Callback to execute when the database is lockediListener- Listener called for backup messages- Throws:
IOException- See Also:
-
getSbTreeCollectionManager
Internal. Gets an instance of sb-tree collection manager for current database.- Specified by:
getSbTreeCollectionManagerin interfaceODatabaseDocumentInternal
-
reload
public void reload()Description copied from interface:ODatabaseReloads the database information like the cluster list. -
internalCommit
Description copied from interface:ODatabaseDocumentInternalExecuted the commit on the storage hiding away storage concepts from the transaction- Specified by:
internalCommitin interfaceODatabaseDocumentInternal
-
internalClose
public void internalClose(boolean recycle) - Specified by:
internalClosein interfaceODatabaseDocumentInternal
-
getClusterDataRange
public long[] getClusterDataRange(int currentClusterId) - Specified by:
getClusterDataRangein interfaceODatabaseDocumentInternal
-
setDefaultClusterId
public void setDefaultClusterId(int addCluster) - Specified by:
setDefaultClusterIdin interfaceODatabaseDocumentInternal
-
getLastClusterPosition
public long getLastClusterPosition(int clusterId) - Specified by:
getLastClusterPositionin interfaceODatabaseDocumentInternal
-
getClusterRecordConflictStrategy
- Specified by:
getClusterRecordConflictStrategyin interfaceODatabaseDocumentInternal
-
getClustersIds
- Specified by:
getClustersIdsin interfaceODatabaseDocumentInternal
-
startEsclusiveMetadataChange
public void startEsclusiveMetadataChange()- Specified by:
startEsclusiveMetadataChangein interfaceODatabaseDocumentInternal
-
endEsclusiveMetadataChange
public void endEsclusiveMetadataChange()- Specified by:
endEsclusiveMetadataChangein interfaceODatabaseDocumentInternal
-
truncateClass
- Specified by:
truncateClassin interfaceODatabaseDocumentInternal
-
truncateClass
- Specified by:
truncateClassin interfaceODatabaseDocumentInternal
-
truncateClusterInternal
- Specified by:
truncateClusterInternalin interfaceODatabaseDocumentInternal
-
truncateCluster
Description copied from interface:ODatabaseRemoves all data in the cluster with given name. As result indexes for this class will be rebuilt.- Specified by:
truncateClusterin interfaceODatabase<ORecord>- Parameters:
clusterName- Name of cluster to be truncated.
-
commitPreallocate
public void commitPreallocate()- Specified by:
commitPreallocatein interfaceODatabaseDocumentInternal
-
internalCommitPreallocate
- Specified by:
internalCommitPreallocatein interfaceODatabaseDocumentInternal
-
higherPhysicalPositions
public OPhysicalPosition[] higherPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) - Specified by:
higherPhysicalPositionsin interfaceODatabaseDocumentInternal
-
lowerPhysicalPositions
public OPhysicalPosition[] lowerPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) - Specified by:
lowerPhysicalPositionsin interfaceODatabaseDocumentInternal
-
ceilingPhysicalPositions
public OPhysicalPosition[] ceilingPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) - Specified by:
ceilingPhysicalPositionsin interfaceODatabaseDocumentInternal
-
floorPhysicalPositions
public OPhysicalPosition[] floorPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition) - Specified by:
floorPhysicalPositionsin interfaceODatabaseDocumentInternal
-
countRecords
public long countRecords()- Specified by:
countRecordsin interfaceODatabaseDocumentInternal
-
isReusable
public boolean isReusable()- Specified by:
isReusablein interfaceODatabaseDocumentInternal
-
createSBTree
- Specified by:
createSBTreein interfaceODatabaseDocumentInternal
-
directRead
public ORawBuffer directRead(ORecordId rid, String fetchPlan, boolean ignoreCache, int recordVersion) - Specified by:
directReadin interfaceODatabaseDocumentInternal
-
readIfVersionIsNotLatest
public ORawBuffer readIfVersionIsNotLatest(ORecordId rid, String fetchPlan, boolean ignoreCache, int recordVersion) - Specified by:
readIfVersionIsNotLatestin interfaceODatabaseDocumentInternal