public class CorfuCompileProxy<T> extends Object implements ICorfuSMRProxyInternal<T>
This class implements the methods that an in-memory corfu-object proxy carries in order to by in sync with a stream.
We refer to the program's object as the -corfu object-, and to the internal object implementation as the -proxy-.
If a Corfu object's method is an Accessor, it invokes the proxy's access() method.
If a Corfu object's method is a Mutator or Accessor-Mutator, it invokes the proxy's logUpdate() method.
Finally, if a Corfu object's method is an Accessor-Mutator, it obtains a result by invoking getUpcallResult().
Created by mwei on 11/11/16.
Constructor and Description |
---|
CorfuCompileProxy(CorfuRuntime rt,
UUID streamID,
Class<T> type,
Object[] args,
ISerializer serializer,
Map<String,ICorfuSMRUpcallTarget<T>> upcallTargetMap,
Map<String,IUndoFunction<T>> undoTargetMap,
Map<String,IUndoRecordFunction<T>> undoRecordTargetMap,
Set<String> resetSet)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
<R> R |
access(ICorfuSMRAccess<R,T> accessMethod,
Object[] conflictObject)
Access the state of the object.
|
IObjectBuilder<?> |
getObjectBuilder()
Get an object builder to build new objects.
|
Class<T> |
getObjectType()
Return the type of the object being replicated.
|
UUID |
getStreamID()
Get the ID of the stream this proxy is subscribed to.
|
<R> R |
getUpcallResult(long timestamp,
Object[] conflictObject)
Return the result of an upcall at the given timestamp.
|
long |
getVersion()
Get the latest version read by the proxy.
|
long |
logUpdate(String smrUpdateFunction,
boolean keepUpcallResult,
Object[] conflictObject,
Object... args)
Record an SMR function to the log before returning.
|
void |
sync()
Update the proxy to the latest committed version.
|
String |
toString() |
<R> R |
TXExecute(Supplier<R> txFunction)
Run in a transactional context.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSerializer, getUnderlyingObject
@Deprecated public CorfuCompileProxy(CorfuRuntime rt, UUID streamID, Class<T> type, Object[] args, ISerializer serializer, Map<String,ICorfuSMRUpcallTarget<T>> upcallTargetMap, Map<String,IUndoFunction<T>> undoTargetMap, Map<String,IUndoRecordFunction<T>> undoRecordTargetMap, Set<String> resetSet)
rt
- Connected CorfuRuntime instance.streamID
- StreamID of the log.type
- Type of underlying object to instantiate a new instance.args
- Arguments to create this proxy.serializer
- Serializer used by the SMR entries to serialize the arguments.upcallTargetMap
- upCallTargetMapundoTargetMap
- undoTargetMapundoRecordTargetMap
- undoRecordTargetMapresetSet
- resetSetpublic <R> R access(ICorfuSMRAccess<R,T> accessMethod, Object[] conflictObject)
access
in interface ICorfuSMRProxy<T>
R
- The type to return.accessMethod
- The method to execute when accessing an object.conflictObject
- Fine-grained conflict information, if available.public long logUpdate(String smrUpdateFunction, boolean keepUpcallResult, Object[] conflictObject, Object... args)
logUpdate
in interface ICorfuSMRProxy<T>
smrUpdateFunction
- The name of the function to record.keepUpcallResult
- Whether or not we need to keep the
result to the upcall, for a subsequent
call to getUpcallResult.conflictObject
- Fine-grained conflict information, if
available.args
- The arguments to the function.public <R> R getUpcallResult(long timestamp, Object[] conflictObject)
getUpcallResult
in interface ICorfuSMRProxy<T>
R
- The type of the upcall to return.timestamp
- The timestamp to request the upcall for.conflictObject
- Fine-grained conflict information, if
available.public void sync()
sync
in interface ICorfuSMRProxy<T>
public UUID getStreamID()
getStreamID
in interface ICorfuSMRProxy<T>
public <R> R TXExecute(Supplier<R> txFunction)
TXExecute
in interface ICorfuSMRProxy<T>
R
- The return type.txFunction
- The function to run in a transactional context.public IObjectBuilder<?> getObjectBuilder()
getObjectBuilder
in interface ICorfuSMRProxy<T>
public Class<T> getObjectType()
getObjectType
in interface ICorfuSMRProxy<T>
public long getVersion()
getVersion
in interface ICorfuSMRProxy<T>
Copyright © 2019 CorfuDB. All rights reserved.