com.neeve.ods
Interface IStoreWriter

All Known Subinterfaces:
IStoreJournallingPersister, IStoreJournallingWriter, IStorePersister, IStoreSender
All Known Implementing Classes:
RogLog, com.neeve.ods.impl.StorePacketJournaller

public interface IStoreWriter

Represents a store writer.

This interface defines a store writer. Store writers durably write store objects and/or transactions to an abstract destination.

Threading:
A writer is not safe for concurrent access by multiple threads.

Method Summary
 void commit(boolean sync)
          Commit the set of recorded operations.
 boolean isShared()
          Indicates whether the writer is writing to a shared resource.
 void onRoleChange(IStoreBinding.Role role)
          Invoked to notify of a change to the role of the using store binding.
 void recordPersisterMetadata(PktBuffer buffer)
          Record a persister metadata This method is invoked by a store binding to record the persister's metadata.
 IStoreCommitQueue.IEntry recordPut(com.eaio.uuid.UUID id, short ofid, short otype, IStoreObject object, PktPacket serializedObject, IStoreObject.EncodingType contentEncodingType, PktBuffer serializedMetadata)
          Record a put operation.
 IStoreCommitQueue.IEntry recordRemove(com.eaio.uuid.UUID id, short ofid, short otype, IStoreObject object, PktBuffer serializedMetadata, long transactionId, long stableTransactionId, long checkpointVersion)
          Record a remove operation.
 IStoreCommitQueue.IEntry recordSend(com.eaio.uuid.UUID id, short ofid, short otype, IStoreObject object, PktPacket serializedObject, IStoreObject.EncodingType contentEncodingType, PktBuffer serializedMetadata)
          Record a send operation Note: The IStoreWriter will assume ownership of the serialized object and call PktPacket.dispose() once it is done writing the object during commit.
 IStoreCommitQueue.IEntry recordUpdate(com.eaio.uuid.UUID id, short ofid, short otype, IStoreObject object, PktPacket serializedObject, IStoreObject.EncodingType contentEncodingType, PktBuffer serializedMetadata)
          Record an update operation.
 void sync()
          Sync any buffered operations to the write destination.
 

Method Detail

isShared

boolean isShared()
Indicates whether the writer is writing to a shared resource.

This method returns whether the writer is accessing a shared resource between primary and backup cluster members. Shared writers are only opened on the primary cluster members while non-shared writers are opened concurrently on both. However, transactions are recorded and committed concurrently on both shared and non-shared writers.


onRoleChange

void onRoleChange(IStoreBinding.Role role)
Invoked to notify of a change to the role of the using store binding.

This method is invoked by a store binding to notify a writer of a a change in the binding's role.


recordPersisterMetadata

void recordPersisterMetadata(PktBuffer buffer)
Record a persister metadata

This method is invoked by a store binding to record the persister's metadata. The method is invoked by the primary and backup store binding during store commit.

Note: The IStoreWriter will must copy the metadata in the supplied buffer object before returning from this method.

Parameters:
buffer - The buffer containing the serialized metadata
Threading:
This method is not safe for concurrent access with itself or any other methods in this class

recordPut

IStoreCommitQueue.IEntry recordPut(com.eaio.uuid.UUID id,
                                   short ofid,
                                   short otype,
                                   IStoreObject object,
                                   PktPacket serializedObject,
                                   IStoreObject.EncodingType contentEncodingType,
                                   PktBuffer serializedMetadata)
Record a put operation.

This method is invoked by a store binding to record a put commit operation. The method is invoked by the primary and backup store binding during store commit.

Note: The IStoreWriter will assume ownership of the serialized object and call PktPacket.dispose() once it is done writing the object during commit. If the caller to hold on to the PktPacket it should call PktPacket.acquire() prior to calling this method.

Parameters:
id - The id of the put object.
ofid - The id of the object's factory.
otype - The put object's type
object - The put object
serializedObject - The serialized form of the put object.
contentEncodingType - The object's content encoding type.
serializedMetadata - The serialized form of the put object's metadata.
Threading:
This method is not safe for concurrent access with itself or any other methods in this class

recordUpdate

IStoreCommitQueue.IEntry recordUpdate(com.eaio.uuid.UUID id,
                                      short ofid,
                                      short otype,
                                      IStoreObject object,
                                      PktPacket serializedObject,
                                      IStoreObject.EncodingType contentEncodingType,
                                      PktBuffer serializedMetadata)
Record an update operation.

Note: The IStoreWriter will assume ownership of the serialized object and call PktPacket.dispose() once it is done writing the object during commit. If the caller to hold on to the PktPacket it should call PktPacket.acquire() prior to calling this method.

Parameters:
id - The id of the updated object.
ofid - The id of the object's factory.
otype - The updated object's type
object - The updated object.
serializedObject - The serialized form of the updated object.
contentEncodingType - The object's content encoding type.
serializedMetadata - The serialized form of the updated object's metadata.
Returns:
Returns the added queue entry.
Threading:
This method is not safe for concurrent access by multiple threads.

recordSend

IStoreCommitQueue.IEntry recordSend(com.eaio.uuid.UUID id,
                                    short ofid,
                                    short otype,
                                    IStoreObject object,
                                    PktPacket serializedObject,
                                    IStoreObject.EncodingType contentEncodingType,
                                    PktBuffer serializedMetadata)
Record a send operation

Note: The IStoreWriter will assume ownership of the serialized object and call PktPacket.dispose() once it is done writing the object during commit. If the caller to hold on to the PktPacket it should call PktPacket.acquire() prior to calling this method.

Parameters:
id - The id of the sent object.
ofid - The id of the object's factory.
otype - The sent object's type
object - The sent object.
serializedObject - The serialized form of the sent object.
contentEncodingType - The object's content encoding type.
serializedMetadata - The serialized form of the sent object's metadata.
Returns:
Returns the added queue entry.
Threading:
This method is not safe for concurrent access by multiple threads.

recordRemove

IStoreCommitQueue.IEntry recordRemove(com.eaio.uuid.UUID id,
                                      short ofid,
                                      short otype,
                                      IStoreObject object,
                                      PktBuffer serializedMetadata,
                                      long transactionId,
                                      long stableTransactionId,
                                      long checkpointVersion)
Record a remove operation.

Parameters:
id - The id of the removed object.
ofid - The id of the object's factory.
otype - The removed object's type
object - The removed object.
serializedMetadata - The serialized form of the sent object's metadata.
transactionId - The transaction id.
stableTransactionId - The stable transactionId.
checkpointVersion - The checkpoint version.
Returns:
Returns the added queue entry.
Threading:
This method is not safe for concurrent access by multiple threads.

commit

void commit(boolean sync)
Commit the set of recorded operations.

Parameters:
sync - Indicates whether the commit should cause the recorded operations to be persisted and sync'd to the writer destination before the method returns. See sync() for a description of what 'sync' implies.
Threading:
This method is not safe for concurrent access with itself or any other methods in this class

This method is invoked by a store binding to commit the recorded operations. The method is invoked on a primary store binding when upon completion of the commit operation.


sync

void sync()
Sync any buffered operations to the write destination.

This operation should cause any buffered operations to be flushed to the writer destination. This method must block and wait until all recorded operations invoked prior to this method are safely at the destination.

No record operations will be invoked concurrently with this method.



Copyright © 2015 Neeve Research, LLC. All Rights Reserved.