public class NoOpTransactionStateStorage extends com.google.common.util.concurrent.AbstractIdleService implements TransactionStateStorage
TransactionStateStorage
implementation that does nothing, i.e. does not maintain any actual state.Constructor and Description |
---|
NoOpTransactionStateStorage(SnapshotCodecProvider codecProvider) |
Modifier and Type | Method and Description |
---|---|
TransactionLog |
createLog(long timestamp)
Creates a new
TransactionLog . |
void |
deleteLogsOlderThan(long timestamp)
Removes any transaction logs with a timestamp older than the given value.
|
long |
deleteOldSnapshots(int numberToKeep)
Removes any snapshots prior to the
numberToKeep most recent. |
TransactionSnapshot |
getLatestSnapshot()
Returns the most recent snapshot that has been successfully written.
|
TransactionVisibilityState |
getLatestTransactionVisibilityState()
Returns the most recent transaction visibility state that has been successfully written.
|
String |
getLocation()
Returns a string representation of the location used for persistence.
|
List<TransactionLog> |
getLogsSince(long timestamp)
Returns all
TransactionLog s with a timestamp greater than or equal to the given timestamp. |
List<String> |
listLogs()
Returns the (non-qualified) names of available logs.
|
List<String> |
listSnapshots()
Returns the (non-qualified) names of available snapshots.
|
void |
setupStorage()
Create the directories required for the transaction state stage.
|
protected void |
shutDown() |
protected void |
startUp() |
void |
writeSnapshot(OutputStream out,
TransactionSnapshot snapshot)
Persists a snapshot of transaction state to an output stream.
|
void |
writeSnapshot(TransactionSnapshot snapshot)
Persists a snapshot of transaction state.
|
addListener, executor, isRunning, start, startAndWait, state, stop, stopAndWait, toString
@Inject public NoOpTransactionStateStorage(SnapshotCodecProvider codecProvider)
protected void startUp() throws Exception
startUp
in class com.google.common.util.concurrent.AbstractIdleService
Exception
protected void shutDown() throws Exception
shutDown
in class com.google.common.util.concurrent.AbstractIdleService
Exception
public void writeSnapshot(OutputStream out, TransactionSnapshot snapshot) throws IOException
TransactionStateStorage
writeSnapshot
in interface TransactionStateStorage
IOException
public void writeSnapshot(TransactionSnapshot snapshot) throws IOException
TransactionStateStorage
writeSnapshot
in interface TransactionStateStorage
IOException
public TransactionSnapshot getLatestSnapshot() throws IOException
TransactionStateStorage
null
if no completed snapshot files are found.getLatestSnapshot
in interface TransactionStateStorage
IOException
public TransactionVisibilityState getLatestTransactionVisibilityState() throws IOException
TransactionStateStorage
null
if no completed snapshot files are found.getLatestTransactionVisibilityState
in interface TransactionStateStorage
TransactionVisibilityState
IOException
public long deleteOldSnapshots(int numberToKeep) throws IOException
TransactionStateStorage
numberToKeep
most recent.deleteOldSnapshots
in interface TransactionStateStorage
numberToKeep
- The number of most recent snapshots to keep.IOException
- If an error occurs while deleting old snapshots.public List<String> listSnapshots() throws IOException
TransactionStateStorage
listSnapshots
in interface TransactionStateStorage
IOException
public List<TransactionLog> getLogsSince(long timestamp) throws IOException
TransactionStateStorage
TransactionLog
s with a timestamp greater than or equal to the given timestamp. Note that
the returned list is guaranteed to be sorted in ascending timestamp order.getLogsSince
in interface TransactionStateStorage
IOException
public TransactionLog createLog(long timestamp) throws IOException
TransactionStateStorage
TransactionLog
.createLog
in interface TransactionStateStorage
IOException
public void deleteLogsOlderThan(long timestamp) throws IOException
TransactionStateStorage
deleteLogsOlderThan
in interface TransactionStateStorage
timestamp
- The timestamp to delete up to. Logs with a timestamp less than this value will be removed.IOException
- If an error occurs while removing logs.public void setupStorage() throws IOException
TransactionStateStorage
setupStorage
in interface TransactionStateStorage
IOException
- If an error occurred during the creation of required directories for transaction state storage.public List<String> listLogs() throws IOException
TransactionStateStorage
listLogs
in interface TransactionStateStorage
IOException
public String getLocation()
TransactionStateStorage
getLocation
in interface TransactionStateStorage
Copyright © 2016 The Apache Software Foundation. All rights reserved.