public class DeltaLWWRegister extends DeltaBasedCRDT
| Modifier and Type | Field and Description |
|---|---|
static pt.unl.fct.di.novasys.network.ISerializer<DeltaLWWRegister> |
serializer
A serializer that serializes the CRDT into (and from) a ByteBuf.
|
static CRDTsTypes |
TYPE |
state| Constructor and Description |
|---|
DeltaLWWRegister(ReplicaID replicaID)
Creates a delta-based register by passing the replica identifier.
|
DeltaLWWRegister(ReplicaID replicaID,
String value)
Creates a delta-based register with a default value, by passing the replica
identifier.
|
DeltaLWWRegister(VVState state)
Creates a delta-based register by passing the replica current state.
|
DeltaLWWRegister(VVState state,
String value)
Creates a delta-based register by passing the replica current state.
|
| Modifier and Type | Method and Description |
|---|---|
DeltaLWWRegister |
assign(String value)
Assigns a new value to the register
|
GenericCRDT |
copy()
Creates a copy of the CRDT.
|
DeltaLWWRegister |
generateDelta(VersionVector vv)
Calculates a delta from a given version for the current state
|
String |
get()
Obtains the value of the register
|
DeltaLWWRegister |
mergeDelta(DeltaBasedCRDT crdt)
Applies a delta to the current state.
|
void |
serialize(io.netty.buffer.ByteBuf in)
Serializes the CRDT into a ByteBuf
|
getReplicaID, getReplicaStateclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserializeDataType, getTypepublic static final CRDTsTypes TYPE
public static pt.unl.fct.di.novasys.network.ISerializer<DeltaLWWRegister> serializer
public DeltaLWWRegister(ReplicaID replicaID)
replicaID - replica identifierpublic DeltaLWWRegister(ReplicaID replicaID, String value)
replicaID - replica identifiervalue - the initial value of the registerpublic DeltaLWWRegister(VVState state)
state - replica current statepublic GenericCRDT copy()
GenericCRDTpublic String get()
public DeltaLWWRegister assign(String value)
value - value to assignpublic DeltaLWWRegister mergeDelta(DeltaBasedCRDT crdt) throws CRDTNotValidException
DeltaCRDTmergeDelta in interface DeltaCRDTmergeDelta in class DeltaBasedCRDTcrdt - a crdt representing the deltaCRDTNotValidException - if the crdt passed as argument is invalidpublic DeltaLWWRegister generateDelta(VersionVector vv)
DeltaCRDTgenerateDelta in interface DeltaCRDTgenerateDelta in class DeltaBasedCRDTvv - a version version to calculate the delta frompublic void serialize(io.netty.buffer.ByteBuf in)
throws IOException
GenericCRDTin - ByteBuf to serialize the CRDT toIOException - if an error occurs while serializingCopyright © 2024. All rights reserved.