com.neeve.ods
Interface IStorePersister

All Superinterfaces:
IStoreReader, IStoreWriter
All Known Implementing Classes:
RogLog

public interface IStorePersister
extends IStoreWriter, IStoreReader

Represents a store persister.

This interface defines a store persister. Store persisters are used to persist store events to a persistent transaction log.

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

Nested Class Summary
static interface IStorePersister.ErrorHandler
          Callback interface to report persistence errors
static class IStorePersister.LogEmptinessExpectation
          Enumerates the set of values permissible with the log emptiness expectation
static class IStorePersister.LogPresenceExpectation
          Enumerates the set of values permissible with the log presence expectation
static class IStorePersister.StartupExpectation
          Enumerates the set of supported startup expectations.
 
Nested classes/interfaces inherited from interface com.neeve.ods.IStoreWriter
IStoreWriter.LogCounters, IStoreWriter.Parameters
 
Nested classes/interfaces inherited from interface com.neeve.ods.IStoreReader
IStoreReader.ReadCallback
 
Method Summary
 void close()
          Close a persister.
 void fail()
          Force fail the persister.
 void fail(Exception cause)
          Force fail a persister.
 StorePersisterDescriptor getDescriptor()
          Get a persister's descriptor.
 IStorePersister.ErrorHandler getErrorHandler()
          Get a persister's error handler.
 String getName()
          Get the name of a persister.
 IStorePersisterStats getStats()
          Gets a persister's stats.
 boolean isOpen()
          Get whether the persister is opened
 void open()
          Open a persister.
 void open(PktBuffer serializedMetadata, boolean truncateLive)
          Open a persister with provided metadata.
 void setErrorHandler(IStorePersister.ErrorHandler errorHandler)
          Set a persister's error handler.
 void setStartupExpectation(IStorePersister.StartupExpectation expectation, Enum<?> value)
          Set a startup expectation
 boolean wasRepaired()
          Indicates whether the transaction log was repaired during open.
 
Methods inherited from interface com.neeve.ods.IStoreWriter
getParameters, isShared, onRoleChange, sync, writeCommitEntry
 
Methods inherited from interface com.neeve.ods.IStoreReader
read, read, readMetadata
 

Method Detail

getName

String getName()
Get the name of a persister.


getDescriptor

StorePersisterDescriptor getDescriptor()
Get a persister's descriptor.


setStartupExpectation

void setStartupExpectation(IStorePersister.StartupExpectation expectation,
                           Enum<?> value)
Set a startup expectation


open

void open(PktBuffer serializedMetadata,
          boolean truncateLive)
          throws Exception
Open a persister with provided metadata.

Parameters:
serializedMetadata - Serialized form of the metadata to use for the log being opened. A value of null indicates that the existing metadata be used for the log and, if any metadata does not exist, then start with a fresh metadata object
truncateLive - If true, then the live log file is truncated during open. If metadata is supplied to this method, then the live log is determined from that metadata.
Throws:
Exception

open

void open()
          throws Exception
Open a persister.

Invoking this method is equivalent to invoking open(null, false)

Throws:
Exception

isOpen

boolean isOpen()
               throws Exception
Get whether the persister is opened

Throws:
Exception

wasRepaired

boolean wasRepaired()
Indicates whether the transaction log was repaired during open.

This method can only be invoked on an open persister.


setErrorHandler

void setErrorHandler(IStorePersister.ErrorHandler errorHandler)
Set a persister's error handler.


getErrorHandler

IStorePersister.ErrorHandler getErrorHandler()
Get a persister's error handler.


getStats

IStorePersisterStats getStats()
Gets a persister's stats.


fail

void fail(Exception cause)
Force fail a persister.

Parameters:
cause - The cause of the failure.

CAUTION: This method is only for testing purposes and should not be invoked outside of test frameworks.

This method invokes the error handler if installed and marks the persister has failed. This will cause all subsequent commits or syncs to immediately fail with a runtime exception.


fail

void fail()
Force fail the persister.

This method invokes the following:

  fail(new OdsException("force failed by user"))


close

void close()
Close a persister.

This method implcitly syncs and closes the persister.



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