com.neeve.ods
Interface IStorePersister

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

public interface IStorePersister
extends IStoreJournallingPersister

Represents a store persister.

This interface defines a store persister. Store persisters are used to persist store contents to a durable backing store.

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.Type
          Enumerates the persister type
 
Nested classes/interfaces inherited from interface com.neeve.ods.IStoreJournallingPersister
IStoreJournallingPersister.LogEmptinessExpectation, IStoreJournallingPersister.LogPresenceExpectation, IStoreJournallingPersister.StartupExpectation
 
Nested classes/interfaces inherited from interface com.neeve.ods.IStoreJournallingWriter
IStoreJournallingWriter.JournallingParameters, IStoreJournallingWriter.LogCounters
 
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.
 IStorePersister.ErrorHandler getErrorHandler()
          Get a persister's error handler.
 String getName()
          Get the name of a persister.
 IStorePersisterStats getStats()
          Gets a persister's stats.
 IStorePersister.Type getType()
          Get the persister type.
 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(IStoreJournallingPersister.StartupExpectation expectation, Enum<?> value)
          Set a startup expectation
 
Methods inherited from interface com.neeve.ods.IStoreJournallingPersister
wasRepaired
 
Methods inherited from interface com.neeve.ods.IStoreJournallingWriter
getJournallingParameters
 
Methods inherited from interface com.neeve.ods.IStoreWriter
commit, isShared, onRoleChange, recordPersisterMetadata, recordPut, recordRemove, recordSend, recordUpdate, sync
 
Methods inherited from interface com.neeve.ods.IStoreReader
read, readMetadata
 

Method Detail

getName

String getName()
Get the name of a persister.


getType

IStorePersister.Type getType()
Get the persister type.


setStartupExpectation

void setStartupExpectation(IStoreJournallingPersister.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

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 © 2015 Neeve Research, LLC. All Rights Reserved.