
public class ODistributedStorage extends Object implements OStorage, OFreezableStorageComponent, OAutoshardedStorage
OStorage.LOCKING_STRATEGY, OStorage.SIZE, OStorage.STATUSCLUSTER_DEFAULT_NAME| Constructor and Description |
|---|
ODistributedStorage(OServer iServer,
String dbName) |
| Modifier and Type | Method and Description |
|---|---|
protected ODistributedRequestId |
acquireRecordLock(ORecordId rid) |
int |
addCluster(String iClusterName,
boolean forceListBased,
Object... iParameters)
Add a new cluster into the storage.
|
int |
addCluster(String iClusterName,
int iRequestedId,
boolean forceListBased,
Object... iParameters)
Add a new cluster into the storage.
|
protected void |
asynchronousExecution(OAsynchDistributedOperation iOperation) |
List<String> |
backup(OutputStream out,
Map<String,Object> options,
Callable<Object> callable,
OCommandOutputListener iListener,
int compressionLevel,
int bufferSize)
Executes a backup of the database.
|
<V> V |
callInLock(Callable<V> iCallable,
boolean iExclusiveLock) |
OPhysicalPosition[] |
ceilingPhysicalPositions(int clusterId,
OPhysicalPosition physicalPosition) |
protected String |
checkForCluster(ORecord record,
String localNodeName,
ODistributedConfiguration dbCfg) |
void |
checkForClusterPermissions(String iClusterName) |
boolean |
checkForRecordValidity(OPhysicalPosition ppos) |
protected void |
checkNodeIsMaster(String localNodeName,
ODistributedConfiguration dbCfg,
String operation) |
protected void |
checkWriteQuorum(ODistributedConfiguration dbCfg,
String clusterName,
String localNodeName) |
boolean |
cleanOutRecord(ORecordId recordId,
int recordVersion,
int iMode,
ORecordCallback<Boolean> callback) |
void |
clearProperties() |
void |
close() |
void |
close(boolean iForce,
boolean onDelete) |
void |
closeAndMove(OCallable<Void,String> mover) |
Object |
command(OCommandRequestText iCommand)
Execute the command request and return the result back.
|
List<ORecordOperation> |
commit(OTransaction iTx,
Runnable callback) |
long |
count(int iClusterId) |
long |
count(int[] iClusterIds) |
long |
count(int[] iClusterIds,
boolean countTombstones) |
long |
count(int iClusterId,
boolean countTombstones) |
long |
countRecords()
Returns the total number of records.
|
void |
create(Map<String,Object> iProperties) |
OStorageOperationResult<OPhysicalPosition> |
createRecord(ORecordId iRecordId,
byte[] iContent,
int iRecordVersion,
byte iRecordType,
int iMode,
ORecordCallback<Long> iCallback) |
void |
delete() |
OStorageOperationResult<Boolean> |
deleteRecord(ORecordId iRecordId,
int iVersion,
int iMode,
ORecordCallback<Boolean> iCallback) |
boolean |
dropCluster(int iId,
boolean iTruncate)
Drops a cluster.
|
boolean |
dropCluster(String iClusterName,
boolean iTruncate) |
protected void |
dropStorageFiles() |
protected Object |
executeCommand(OCommandRequestText iCommand,
String localNodeName,
Collection<String> involvedClusters,
OAbstractCommandTask task,
Set<String> nodes,
boolean executedLocally) |
protected boolean |
executeOnlyLocally(String localNodeName,
ODistributedConfiguration dbCfg,
OCommandExecutor exec,
Collection<String> involvedClusters,
Collection<String> nodes)
Only idempotent commands that don't involve any other node can be executed locally.
|
protected Map<String,Object> |
executeOnServers(OCommandRequestText iCommand,
OCommandExecutor exec,
Collection<String> involvedClusters,
Map<String,Collection<String>> nodeClusterMap) |
boolean |
exists() |
boolean |
existsResource(String iName) |
OPhysicalPosition[] |
floorPhysicalPositions(int clusterId,
OPhysicalPosition physicalPosition) |
void |
freeze(boolean throwException)
After this method finished it's execution, all threads that are going to perform data modifications in storage should wait till
OFreezableStorageComponent.release() method will be called. |
protected OAsyncReplicationError |
getAsyncReplicationError() |
OCluster |
getClusterById(int iId) |
OCluster |
getClusterByName(String iName) |
long[] |
getClusterDataRange(int currentClusterId)
Returns a pair of long values telling the begin and end positions of data in the requested cluster.
|
int |
getClusterIdByName(String iClusterName) |
Collection<? extends OCluster> |
getClusterInstances() |
String |
getClusterNameByRID(ORecordId iRid) |
Set<String> |
getClusterNames() |
int |
getClusters() |
OCurrentStorageComponentsFactory |
getComponentsFactory() |
OStorageConfiguration |
getConfiguration() |
int |
getConfigurationUpdated() |
ORecordConflictStrategy |
getConflictStrategy() |
int |
getDefaultClusterId() |
protected File |
getDistributedConfigFile() |
ODistributedConfiguration |
getDistributedConfiguration() |
ODistributedServerManager |
getDistributedManager() |
ODistributedStorageEventListener |
getEventListener() |
File |
getLastValidBackup() |
String |
getName() |
String |
getNodeId() |
String |
getPhysicalClusterNameById(int iClusterId) |
ORecordMetadata |
getRecordMetadata(ORID rid) |
<T> T |
getResource(String iName,
Callable<T> iCallback) |
OSBTreeCollectionManager |
getSBtreeCollectionManager() |
OServer |
getServer() |
long |
getSize()
Returns the size of the database.
|
OStorage.STATUS |
getStatus()
Returns the current storage's status
|
String |
getStorageId()
Storage unique id, made by node name + database name
|
String |
getType()
Returns the storage's type.
|
OStorage |
getUnderlying() |
String |
getURL() |
long |
getVersion() |
protected void |
handleDistributedException(String iMessage,
Exception e,
Object... iParams) |
OStorageOperationResult<Boolean> |
hideRecord(ORecordId recordId,
int mode,
ORecordCallback<Boolean> callback) |
OPhysicalPosition[] |
higherPhysicalPositions(int currentClusterId,
OPhysicalPosition entry) |
String |
incrementalBackup(String backupDirectory) |
boolean |
isAssigningClusterIds() |
boolean |
isClosed() |
boolean |
isDistributed() |
boolean |
isFrozen()
Returns true if the storage is frozen, otherwise false.
|
boolean |
isRemote() |
ODocument |
loadDatabaseConfiguration(File file) |
OPhysicalPosition[] |
lowerPhysicalPositions(int currentClusterId,
OPhysicalPosition entry) |
protected Object |
mergeResultByAggregation(OCommandExecutorSQLSelect select,
Map<String,Object> iResults) |
void |
open(String iUserName,
String iUserPassword,
Map<String,Object> iProperties) |
OStorageOperationResult<ORawBuffer> |
readRecord(ORecordId iRecordId,
String iFetchPlan,
boolean iIgnoreCache,
boolean prefetchRecords,
ORecordCallback<ORawBuffer> iCallback) |
OStorageOperationResult<ORawBuffer> |
readRecordIfVersionIsNotLatest(ORecordId rid,
String fetchPlan,
boolean ignoreCache,
int recordVersion) |
void |
recyclePosition(ORecordId iRecordId,
byte[] content,
int recordVersion,
byte recordType)
Resurrects a record that was previously deleted.
|
void |
release()
After this method finished execution all threads that are waiting to perform data modifications in storage will be awaken and
will be allowed to continue their execution.
|
protected void |
releaseRecordLock(ORecordId rid,
ODistributedRequestId requestId) |
void |
reload() |
void |
removeProperty(String property) |
<T> T |
removeResource(String iName) |
void |
restore(InputStream in,
Map<String,Object> options,
Callable<Object> callable,
OCommandOutputListener iListener)
Executes a restore of a database backup.
|
void |
restoreFromIncrementalBackup(String filePath) |
void |
rollback(OTransaction iTx) |
protected void |
saveDatabaseConfiguration() |
void |
setCharset(String charset) |
void |
setClusterSelection(String clusterSelection) |
void |
setConflictStrategy(ORecordConflictStrategy iResolver) |
void |
setDateFormat(String dateFormat) |
void |
setDateTimeFormat(String dateTimeFormat) |
void |
setDefaultClusterId(int defaultClusterId) |
void |
setDistributedConfiguration(OModifiableDistributedConfiguration distributedConfiguration) |
void |
setEventListener(ODistributedStorageEventListener eventListener) |
void |
setIndexMgrRecordId(String indexMgrRecordId) |
void |
setLastValidBackup(File lastValidBackup) |
void |
setLocaleCountry(String localeCountry) |
void |
setLocaleLanguage(String localeLanguage) |
void |
setMinimumClusters(int minimumClusters) |
void |
setProperty(String property,
String value) |
void |
setRecordSerializer(String recordSerializer,
int version) |
void |
setSchemaRecordId(String schemaRecordId) |
void |
setTimeZone(TimeZone timeZone) |
void |
setValidation(boolean validation) |
void |
shutdown()
This method is called in
Orient.shutdown() method. |
void |
shutdownAsynchronousWorker() |
void |
synch() |
protected void |
undoCommandOnLocalServer(OCommandRequestText iCommand) |
void |
updateConfiguration() |
OStorageOperationResult<Integer> |
updateRecord(ORecordId iRecordId,
boolean updateContent,
byte[] iContent,
int iVersion,
byte iRecordType,
int iMode,
ORecordCallback<Integer> iCallback) |
void |
wrap(OAbstractPaginatedStorage wrapped) |
public void wrap(OAbstractPaginatedStorage wrapped)
public boolean isDistributed()
isDistributed in interface OStoragepublic boolean isAssigningClusterIds()
isAssigningClusterIds in interface OStoragepublic Object command(OCommandRequestText iCommand)
OStorageprotected Object executeCommand(OCommandRequestText iCommand, String localNodeName, Collection<String> involvedClusters, OAbstractCommandTask task, Set<String> nodes, boolean executedLocally)
protected void undoCommandOnLocalServer(OCommandRequestText iCommand)
protected Map<String,Object> executeOnServers(OCommandRequestText iCommand, OCommandExecutor exec, Collection<String> involvedClusters, Map<String,Collection<String>> nodeClusterMap)
protected Object mergeResultByAggregation(OCommandExecutorSQLSelect select, Map<String,Object> iResults)
protected boolean executeOnlyLocally(String localNodeName, ODistributedConfiguration dbCfg, OCommandExecutor exec, Collection<String> involvedClusters, Collection<String> nodes)
public OStorageOperationResult<OPhysicalPosition> createRecord(ORecordId iRecordId, byte[] iContent, int iRecordVersion, byte iRecordType, int iMode, ORecordCallback<Long> iCallback)
createRecord in interface OStoragepublic OStorageOperationResult<ORawBuffer> readRecord(ORecordId iRecordId, String iFetchPlan, boolean iIgnoreCache, boolean prefetchRecords, ORecordCallback<ORawBuffer> iCallback)
readRecord in interface OStoragepublic OStorageOperationResult<ORawBuffer> readRecordIfVersionIsNotLatest(ORecordId rid, String fetchPlan, boolean ignoreCache, int recordVersion) throws ORecordNotFoundException
readRecordIfVersionIsNotLatest in interface OStorageORecordNotFoundExceptionpublic OStorageOperationResult<Integer> updateRecord(ORecordId iRecordId, boolean updateContent, byte[] iContent, int iVersion, byte iRecordType, int iMode, ORecordCallback<Integer> iCallback)
updateRecord in interface OStoragepublic OStorageOperationResult<Boolean> deleteRecord(ORecordId iRecordId, int iVersion, int iMode, ORecordCallback<Boolean> iCallback)
deleteRecord in interface OStoragepublic OSBTreeCollectionManager getSBtreeCollectionManager()
getSBtreeCollectionManager in interface OStorageprotected void checkWriteQuorum(ODistributedConfiguration dbCfg, String clusterName, String localNodeName)
public void recyclePosition(ORecordId iRecordId, byte[] content, int recordVersion, byte recordType)
OStoragerecyclePosition in interface OStoragepublic int getConfigurationUpdated()
public OStorageOperationResult<Boolean> hideRecord(ORecordId recordId, int mode, ORecordCallback<Boolean> callback)
hideRecord in interface OStoragepublic ORecordMetadata getRecordMetadata(ORID rid)
getRecordMetadata in interface OStoragepublic boolean cleanOutRecord(ORecordId recordId, int recordVersion, int iMode, ORecordCallback<Boolean> callback)
cleanOutRecord in interface OStoragepublic boolean existsResource(String iName)
existsResource in interface OSharedContainerpublic OCluster getClusterByName(String iName)
getClusterByName in interface OStoragepublic ORecordConflictStrategy getConflictStrategy()
getConflictStrategy in interface OStoragepublic void setConflictStrategy(ORecordConflictStrategy iResolver)
setConflictStrategy in interface OStoragepublic <T> T removeResource(String iName)
removeResource in interface OSharedContainerpublic <T> T getResource(String iName, Callable<T> iCallback)
getResource in interface OSharedContainerpublic String incrementalBackup(String backupDirectory)
incrementalBackup in interface OStoragepublic void restoreFromIncrementalBackup(String filePath)
restoreFromIncrementalBackup in interface OStoragepublic List<ORecordOperation> commit(OTransaction iTx, Runnable callback)
protected ODistributedRequestId acquireRecordLock(ORecordId rid)
protected void releaseRecordLock(ORecordId rid, ODistributedRequestId requestId)
public void rollback(OTransaction iTx)
public OStorageConfiguration getConfiguration()
getConfiguration in interface OStoragepublic int getClusters()
getClusters in interface OStoragepublic Set<String> getClusterNames()
getClusterNames in interface OStoragepublic OCluster getClusterById(int iId)
getClusterById in interface OStoragepublic Collection<? extends OCluster> getClusterInstances()
getClusterInstances in interface OStoragepublic int addCluster(String iClusterName, boolean forceListBased, Object... iParameters)
OStorageaddCluster in interface OStorageiClusterName - name of the clusterpublic int addCluster(String iClusterName, int iRequestedId, boolean forceListBased, Object... iParameters)
OStorageaddCluster in interface OStorageiClusterName - name of the clusteriRequestedId - requested id of the clusterpublic boolean dropCluster(String iClusterName, boolean iTruncate)
dropCluster in interface OStoragepublic boolean dropCluster(int iId,
boolean iTruncate)
OStoragedropCluster in interface OStorageiId - id of the cluster to deletepublic long count(int iClusterId,
boolean countTombstones)
public long count(int[] iClusterIds,
boolean countTombstones)
public long getSize()
OStoragepublic long countRecords()
OStoragecountRecords in interface OStoragepublic int getDefaultClusterId()
getDefaultClusterId in interface OStoragepublic void setDefaultClusterId(int defaultClusterId)
setDefaultClusterId in interface OStoragepublic int getClusterIdByName(String iClusterName)
getClusterIdByName in interface OStoragepublic String getPhysicalClusterNameById(int iClusterId)
getPhysicalClusterNameById in interface OStoragepublic boolean checkForRecordValidity(OPhysicalPosition ppos)
checkForRecordValidity in interface OStoragepublic long getVersion()
getVersion in interface OStoragepublic long[] getClusterDataRange(int currentClusterId)
OStoragegetClusterDataRange in interface OStoragecurrentClusterId - Cluster idpublic <V> V callInLock(Callable<V> iCallable, boolean iExclusiveLock)
callInLock in interface OStoragepublic OStorage.STATUS getStatus()
OStoragepublic ODistributedStorageEventListener getEventListener()
public void setEventListener(ODistributedStorageEventListener eventListener)
public void checkForClusterPermissions(String iClusterName)
checkForClusterPermissions in interface OStoragepublic OPhysicalPosition[] higherPhysicalPositions(int currentClusterId, OPhysicalPosition entry)
higherPhysicalPositions in interface OStoragepublic OServer getServer()
public ODistributedServerManager getDistributedManager()
public ODistributedConfiguration getDistributedConfiguration()
public void setDistributedConfiguration(OModifiableDistributedConfiguration distributedConfiguration)
public OPhysicalPosition[] ceilingPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition)
ceilingPhysicalPositions in interface OStoragepublic OPhysicalPosition[] floorPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition)
floorPhysicalPositions in interface OStoragepublic OPhysicalPosition[] lowerPhysicalPositions(int currentClusterId, OPhysicalPosition entry)
lowerPhysicalPositions in interface OStoragepublic OStorage getUnderlying()
getUnderlying in interface OStoragepublic OCurrentStorageComponentsFactory getComponentsFactory()
getComponentsFactory in interface OStoragepublic String getType()
OStoragepublic void freeze(boolean throwException)
OFreezableStorageComponentOFreezableStorageComponent.release() method will be called. This method will wait till all ongoing modifications will be finished.freeze in interface OFreezableStorageComponentthrowException - If true OModificationOperationProhibitedException
exception will be thrown on call of methods that requires storage modification. Otherwise other threads
will wait for OFreezableStorageComponent.release() method call.public boolean isFrozen()
OFreezableStorageComponentisFrozen in interface OFreezableStorageComponentpublic void release()
OFreezableStorageComponentrelease in interface OFreezableStorageComponentpublic List<String> backup(OutputStream out, Map<String,Object> options, Callable<Object> callable, OCommandOutputListener iListener, int compressionLevel, int bufferSize) throws IOException
OBackupablebackup in interface OBackupableout - OutputStream used to write the backup content. Use a FileOutputStream to make the backup persistent on diskoptions - Backup options as Mapcallable - 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 compressionIOExceptionODatabaseExportpublic void restore(InputStream in, Map<String,Object> options, Callable<Object> callable, OCommandOutputListener iListener) throws IOException
OBackupablerestore in interface OBackupablein - InputStream used to read the backup content. Use a FileInputStream to read a backup on a diskoptions - Backup options as Mapcallable - Callback to execute when the database is lockediListener - Listener called for backup messagesIOExceptionODatabaseImportpublic String getStorageId()
OAutoshardedStoragegetStorageId in interface OAutoshardedStoragepublic String getNodeId()
getNodeId in interface OAutoshardedStoragepublic void shutdown()
OStorageOrient.shutdown() method. For most of the storages it means
that storage will be merely closed, but sometimes additional operations are need to be taken in account.public void shutdownAsynchronousWorker()
protected void checkNodeIsMaster(String localNodeName, ODistributedConfiguration dbCfg, String operation)
public File getLastValidBackup()
public void setLastValidBackup(File lastValidBackup)
protected void asynchronousExecution(OAsynchDistributedOperation iOperation)
protected OAsyncReplicationError getAsyncReplicationError()
protected void handleDistributedException(String iMessage, Exception e, Object... iParams)
protected void dropStorageFiles()
protected String checkForCluster(ORecord record, String localNodeName, ODistributedConfiguration dbCfg)
protected void saveDatabaseConfiguration()
protected File getDistributedConfigFile()
public void updateConfiguration()
updateConfiguration in interface OStoragepublic void setRecordSerializer(String recordSerializer, int version)
setRecordSerializer in interface OStoragepublic void setProperty(String property, String value)
setProperty in interface OStoragepublic void setDateFormat(String dateFormat)
setDateFormat in interface OStoragepublic void setDateTimeFormat(String dateTimeFormat)
setDateTimeFormat in interface OStoragepublic void setTimeZone(TimeZone timeZone)
setTimeZone in interface OStoragepublic void setLocaleCountry(String localeCountry)
setLocaleCountry in interface OStoragepublic void setLocaleLanguage(String localeLanguage)
setLocaleLanguage in interface OStoragepublic void setCharset(String charset)
setCharset in interface OStoragepublic void setClusterSelection(String clusterSelection)
setClusterSelection in interface OStoragepublic void setMinimumClusters(int minimumClusters)
setMinimumClusters in interface OStoragepublic void setValidation(boolean validation)
setValidation in interface OStoragepublic void clearProperties()
clearProperties in interface OStoragepublic void removeProperty(String property)
removeProperty in interface OStoragepublic void setSchemaRecordId(String schemaRecordId)
setSchemaRecordId in interface OStoragepublic void setIndexMgrRecordId(String indexMgrRecordId)
setIndexMgrRecordId in interface OStorageCopyright © 2009–2025 OrientDB. All rights reserved.