gr.uoa.di.madgik.grs.store.event
Interface IEventStore

All Known Implementing Classes:
CacheEventStore, FileEventStore

public interface IEventStore

This interface defines a way a persistency manager can be interfaced to enabling persistency of BufferEvents and retrieval based on the order by which they were stored. The BufferEvent persistency must be handled by the respective BufferEvent.deflate(java.io.DataOutput) operation while the retrieval by the respective BufferEvent.inflate(java.io.DataInput) method. The storage medium over which the BufferEvents are persisted is left to the implementation specifics

Author:
gpapanikos

Method Summary
 void dispose()
          Disposes the IEventStore instance as well as any permanent storage resources occupied
 long getEventCount()
          Retrieves the number of BufferEvents stored using this IEventStore
 void persist(BufferEvent event)
          Persists the provided BufferEvent
 BufferEvent retrieveByIndex(long eventIndex)
          Retrieve a previously stored BufferEvent based on the index by which it was stored
 

Method Detail

getEventCount

long getEventCount()
Retrieves the number of BufferEvents stored using this IEventStore

Returns:
the number of BufferEvents stored

persist

void persist(BufferEvent event)
             throws GRS2EventStoreException
Persists the provided BufferEvent

Parameters:
event - the BufferEvent to persist
Throws:
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed

retrieveByIndex

BufferEvent retrieveByIndex(long eventIndex)
                            throws GRS2EventStoreException
Retrieve a previously stored BufferEvent based on the index by which it was stored

Parameters:
eventIndex - The index by which the BufferEvent to be retrieved was stored
Returns:
the BufferEvent retrieved
Throws:
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed

dispose

void dispose()
             throws GRS2EventStoreException
Disposes the IEventStore instance as well as any permanent storage resources occupied

Throws:
GRS2EventStoreException - the state of the IEventStore does not allow for this operation to be completed