public class QuorumReplicationProtocol extends AbstractReplicationProtocol
holeFillPolicy
Constructor and Description |
---|
QuorumReplicationProtocol(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 address)
Peek data from a given address.
|
Map<Long,ILogData> |
readAll(RuntimeLayout runtimeLayout,
List<Long> addresses,
boolean waitForWrite)
Read data from all the given addresses.
|
void |
write(RuntimeLayout runtimeLayout,
ILogData data)
Write data to the log at the given address.
|
read
public QuorumReplicationProtocol(IHoleFillPolicy holeFillPolicy)
public ILogData peek(RuntimeLayout runtimeLayout, long address)
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.address
- the global address to peek from.@Nonnull public Map<Long,ILogData> readAll(RuntimeLayout runtimeLayout, List<Long> addresses, boolean waitForWrite)
This method functions exactly like a read, except that it returns the result for multiple addresses.
An implementation may optimize for this type of bulk request, but the default implementation just performs multiple reads (possible in parallel).
runtimeLayout
- the RuntimeLayout stamped with layout to use for the read.addresses
- a list of addresses to read from.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.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.Copyright © 2019 CorfuDB. All rights reserved.