Class SyncHybridStorageAdapter
java.lang.Object
com.gigaspaces.internal.sync.hybrid.SyncHybridStorageAdapter
- All Implemented Interfaces:
IBlobStoreStorageAdapter,IStorageAdapter
public class SyncHybridStorageAdapter
extends Object
implements IStorageAdapter, IBlobStoreStorageAdapter
- Since:
- 11.0.1
- Author:
- yaeln
-
Constructor Summary
ConstructorsConstructorDescriptionSyncHybridStorageAdapter(CacheManager cacheManager, IStorageAdapter syncSA, IStorageAdapter blobStoreSA) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIndexes(String typeName, SpaceIndex[] indexes) voidcommit(ServerTransaction xtn, boolean anyUpdates) Performs commit to transaction- delete taken entries, commit new entries.intcount(ITemplateHolder template, String[] subClasses) Returns the number of entries that match the template.getBlobStoreStorageAdapterClassInfo(String typeName) Class<?>getEntries(Context context, Object[] ids, String typeName, IEntryHolder[] templates) Gets a map of entries from the storage adaptergetEntry(Context context, String uid, String classname, IEntryHolder template) Gets an entry object from the storage adapter.booleanvoidInitializes the SA for work (first API called by engine)initialLoad(Context context, ITemplateHolder template, InitialLoadInfo initialLoadInfo) voidinsertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) Inserts a new entry to the SA storage.voidintroduceDataType(ITypeDesc typeDesc) booleanIf returns true - then the storage adapter is read-only and can't be written to.makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subClasses) Returns an iterator with entries that match the template, and the other parameters.voidprepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> pLocked, boolean singleParticipant, Map<String, Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) Performs prepare to transaction- write to SA all new entries under the xtn, mark taken entries under the xtnvoidremoveEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) Removes an entry from the SA storage.voidrollback(ServerTransaction xtn, boolean anyUpdates) Performs rollback to transaction- rewrite taken entries, remove new entries.booleanvoidshutDown()called by the engine after all connections have been closed.booleanbooleanDenotes whether the implementing class has an implementation for {@ #getEntries(Object[], String, IEntryHolder[])}booleanvoidupdateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) updates an entry.
-
Constructor Details
-
SyncHybridStorageAdapter
public SyncHybridStorageAdapter(CacheManager cacheManager, IStorageAdapter syncSA, IStorageAdapter blobStoreSA)
-
-
Method Details
-
getBlobStoreStorageAdapterClassInfo
- Specified by:
getBlobStoreStorageAdapterClassInfoin interfaceIBlobStoreStorageAdapter
-
hasAnotherInitialLoadSource
public boolean hasAnotherInitialLoadSource()- Specified by:
hasAnotherInitialLoadSourcein interfaceIBlobStoreStorageAdapter
-
initialize
Description copied from interface:IStorageAdapterInitializes the SA for work (first API called by engine) If initMode is WARM : SA is required to set its internal working tables and environment to the state recorded in its persistent storage, and verify that all the SA space-related data is in consistent state. If initMode is COLD : SA is required to clean its internal state.- Specified by:
initializein interfaceIStorageAdapter- Throws:
SAException- - In case a SQL error occurred.
-
initialLoad
public ISAdapterIterator initialLoad(Context context, ITemplateHolder template, InitialLoadInfo initialLoadInfo) throws SAException - Specified by:
initialLoadin interfaceIStorageAdapter- Throws:
SAException
-
insertEntry
public void insertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) throws SAException Description copied from interface:IStorageAdapterInserts a new entry to the SA storage.- Specified by:
insertEntryin interfaceIStorageAdapterentryHolder- entry to insert- Throws:
SAException
-
updateEntry
public void updateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) throws SAException Description copied from interface:IStorageAdapterupdates an entry.- Specified by:
updateEntryin interfaceIStorageAdapterupdatedEntry- new content, same UID and class- Throws:
SAException
-
removeEntry
public void removeEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) throws SAException Description copied from interface:IStorageAdapterRemoves an entry from the SA storage.- Specified by:
removeEntryin interfaceIStorageAdapterentryHolder- entry to remove- Throws:
SAException
-
prepare
public void prepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> pLocked, boolean singleParticipant, Map<String, Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) throws SAExceptionDescription copied from interface:IStorageAdapterPerforms prepare to transaction- write to SA all new entries under the xtn, mark taken entries under the xtn- Specified by:
preparein interfaceIStorageAdapterxtn- transaction to preparepLocked- a vector of all entries locked (written or taken) under the xtnsingleParticipant- - if true, a transactional SA needs to do all the transaction related operations in one DB transaction and the prepare is actually the commit (no other transaction related APIs will be called for this xtn)- Throws:
SAException
-
rollback
Description copied from interface:IStorageAdapterPerforms rollback to transaction- rewrite taken entries, remove new entries.- Specified by:
rollbackin interfaceIStorageAdapter- Parameters:
xtn- transaction to roll-backanyUpdates- true if any updates performed under tjis xtn- Throws:
SAException
-
getEntry
public IEntryHolder getEntry(Context context, String uid, String classname, IEntryHolder template) throws SAException Description copied from interface:IStorageAdapterGets an entry object from the storage adapter.- Specified by:
getEntryin interfaceIStorageAdapteruid- ID of the entry to getclassname- class of the entry to gettemplate- selection template,may be null, currently used by cacheload/cachestore in order to pass primery key fields when GS uid is not saved in an external DB- Returns:
- IEntryHolder
- Throws:
SAException
-
getEntries
public Map<String,IEntryHolder> getEntries(Context context, Object[] ids, String typeName, IEntryHolder[] templates) throws SAException Description copied from interface:IStorageAdapterGets a map of entries from the storage adapter- Specified by:
getEntriesin interfaceIStorageAdapterids- the ids of the entries to gettypeName- type of the entries to gettemplates- templates matching the ids of the entries to get- Returns:
- A map between entries uid and the entry holder returning null from this method implies this operation is not supported by the underlying storage mechanism and other methods for obtaining these entries should be applied.
- Throws:
SAException
-
makeEntriesIter
public ISAdapterIterator<IEntryHolder> makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subClasses) throws SAException Description copied from interface:IStorageAdapterReturns an iterator with entries that match the template, and the other parameters.- Specified by:
makeEntriesIterin interfaceIStorageAdapter- Parameters:
template- - the entries should match that template.SCNFilter- - if != 0 gets only templates that are <= from SCNFilter.leaseFilter- if != 0 gets only templates that have expiration_time >= leaseFilter.subClasses- - array of sub classes of the template, the entries should belong to a subcalss.- Returns:
- ISadapterIterator
- Throws:
SAException
-
commit
Description copied from interface:IStorageAdapterPerforms commit to transaction- delete taken entries, commit new entries.- Specified by:
commitin interfaceIStorageAdapter- Parameters:
xtn- transaction to commitanyUpdates- true if any updates performed under tjis xtn- Throws:
SAException
-
count
Description copied from interface:IStorageAdapterReturns the number of entries that match the template.- Specified by:
countin interfaceIStorageAdapter- Parameters:
template- - the entries should match the template.subClasses- - subclassesof the template, the entries can be in one of them.- Returns:
- int - number of entries that match the parameters.
- Throws:
SAException
-
shutDown
Description copied from interface:IStorageAdaptercalled by the engine after all connections have been closed. if the ShotDownString property is set- the string is executed by the SA- Specified by:
shutDownin interfaceIStorageAdapter- Throws:
SAException
-
isReadOnly
public boolean isReadOnly()Description copied from interface:IStorageAdapterIf returns true - then the storage adapter is read-only and can't be written to.- Specified by:
isReadOnlyin interfaceIStorageAdapter
-
supportsExternalDB
public boolean supportsExternalDB()- Specified by:
supportsExternalDBin interfaceIStorageAdapter
-
supportsPartialUpdate
public boolean supportsPartialUpdate()- Specified by:
supportsPartialUpdatein interfaceIStorageAdapter
-
supportsGetEntries
public boolean supportsGetEntries()Description copied from interface:IStorageAdapterDenotes whether the implementing class has an implementation for {@ #getEntries(Object[], String, IEntryHolder[])}- Specified by:
supportsGetEntriesin interfaceIStorageAdapter
-
introduceDataType
- Specified by:
introduceDataTypein interfaceIStorageAdapter
-
getSynchronizationInterceptor
- Specified by:
getSynchronizationInterceptorin interfaceIStorageAdapter
-
getDataClass
- Specified by:
getDataClassin interfaceIStorageAdapter
-
addIndexes
- Specified by:
addIndexesin interfaceIStorageAdapter
-
shouldRevertOpOnBlobStoreError
public boolean shouldRevertOpOnBlobStoreError()- Specified by:
shouldRevertOpOnBlobStoreErrorin interfaceIBlobStoreStorageAdapter
-