public class ChainReplicationProtocol extends AbstractReplicationProtocol
holeFillPolicy
Constructor and Description |
---|
ChainReplicationProtocol(IHoleFillPolicy holeFillPolicy) |
Modifier and Type | Method and Description |
---|---|
protected void |
holeFill(RuntimeLayout runtimeLayout,
long globalAddress)
Write a special hole filling entry using the
given address.
|
ILogData |
peek(RuntimeLayout runtimeLayout,
long globalAddress)
Peek data from a given address.
|
Map<Long,ILogData> |
readAll(RuntimeLayout runtimeLayout,
List<Long> addresses,
boolean waitForWrite)
Reads a list of global addresses from the chain of log unit servers.
|
void |
write(RuntimeLayout runtimeLayout,
ILogData data)
Write data to the log at the given address.
|
read
public ChainReplicationProtocol(IHoleFillPolicy holeFillPolicy)
public void write(RuntimeLayout runtimeLayout, ILogData data) throws OverwriteException
This function blocks until -a- write at the global address is committed to the log.
If the write which is committed to the log was this write, the function returns normally.
If the write which was committed to the log was not the result of this call, an OverwriteException is thrown.
runtimeLayout
- the RuntimeLayout stamped with layout to use for the write.data
- the ILogData to write to the log.OverwriteException
- If a write was committed to the log and
it was not the result of this call.public ILogData peek(RuntimeLayout runtimeLayout, long globalAddress)
This function -may- return null if there was no entry committed at the given global address, otherwise it returns committed data at the given global address. It does not attempt to hole fill if there was no entry.
runtimeLayout
- the RuntimeLayout stamped with layout to use for the peek.globalAddress
- the global address to peek from.@Nonnull public Map<Long,ILogData> readAll(RuntimeLayout runtimeLayout, List<Long> addresses, boolean waitForWrite)
runtimeLayout
- runtime layout.addresses
- list of addresses to read.waitForWrite
- flag whether wait for write is required or hole fill directly.protected void holeFill(RuntimeLayout runtimeLayout, long globalAddress)
holeFill
in class AbstractReplicationProtocol
globalAddress
- The address to hole fill.Copyright © 2019 CorfuDB. All rights reserved.