NodeIDType
- public abstract class AbstractTransactor<NodeIDType> extends AbstractReplicaCoordinator<NodeIDType>
app, messenger
Modifier | Constructor and Description |
---|---|
protected |
AbstractTransactor(AbstractReplicaCoordinator<NodeIDType> coordinator) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
checkpoint(java.lang.String name)
Checkpoints the current application state and returns it.
|
boolean |
coordinateRequest(Request request,
ExecutedCallback callback)
Start of abstract methods
|
boolean |
createReplicaGroup(java.lang.String serviceName,
int epoch,
java.lang.String state,
java.util.Set<NodeIDType> nodes)
This method should return true if the replica group is successfully
created or one already exists with the same set of nodes.
|
boolean |
deleteFinalState(java.lang.String name,
int epoch)
Garbage-collects the final state for name, epoch.
|
boolean |
deleteReplicaGroup(java.lang.String serviceName,
int epoch)
This method should result in all state corresponding to serviceName being
deleted
|
protected abstract void |
enqueue(Request request,
boolean noReplyToClient) |
boolean |
execute(Request request) |
boolean |
execute(Request request,
boolean noReplyToClient)
This method must handle the request atomically and return true if
successful or throw an exception or return false.
|
java.lang.Integer |
getEpoch(java.lang.String name)
Returns the current (unique) epoch for name.
|
java.lang.String |
getFinalState(java.lang.String name,
int epoch)
Return the final checkpointed state for name, epoch.
|
java.util.Set<NodeIDType> |
getReplicaGroup(java.lang.String serviceName)
This method must return the replica group that was most recently
successfully created for the serviceName using createReplicaGroup.
|
java.util.Set<IntegerPacketType> |
getRequestTypes() |
ReconfigurableRequest |
getStopRequest(java.lang.String name,
int epoch)
Returns a stop request that when executed by the app ensures that no
subsequent request after the stop is executed in that epoch.
|
protected abstract boolean |
isLocked(java.lang.String serviceName) |
void |
putInitialState(java.lang.String name,
int epoch,
java.lang.String state)
Inserts the specified state as the initial state for name, epoch.
|
boolean |
restore(java.lang.String name,
java.lang.String state)
Resets the current application state for
name to state . |
callCallback, createReplicaGroup, execute, getAppRequestTypes, getARARNodesAsString, getARRCNodesAsString, getCallback, getCoordinatorRequestTypes, getMessenger, getMutualAuthAppRequestTypes, getMyID, getRequest, getRequest, getRequest, handleIncoming, hasLargeCheckpoints, registerCoordination, sendAllLazy, setCallback, setLargeCheckpoints, setMessenger, setStopCallback, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMutualAuthRequestTypes, getServerAuthRequestTypes
protected AbstractTransactor(AbstractReplicaCoordinator<NodeIDType> coordinator)
public java.util.Set<IntegerPacketType> getRequestTypes()
public boolean coordinateRequest(Request request, ExecutedCallback callback) throws java.io.IOException, RequestParseException
AbstractReplicaCoordinator
coordinateRequest
in interface ReplicaCoordinator<NodeIDType>
coordinateRequest
in class AbstractReplicaCoordinator<NodeIDType>
java.io.IOException
RequestParseException
public boolean execute(Request request, boolean noReplyToClient)
Replicable
execute
in interface Replicable
execute
in class AbstractReplicaCoordinator<NodeIDType>
noReplyToClient
- If true, the application is expected to not send a response
back to the originating client (say, because this request is
part of a post-crash roll-forward or only the "entry replica"
that received the request from the client is expected to
respond back. If false, the application is expected to either
send a response (if any) back to the client via the
ClientMessenger
interface or delegate response
messaging to paxos via the ClientRequest.getResponse()
interface.request.getServiceName()
) altogether after a limited
number of retries, so the replica group may get stuck unless it
returns true after a limited number of retries. Thus, with paxos
as the replica coordination protocol, returning false is not
really an option as paxos has no way to "roll back" a request
whose global order has already been agreed upon.
With replica coordination protocols other than paxos, the boolean
return value could be used in protocol-specific ways, e.g., a
primary-backup protocol might normally execute a request at just
one replica but relay the request to one or more backups if the
return value of Application.execute(Request)
is false.
protected abstract void enqueue(Request request, boolean noReplyToClient)
protected abstract boolean isLocked(java.lang.String serviceName)
public boolean execute(Request request)
execute
in interface Application
execute
in class AbstractReplicaCoordinator<NodeIDType>
public boolean createReplicaGroup(java.lang.String serviceName, int epoch, java.lang.String state, java.util.Set<NodeIDType> nodes)
ReplicaCoordinator
createReplicaGroup
in interface ReplicaCoordinator<NodeIDType>
createReplicaGroup
in class AbstractReplicaCoordinator<NodeIDType>
public boolean deleteReplicaGroup(java.lang.String serviceName, int epoch)
ReplicaCoordinator
deleteReplicaGroup
in interface ReplicaCoordinator<NodeIDType>
deleteReplicaGroup
in class AbstractReplicaCoordinator<NodeIDType>
public java.util.Set<NodeIDType> getReplicaGroup(java.lang.String serviceName)
ReplicaCoordinator
getReplicaGroup
in interface ReplicaCoordinator<NodeIDType>
getReplicaGroup
in class AbstractReplicaCoordinator<NodeIDType>
serviceName
.public ReconfigurableRequest getStopRequest(java.lang.String name, int epoch)
Reconfigurable
getStopRequest
in interface Reconfigurable
getStopRequest
in class AbstractReplicaCoordinator<NodeIDType>
name:epoch
.public java.lang.String getFinalState(java.lang.String name, int epoch)
Reconfigurable
getFinalState
in interface Reconfigurable
getFinalState
in class AbstractReplicaCoordinator<NodeIDType>
public void putInitialState(java.lang.String name, int epoch, java.lang.String state)
Reconfigurable
putInitialState
in interface Reconfigurable
putInitialState
in class AbstractReplicaCoordinator<NodeIDType>
public boolean deleteFinalState(java.lang.String name, int epoch)
Reconfigurable
deleteFinalState
in interface Reconfigurable
deleteFinalState
in class AbstractReplicaCoordinator<NodeIDType>
name:epoch
was deleted or did not
exist to begin with.public java.lang.Integer getEpoch(java.lang.String name)
Reconfigurable
getEpoch
in interface Reconfigurable
getEpoch
in class AbstractReplicaCoordinator<NodeIDType>
name
.public java.lang.String checkpoint(java.lang.String name)
Replicable
checkpoint
in interface Replicable
checkpoint
in class AbstractReplicaCoordinator<NodeIDType>
Note that state
may simply be an app-specific handle,
e.g., a file name, representing the state as opposed to the
actual state. The application is responsible for interpreting the
state returned by Replicable.checkpoint(String)
and that supplied
in Replicable.restore(String, String)
in a consistent manner.
public boolean restore(java.lang.String name, java.lang.String state)
Replicable
name
to state
.
Note that state
may simply be an app-specific handle, e.g., a
file name, representing the state as opposed to the actual state. The
application is responsible for interpreting the state returned by
Replicable.checkpoint(String)
and that supplied in
Replicable.restore(String, String)
in a consistent manner.
restore
in interface Replicable
restore
in class AbstractReplicaCoordinator<NodeIDType>