public class MemorySA extends Object implements IStorageAdapter
IStorageAdapter
interface.
The entries/templates are stored in the cache-managerConstructor 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,
String 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,
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 |
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
IStorageAdapter
initialize
in interface IStorageAdapter
SAException
- - In case a SQL error occurred.public void insertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) throws SAException
insertEntry
in interface IStorageAdapter
entryHolder
- entry to insertSAException
public void updateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) throws SAException
updateEntry
in interface IStorageAdapter
updatedEntry
- new content, same UID and classSAException
public IEntryHolder getEntry(Context context, String uid, String classname, IEntryHolder template) throws SAException
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 void removeEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) throws SAException
removeEntry
in interface IStorageAdapter
entryHolder
- entry to removeSAException
public ISAdapterIterator makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subClasses) throws SAException
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 prepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> locked_entries, boolean singleParticipant, Map<String,Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) throws SAException
prepare
in interface IStorageAdapter
xtn
- 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)SAException
public void commit(ServerTransaction xtn, boolean anyUpdates) throws SAException
commit
in interface IStorageAdapter
xtn
- transaction to commitanyUpdates
- true if any updates performed under tjis xtnSAException
public void rollback(ServerTransaction xtn, boolean anyUpdates) throws SAException
rollback
in interface IStorageAdapter
xtn
- transaction to roll-backanyUpdates
- true if any updates performed under tjis xtnSAException
public int count(ITemplateHolder template, String[] subClasses) throws SAException
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
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 ISAdapterIterator initialLoad(Context context, ITemplateHolder template, InitialLoadInfo initialLoadInfo) throws SAException
initialLoad
in interface IStorageAdapter
SAException
public void introduceDataType(ITypeDesc typeDesc)
introduceDataType
in interface IStorageAdapter
public void addIndexes(String typeName, SpaceIndex[] indexes)
addIndexes
in interface IStorageAdapter
public SpaceSynchronizationEndpoint getSynchronizationInterceptor()
getSynchronizationInterceptor
in interface IStorageAdapter
public Class<?> getDataClass()
getDataClass
in interface IStorageAdapter
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 boolean supportsGetEntries()
IStorageAdapter
supportsGetEntries
in interface IStorageAdapter
Copyright © GigaSpaces.