Interface IStorageAdapter

All Known Implementing Classes:
BlobStoreStorageAdapter, MemorySA, SynchronizationStorageAdapter, SyncHybridStorageAdapter, TieredStorageSA

public interface IStorageAdapter
IStorageAdapter is an interface that should be implemented by the Storage adapter. The IStorageAdapter interface contains methods for storing and retrieving entries and notify templates and to provide storage services to the engine .

All IStorageAdapter methods ( except init ) gets StorageAdapterContext object as the first parameter, which holds the connection information to the storage-adapter.

  • Method Details

    • initialize

      void initialize() throws SAException
      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.

      If initMode is COLD : SA is required to clean its internal state.

      Throws:
      SAException - - In case a SQL error occurred.
    • initialLoad

      ISAdapterIterator initialLoad(Context context, ITemplateHolder template, InitialLoadInfo initialLoadInfo) throws SAException
      Throws:
      SAException
    • insertEntry

      void insertEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean shouldReplicate) throws SAException
      Inserts a new entry to the SA storage.
      Parameters:
      entryHolder - entry to insert
      Throws:
      SAException
    • updateEntry

      void updateEntry(Context context, IEntryHolder updatedEntry, boolean updateRedoLog, boolean origin, boolean[] partialUpdateValuesIndicators) throws SAException
      updates an entry.

      Parameters:
      updatedEntry - new content, same UID and class
      Throws:
      SAException
    • removeEntry

      void removeEntry(Context context, IEntryHolder entryHolder, boolean origin, boolean fromLeaseExpiration, boolean shouldReplicate) throws SAException
      Removes an entry from the SA storage.

      Parameters:
      entryHolder - entry to remove
      Throws:
      SAException
    • prepare

      void prepare(Context context, ServerTransaction xtn, ArrayList<IEntryHolder> pLocked, boolean singleParticipant, Map<String,Object> partialUpdatesAndInPlaceUpdatesInfo, boolean shouldReplicate) throws SAException
      Performs prepare to transaction- write to SA all new entries under the xtn, mark taken entries under the xtn
      Parameters:
      xtn - transaction to prepare
      pLocked - a vector of all entries locked (written or taken) under the xtn
      singleParticipant - - 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

      void rollback(ServerTransaction xtn, boolean anyUpdates) throws SAException
      Performs rollback to transaction- rewrite taken entries, remove new entries.
      Parameters:
      xtn - transaction to roll-back
      anyUpdates - true if any updates performed under tjis xtn
      Throws:
      SAException
    • getEntry

      IEntryHolder getEntry(Context context, String uid, String classname, IEntryHolder template) throws SAException
      Gets an entry object from the storage adapter.

      Parameters:
      uid - ID of the entry to get
      classname - class of the entry to get
      template - 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

      Map<String,IEntryHolder> getEntries(Context context, Object[] ids, String typeName, IEntryHolder[] templates) throws SAException
      Gets a map of entries from the storage adapter
      Parameters:
      ids - the ids of the entries to get
      typeName - type of the entries to get
      templates - 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

      ISAdapterIterator<IEntryHolder> makeEntriesIter(ITemplateHolder template, long SCNFilter, long leaseFilter, IServerTypeDesc[] subClasses) throws SAException
      Returns an iterator with entries that match the template, and the other parameters.

      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

      void commit(ServerTransaction xtn, boolean anyUpdates) throws SAException
      Performs commit to transaction- delete taken entries, commit new entries.
      Parameters:
      xtn - transaction to commit
      anyUpdates - true if any updates performed under tjis xtn
      Throws:
      SAException
    • count

      int count(ITemplateHolder template, String[] subClasses) throws SAException
      Returns the number of entries that match the template.
      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

      void shutDown() throws SAException
      called by the engine after all connections have been closed. if the ShotDownString property is set- the string is executed by the SA
      Throws:
      SAException
    • isReadOnly

      boolean isReadOnly()
      If returns true - then the storage adapter is read-only and can't be written to.
    • supportsExternalDB

      boolean supportsExternalDB()
    • supportsPartialUpdate

      boolean supportsPartialUpdate()
    • supportsGetEntries

      boolean supportsGetEntries()
      Denotes whether the implementing class has an implementation for {@ #getEntries(Object[], String, IEntryHolder[])}
    • introduceDataType

      void introduceDataType(ITypeDesc typeDesc)
    • getSynchronizationInterceptor

      SpaceSynchronizationEndpoint getSynchronizationInterceptor()
    • getDataClass

      Class<?> getDataClass()
    • addIndexes

      void addIndexes(String typeName, SpaceIndex[] indexes) throws SAException
      Throws:
      SAException