public interface IStorePersister extends IStoreWriter, IStoreReader
This interface defines a store persister. Store persisters are used to persist store events to a persistent transaction log.
Modifier and Type | Interface and Description |
---|---|
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.
|
IStoreWriter.LogCounters, IStoreWriter.Parameters
IStoreReader.IterativeReader, IStoreReader.ReadCallback
Modifier and Type | Method and Description |
---|---|
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.
|
IEventHandler |
getEventHandler()
Get a persister's event 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(boolean concurrentReadWrite)
Open a persister.
|
void |
open(PktBuffer serializedMetadata,
boolean truncateLive)
Open a persister with provided metadata.
|
void |
open(PktBuffer serializedMetadata,
boolean truncateLive,
boolean concurrentReadWrite)
Open a persister with provided metadata.
|
void |
setErrorHandler(IStorePersister.ErrorHandler errorHandler)
Set a persister's error handler.
|
void |
setEventHandler(IEventHandler eventHandler)
Set a persister's event handler.
|
void |
setStartupExpectation(IStorePersister.StartupExpectation expectation,
Enum<?> value)
Set a startup expectation
|
boolean |
wasRepaired()
Indicates whether the transaction log was repaired during open.
|
getParameters, isShared, onRoleChange, sync, writeCommitEntry
iterativeReader, read, read, readMetadata
String getName()
StorePersisterDescriptor getDescriptor()
void setStartupExpectation(IStorePersister.StartupExpectation expectation, Enum<?> value)
void open(PktBuffer serializedMetadata, boolean truncateLive, boolean concurrentReadWrite) throws Exception
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 objecttruncateLive
- 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.concurrentReadWrite
- If true, the log is opened in a manner
that permits for concurrent read/write to occur on the log.Exception
void open(PktBuffer serializedMetadata, boolean truncateLive) throws Exception
Invoking this method is equivalent to invoking open(serializedMetadata, truncateLive, false)
Exception
void open(boolean concurrentReadWrite) throws Exception
concurrentReadWrite
- If true, the log is opened in a manner
that permits for concurrent read/write to occur on the log.
Invoking this method is equivalent to invoking open(null, false, concurrentReadWrite)
Exception
void open() throws Exception
Invoking this method is equivalent to invoking open(false)
Exception
boolean wasRepaired()
This method can only be invoked on an open persister.
void setErrorHandler(IStorePersister.ErrorHandler errorHandler)
IStorePersister.ErrorHandler getErrorHandler()
void setEventHandler(IEventHandler eventHandler)
eventHandler
- The event handler for the persister.IEventHandler getEventHandler()
IStorePersisterStats getStats()
void fail(Exception cause)
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.
void fail()
This method invokes the following:
fail(new OdsException("force failed by user"))
void close()
This method implcitly syncs and closes the persister.
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.