
public class OStorageRemote extends OStorageAbstract implements OStorageProxy
| Modifier and Type | Class and Description |
|---|---|
static class |
OStorageRemote.CONNECTION_STRATEGY |
OStorage.LOCKING_STRATEGY, OStorage.SIZE, OStorage.STATUS| Modifier and Type | Field and Description |
|---|---|
protected Map<String,OCluster> |
clusterMap |
static String |
DRIVER_NAME |
static String |
PARAM_CONNECTION_STRATEGY |
protected List<String> |
serverURLs |
componentsFactory, configuration, dataLock, mode, name, stateLock, status, storageThreadGroup, url, versionCLUSTER_DEFAULT_NAME| Constructor and Description |
|---|
OStorageRemote(String iClientId,
String iURL,
String iMode) |
OStorageRemote(String iClientId,
String iURL,
String iMode,
OStorage.STATUS status,
boolean managePushMessages) |
| Modifier and Type | Method and Description |
|---|---|
int |
addCluster(String iClusterName,
boolean forceListBased,
Object... iArguments)
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 String |
addHost(String host)
Registers the remote server with port.
|
int |
addUser() |
List<String> |
backup(OutputStream out,
Map<String,Object> options,
Callable<Object> callable,
OCommandOutputListener iListener,
int compressionLevel,
int bufferSize)
Executes a backup of the database.
|
OChannelBinaryAsynchClient |
beginRequest(OChannelBinaryAsynchClient network,
byte iCommand)
Acquire a network channel from the pool.
|
void |
beginResponse(OChannelBinaryAsynchClient iNetwork)
Starts listening the response.
|
OPhysicalPosition[] |
ceilingPhysicalPositions(int clusterId,
OPhysicalPosition physicalPosition) |
boolean |
cleanOutRecord(ORecordId recordId,
int recordVersion,
int iMode,
ORecordCallback<Boolean> callback) |
void |
close(boolean iForce,
boolean onDelete) |
Object |
command(OCommandRequestText iCommand)
Execute the command remotely and get the results back.
|
List<ORecordOperation> |
commit(OTransaction iTx,
Runnable callback) |
OStorageRemote |
copy(ODatabaseDocumentTx source,
ODatabaseDocumentTx dest) |
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> iOptions) |
OStorageOperationResult<OPhysicalPosition> |
createRecord(ORecordId iRid,
byte[] iContent,
int iRecordVersion,
byte iRecordType,
int iMode,
ORecordCallback<Long> iCallback) |
void |
delete() |
OStorageOperationResult<Boolean> |
deleteRecord(ORecordId iRid,
int iVersion,
int iMode,
ORecordCallback<Boolean> iCallback) |
boolean |
dropCluster(int iClusterId,
boolean iTruncate)
Drops a cluster.
|
void |
endRequest(OChannelBinaryAsynchClient iNetwork)
Ends the request and unlock the write lock
|
void |
endResponse(OChannelBinaryAsynchClient iNetwork)
End response reached: release the channel in the pool to being reused
|
boolean |
exists() |
OPhysicalPosition[] |
floorPhysicalPositions(int clusterId,
OPhysicalPosition physicalPosition) |
OContextConfiguration |
getClientConfiguration() |
OCluster |
getClusterById(int iClusterId) |
OCluster |
getClusterByName(String iClusterName) |
ODocument |
getClusterConfiguration() |
long[] |
getClusterDataRange(int iClusterId)
Returns a pair of long values telling the begin and end positions of data in the requested cluster.
|
int |
getClusterIdByName(String iClusterName) |
Collection<OCluster> |
getClusterInstances() |
int |
getClusterMap() |
Set<String> |
getClusterNames() |
int |
getClusters() |
ORecordConflictStrategy |
getConflictStrategy() |
protected String |
getCurrentServerURL() |
protected OStorageRemoteSession |
getCurrentSession() |
int |
getDefaultClusterId() |
protected int |
getDefaultPort() |
protected int |
getDefaultSSLPort() |
OEngineRemote |
getEngine() |
OChannelBinaryAsynchClient |
getNetwork(String iCurrentURL) |
protected String |
getNextAvailableServerURL(boolean iIsConnectOperation,
OStorageRemoteSession session) |
String |
getPhysicalClusterNameById(int iClusterId) |
ORecordMetadata |
getRecordMetadata(ORID rid) |
protected void |
getResponse(OChannelBinaryAsynchClient iNetwork) |
OSBTreeCollectionManager |
getSBtreeCollectionManager() |
protected String |
getServerURFromList(boolean iNextAvailable,
OStorageRemoteSession session) |
String |
getServerURL() |
int |
getSessionId() |
long |
getSize()
Returns the size of the database.
|
String |
getType()
Returns the storage's type.
|
String |
getURL() |
String |
getUserName() |
int |
getUsers() |
long |
getVersion()
Returns current storage's version as serial.
|
OStorageOperationResult<Boolean> |
hideRecord(ORecordId recordId,
int mode,
ORecordCallback<Boolean> callback) |
OPhysicalPosition[] |
higherPhysicalPositions(int iClusterId,
OPhysicalPosition iClusterPosition) |
String |
incrementalBackup(String backupDirectory) |
OUncompletedCommit<List<ORecordOperation>> |
initiateCommit(OTransaction iTx,
Runnable callback) |
boolean |
isAssigningClusterIds() |
boolean |
isClosed() |
boolean |
isPermanentRequester() |
boolean |
isRemote() |
OPhysicalPosition[] |
lowerPhysicalPositions(int iClusterId,
OPhysicalPosition physicalPosition) |
<T> T |
networkOperation(OStorageRemoteOperation<T> operation,
String errorMessage) |
void |
open(String iUserName,
String iUserPassword,
Map<String,Object> iOptions) |
protected String |
openRemoteDatabase() |
void |
openRemoteDatabase(OChannelBinaryAsynchClient network) |
protected String |
openRemoteDatabase(String currentURL) |
protected void |
parseServerURLs()
Parse the URLs.
|
OStorageOperationResult<ORawBuffer> |
readRecord(ORecordId iRid,
String iFetchPlan,
boolean iIgnoreCache,
ORecordCallback<ORawBuffer> iCallback) |
OStorageOperationResult<ORawBuffer> |
readRecordIfVersionIsNotLatest(ORecordId rid,
String fetchPlan,
boolean ignoreCache,
int recordVersion) |
protected Object |
readSynchResult(OChannelBinaryAsynchClient network,
ODatabaseDocument database) |
OStorageOperationResult<Integer> |
recyclePosition(ORecordId iRecordId,
byte[] iContent,
int iVersion,
byte recordType)
Resurrects a record that was previously deleted, with a new content.
|
void |
reload() |
int |
removeUser() |
protected String |
reopenRemoteDatabase() |
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 |
sendClientInfo(OChannelBinaryAsynchClient network,
String driverName,
boolean supportsPushMessages,
boolean collectStats) |
void |
setConflictStrategy(ORecordConflictStrategy iResolver) |
void |
setDefaultClusterId(int defaultClusterId) |
void |
synch() |
void |
updateClusterConfiguration(String iConnectedURL,
byte[] obj) |
OStorageOperationResult<Integer> |
updateRecord(ORecordId iRid,
boolean updateContent,
byte[] iContent,
int iVersion,
byte iRecordType,
int iMode,
ORecordCallback<Integer> iCallback) |
protected String |
useNewServerURL(String iUrl) |
callInLock, checkForClusterPermissions, checkForRecordValidity, close, dropCluster, existsResource, getComponentsFactory, getConfiguration, getName, getResource, getStatus, getUnderlying, isDistributed, normalizeName, removeResource, shutdown, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcallInLock, checkForClusterPermissions, checkForRecordValidity, close, dropCluster, getComponentsFactory, getConfiguration, getName, getStatus, getUnderlying, isDistributed, shutdownexistsResource, getResource, removeResourcepublic static final String PARAM_CONNECTION_STRATEGY
public static final String DRIVER_NAME
public OStorageRemote(String iClientId, String iURL, String iMode) throws IOException
IOExceptionpublic OStorageRemote(String iClientId, String iURL, String iMode, OStorage.STATUS status, boolean managePushMessages) throws IOException
IOExceptionpublic <T> T networkOperation(OStorageRemoteOperation<T> operation, String errorMessage)
public boolean isAssigningClusterIds()
isAssigningClusterIds in interface OStorageisAssigningClusterIds in class OStorageAbstractpublic int getSessionId()
public String getServerURL()
public OSBTreeCollectionManager getSBtreeCollectionManager()
getSBtreeCollectionManager in interface OStoragepublic void close(boolean iForce,
boolean onDelete)
close in interface OStorageclose in class OStorageAbstractpublic int getUsers()
getUsers in interface OStorageProxypublic int addUser()
addUser in interface OStorageProxypublic int removeUser()
removeUser in interface OStorageProxypublic Set<String> getClusterNames()
getClusterNames in interface OStoragepublic OStorageOperationResult<OPhysicalPosition> createRecord(ORecordId iRid, byte[] iContent, int iRecordVersion, byte iRecordType, int iMode, ORecordCallback<Long> iCallback)
createRecord in interface OStoragepublic ORecordMetadata getRecordMetadata(ORID rid)
getRecordMetadata in interface OStoragepublic OStorageOperationResult<ORawBuffer> readRecordIfVersionIsNotLatest(ORecordId rid, String fetchPlan, boolean ignoreCache, int recordVersion) throws ORecordNotFoundException
readRecordIfVersionIsNotLatest in interface OStorageORecordNotFoundExceptionpublic OStorageOperationResult<ORawBuffer> readRecord(ORecordId iRid, String iFetchPlan, boolean iIgnoreCache, ORecordCallback<ORawBuffer> iCallback)
readRecord in interface OStoragepublic String incrementalBackup(String backupDirectory)
incrementalBackup in interface OStoragepublic void restoreFromIncrementalBackup(String filePath)
restoreFromIncrementalBackup in interface OStoragepublic OStorageOperationResult<Integer> updateRecord(ORecordId iRid, boolean updateContent, byte[] iContent, int iVersion, byte iRecordType, int iMode, ORecordCallback<Integer> iCallback)
updateRecord in interface OStoragepublic OStorageOperationResult<Integer> recyclePosition(ORecordId iRecordId, byte[] iContent, int iVersion, byte recordType)
OStoragerecyclePosition in interface OStoragepublic OStorageOperationResult<Boolean> deleteRecord(ORecordId iRid, int iVersion, int iMode, ORecordCallback<Boolean> iCallback)
deleteRecord in interface OStoragepublic OStorageOperationResult<Boolean> hideRecord(ORecordId recordId, int mode, ORecordCallback<Boolean> callback)
hideRecord in interface OStoragepublic boolean cleanOutRecord(ORecordId recordId, int recordVersion, int iMode, ORecordCallback<Boolean> callback)
cleanOutRecord in interface OStoragepublic 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 OContextConfiguration getClientConfiguration()
public long count(int iClusterId,
boolean countTombstones)
public long[] getClusterDataRange(int iClusterId)
OStoragegetClusterDataRange in interface OStorageiClusterId - Cluster idpublic OPhysicalPosition[] higherPhysicalPositions(int iClusterId, OPhysicalPosition iClusterPosition)
higherPhysicalPositions in interface OStoragepublic OPhysicalPosition[] ceilingPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition)
ceilingPhysicalPositions in interface OStoragepublic OPhysicalPosition[] lowerPhysicalPositions(int iClusterId, OPhysicalPosition physicalPosition)
lowerPhysicalPositions in interface OStoragepublic OPhysicalPosition[] floorPhysicalPositions(int clusterId, OPhysicalPosition physicalPosition)
floorPhysicalPositions in interface OStoragepublic long getSize()
OStoragepublic long countRecords()
OStoragecountRecords in interface OStoragecountRecords in class OStorageAbstractpublic long count(int[] iClusterIds,
boolean countTombstones)
public Object command(OCommandRequestText iCommand)
protected Object readSynchResult(OChannelBinaryAsynchClient network, ODatabaseDocument database) throws IOException
IOExceptionpublic List<ORecordOperation> commit(OTransaction iTx, Runnable callback)
public OUncompletedCommit<List<ORecordOperation>> initiateCommit(OTransaction iTx, Runnable callback)
initiateCommit in interface OStoragepublic void rollback(OTransaction iTx)
public int getClusterIdByName(String iClusterName)
getClusterIdByName in interface OStoragepublic int getDefaultClusterId()
getDefaultClusterId in interface OStoragepublic void setDefaultClusterId(int defaultClusterId)
setDefaultClusterId in interface OStoragepublic int addCluster(String iClusterName, boolean forceListBased, Object... iArguments)
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(int iClusterId,
boolean iTruncate)
OStoragedropCluster in interface OStorageiClusterId - id of the cluster to deletepublic String getPhysicalClusterNameById(int iClusterId)
getPhysicalClusterNameById in interface OStoragepublic int getClusterMap()
public Collection<OCluster> getClusterInstances()
getClusterInstances in interface OStoragepublic OCluster getClusterById(int iClusterId)
getClusterById in interface OStoragepublic long getVersion()
OStorageAbstractgetVersion in interface OStoragegetVersion in class OStorageAbstractpublic ODocument getClusterConfiguration()
public void endRequest(OChannelBinaryAsynchClient iNetwork) throws IOException
IOExceptionpublic void endResponse(OChannelBinaryAsynchClient iNetwork)
public boolean isPermanentRequester()
public void updateClusterConfiguration(String iConnectedURL, byte[] obj)
public OCluster getClusterByName(String iClusterName)
getClusterByName in interface OStoragegetClusterByName in class OStorageAbstractpublic ORecordConflictStrategy getConflictStrategy()
getConflictStrategy in interface OStoragepublic void setConflictStrategy(ORecordConflictStrategy iResolver)
setConflictStrategy in interface OStoragepublic String getURL()
getURL in interface OStoragegetURL in class OStorageAbstractpublic int getClusters()
getClusters in interface OStoragepublic String getType()
OStoragepublic OEngineRemote getEngine()
public String getUserName()
getUserName in interface OStorageProxyprotected String reopenRemoteDatabase() throws IOException
IOExceptionprotected String openRemoteDatabase() throws IOException
IOExceptionpublic void openRemoteDatabase(OChannelBinaryAsynchClient network) throws IOException
IOExceptionprotected void sendClientInfo(OChannelBinaryAsynchClient network, String driverName, boolean supportsPushMessages, boolean collectStats) throws IOException
IOExceptionprotected void parseServerURLs()
protected int getDefaultPort()
protected int getDefaultSSLPort()
public OChannelBinaryAsynchClient beginRequest(OChannelBinaryAsynchClient network, byte iCommand) throws IOException
iCommand - id. Ids described at OChannelBinaryProtocolIOExceptionprotected String getNextAvailableServerURL(boolean iIsConnectOperation, OStorageRemoteSession session)
protected String getCurrentServerURL()
protected String getServerURFromList(boolean iNextAvailable, OStorageRemoteSession session)
public OChannelBinaryAsynchClient getNetwork(String iCurrentURL)
public void beginResponse(OChannelBinaryAsynchClient iNetwork) throws IOException
IOExceptionprotected void getResponse(OChannelBinaryAsynchClient iNetwork) throws IOException
IOExceptionprotected OStorageRemoteSession getCurrentSession()
public boolean isClosed()
isClosed in interface OStorageisClosed in class OStorageAbstractpublic OStorageRemote copy(ODatabaseDocumentTx source, ODatabaseDocumentTx dest)
copy in interface OStorageProxyCopyright © 2009–2016 Orient Technologies. All rights reserved.