public class SyncHybridStorageAdapter extends Object implements IStorageAdapter, IBlobStoreStorageAdapter
Constructor and Description |
---|
SyncHybridStorageAdapter(CacheManager cacheManager,
IStorageAdapter syncSA,
IStorageAdapter blobStoreSA) |
Modifier and Type | Method and Description |
---|---|
void |
addIndexes(String typeName,
SpaceIndex[] indexes) |
void |
commit(ServerTransaction xtn,
boolean anyUpdates)
Performs commit to transaction- delete taken entries, commit new entries.
|
int |
count(ITemplateHolder template,
String[] subClasses)
Returns the number of entries that match the template.
|
BlobStoreStorageAdapterClassInfo |
getBlobStoreStorageAdapterClassInfo(String typeName) |
Class<?> |
getDataClass() |
Map<String,IEntryHolder> |
getEntries(Context context,
Object[] ids,
String typeName,
IEntryHolder[] templates)
Gets a map of entries from the storage adapter
|
IEntryHolder |
getEntry(Context context,
String uid,
String classname,
IEntryHolder template)
Gets an entry object from the storage adapter.
|
SpaceSynchronizationEndpoint |
getSynchronizationInterceptor() |
boolean |
hasAnotherInitialLoadSource() |
void |
initialize()
Initializes 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.
|
ISAdapterIterator |
initialLoad(Context context,
ITemplateHolder template,
InitialLoadInfo initialLoadInfo) |
void |
insertEntry(Context context,
IEntryHolder entryHolder,
boolean origin,
boolean shouldReplicate)
Inserts a new entry to the SA storage.
|
void |
introduceDataType(ITypeDesc typeDesc) |
boolean |
isReadOnly()
If returns true - then the storage adapter is read-only and can't be written to.
|
ISAdapterIterator<IEntryHolder> |
makeEntriesIter(ITemplateHolder template,
long SCNFilter,
long leaseFilter,
IServerTypeDesc[] subClasses)
Returns an iterator with entries that match the template, and the other parameters.
|
void |
prepare(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 xtn
|
void |
removeEntry(Context context,
IEntryHolder entryHolder,
boolean origin,
boolean fromLeaseExpiration,
boolean shouldReplicate)
Removes an entry from the SA storage.
|
void |
rollback(ServerTransaction xtn,
boolean anyUpdates)
Performs rollback to transaction- rewrite taken entries, remove new entries.
|
boolean |
shouldRevertOpOnBlobStoreError() |
void |
shutDown()
called by the engine after all connections have been closed.
|
boolean |
supportsExternalDB() |
boolean |
supportsGetEntries()
Denotes whether the implementing class has an implementation for
|
boolean |
supportsPartialUpdate() |
void |
updateEntry(Context context,
IEntryHolder updatedEntry,
boolean updateRedoLog,
boolean origin,
boolean[] partialUpdateValuesIndicators)
updates an entry.
|
public SyncHybridStorageAdapter(CacheManager cacheManager, IStorageAdapter syncSA, IStorageAdapter blobStoreSA)
public BlobStoreStorageAdapterClassInfo getBlobStoreStorageAdapterClassInfo(String typeName)
getBlobStoreStorageAdapterClassInfo
in interface IBlobStoreStorageAdapter
public boolean hasAnotherInitialLoadSource()
hasAnotherInitialLoadSource
in interface IBlobStoreStorageAdapter
public void initialize() throws SAException
IStorageAdapter
initialize
in interface IStorageAdapter
SAException
- - In case a SQL error occurred.public ISAdapterIterator initialLoad(Context context, ITemplateHolder template, InitialLoadInfo initialLoadInfo) throws SAException
initialLoad
in interface IStorageAdapter
SAException
public void insertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) throws SAException
IStorageAdapter
insertEntry
in interface IStorageAdapter
entryHolder
- entry to insertSAException
public void updateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) throws SAException
IStorageAdapter
updateEntry
in interface IStorageAdapter
updatedEntry
- new content, same UID and classSAException
public void removeEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) throws SAException
IStorageAdapter
removeEntry
in interface IStorageAdapter
entryHolder
- entry to removeSAException
public void prepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> pLocked, boolean singleParticipant, Map<String,Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) throws SAException
IStorageAdapter
prepare
in interface IStorageAdapter
xtn
- 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)SAException
public void rollback(ServerTransaction xtn, boolean anyUpdates) throws SAException
IStorageAdapter
rollback
in interface IStorageAdapter
xtn
- transaction to roll-backanyUpdates
- true if any updates performed under tjis xtnSAException
public IEntryHolder getEntry(Context context, String uid, String classname, IEntryHolder template) throws SAException
IStorageAdapter
getEntry
in interface IStorageAdapter
uid
- 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 DBSAException
public Map<String,IEntryHolder> getEntries(Context context, Object[] ids, String typeName, IEntryHolder[] templates) throws SAException
IStorageAdapter
getEntries
in interface IStorageAdapter
ids
- the ids of the entries to gettypeName
- type of the entries to gettemplates
- templates matching the ids of the entries to getSAException
public ISAdapterIterator<IEntryHolder> makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subClasses) throws SAException
IStorageAdapter
makeEntriesIter
in interface IStorageAdapter
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.SAException
public void commit(ServerTransaction xtn, boolean anyUpdates) throws SAException
IStorageAdapter
commit
in interface IStorageAdapter
xtn
- transaction to commitanyUpdates
- true if any updates performed under tjis xtnSAException
public int count(ITemplateHolder template, String[] subClasses) throws SAException
IStorageAdapter
count
in interface IStorageAdapter
template
- - the entries should match the template.subClasses
- - subclassesof the template, the entries can be in one of them.SAException
public void shutDown() throws SAException
IStorageAdapter
shutDown
in interface IStorageAdapter
SAException
public boolean isReadOnly()
IStorageAdapter
isReadOnly
in interface IStorageAdapter
public boolean supportsExternalDB()
supportsExternalDB
in interface IStorageAdapter
public boolean supportsPartialUpdate()
supportsPartialUpdate
in interface IStorageAdapter
public boolean supportsGetEntries()
IStorageAdapter
supportsGetEntries
in interface IStorageAdapter
public void introduceDataType(ITypeDesc typeDesc)
introduceDataType
in interface IStorageAdapter
public SpaceSynchronizationEndpoint getSynchronizationInterceptor()
getSynchronizationInterceptor
in interface IStorageAdapter
public Class<?> getDataClass()
getDataClass
in interface IStorageAdapter
public void addIndexes(String typeName, SpaceIndex[] indexes)
addIndexes
in interface IStorageAdapter
public boolean shouldRevertOpOnBlobStoreError()
shouldRevertOpOnBlobStoreError
in interface IBlobStoreStorageAdapter
Copyright © GigaSpaces.