public class MemorySA extends Object implements IStorageAdapter
IStorageAdapter interface.
The entries/templates are stored in the cache-manager| Constructor and Description |
|---|
MemorySA() |
| 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.
|
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,
Object uid,
String classname,
IEntryHolder template)
Gets an entry object from the storage adapter.
|
SpaceSynchronizationEndpoint |
getSynchronizationInterceptor() |
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) |
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 |
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> locked_entries,
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.
|
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 void initialize()
throws SAException
IStorageAdapterinitialize in interface IStorageAdapterSAException - - In case a SQL error occurred.public void insertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) throws SAException
insertEntry in interface IStorageAdapterentryHolder - entry to insertSAExceptionpublic void updateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) throws SAException
updateEntry in interface IStorageAdapterupdatedEntry - new content, same UID and classSAExceptionpublic IEntryHolder getEntry(Context context, Object uid, String classname, IEntryHolder template) throws SAException
getEntry in interface IStorageAdapteruid - 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 DBSAExceptionpublic void removeEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) throws SAException
removeEntry in interface IStorageAdapterentryHolder - entry to removeSAExceptionpublic ISAdapterIterator makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subClasses) throws SAException
makeEntriesIter in interface IStorageAdaptertemplate - - 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.SAExceptionpublic void prepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> locked_entries, boolean singleParticipant, Map<String,Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) throws SAException
prepare in interface IStorageAdapterxtn - transaction to preparelocked_entries - 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)SAExceptionpublic void commit(ServerTransaction xtn, boolean anyUpdates) throws SAException
commit in interface IStorageAdapterxtn - transaction to commitanyUpdates - true if any updates performed under tjis xtnSAExceptionpublic void rollback(ServerTransaction xtn, boolean anyUpdates) throws SAException
rollback in interface IStorageAdapterxtn - transaction to roll-backanyUpdates - true if any updates performed under tjis xtnSAExceptionpublic int count(ITemplateHolder template, String[] subClasses) throws SAException
count in interface IStorageAdaptertemplate - - the entries should match the template.subClasses - - subclassesof the template, the entries can be in one of them.SAExceptionpublic void shutDown()
throws SAException
shutDown in interface IStorageAdapterSAExceptionpublic boolean isReadOnly()
IStorageAdapterisReadOnly in interface IStorageAdapterpublic boolean supportsExternalDB()
supportsExternalDB in interface IStorageAdapterpublic boolean supportsPartialUpdate()
supportsPartialUpdate in interface IStorageAdapterpublic ISAdapterIterator initialLoad(Context context, ITemplateHolder template) throws SAException
initialLoad in interface IStorageAdapterSAExceptionpublic void introduceDataType(ITypeDesc typeDesc)
introduceDataType in interface IStorageAdapterpublic void addIndexes(String typeName, SpaceIndex[] indexes)
addIndexes in interface IStorageAdapterpublic SpaceSynchronizationEndpoint getSynchronizationInterceptor()
getSynchronizationInterceptor in interface IStorageAdapterpublic Class<?> getDataClass()
getDataClass in interface IStorageAdapterpublic Map<String,IEntryHolder> getEntries(Context context, Object[] ids, String typeName, IEntryHolder[] templates) throws SAException
IStorageAdaptergetEntries in interface IStorageAdapterids - the ids of the entries to gettypeName - type of the entries to gettemplates - templates matching the ids of the entries to getSAExceptionpublic boolean supportsGetEntries()
IStorageAdaptersupportsGetEntries in interface IStorageAdapterCopyright © GigaSpaces.