|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.versioning.VectorClock
public class VectorClock
A vector of the number of writes mastered by each node. The vector is stored sparely, since, in general, writes will be mastered by only one node. This means implicitly all the versions are at zero, but we only actually store those greater than zero.
Constructor Summary | |
---|---|
VectorClock()
Construct an empty VectorClock |
|
VectorClock(byte[] bytes)
Takes the bytes of a VectorClock and creates a java object from them. |
|
VectorClock(byte[] bytes,
int offset)
Read the vector clock from the given bytes starting from a particular offset |
|
VectorClock(java.util.List<ClockEntry> versions,
long timestamp)
Deprecated. |
|
VectorClock(long timestamp)
|
Method Summary | |
---|---|
VectorClock |
clone()
|
Occurred |
compare(Version v)
Return whether or not the given version preceeded this one, succeeded it, or is concurrant with it |
void |
copyFromVectorClock(VectorClock vc)
Function to copy values from another VectorClock. |
boolean |
equals(java.lang.Object object)
|
java.util.List<ClockEntry> |
getEntries()
Deprecated. |
long |
getMaxVersion()
|
long |
getTimestamp()
|
java.util.TreeMap<java.lang.Short,java.lang.Long> |
getVersionMap()
|
int |
hashCode()
|
VectorClock |
incremented(int nodeId,
long time)
Get new vector clock based on this clock but incremented on index nodeId |
void |
incrementVersion(int node,
long time)
Increment the version info associated with the given node |
VectorClock |
merge(VectorClock clock)
|
int |
sizeInBytes()
|
byte[] |
toBytes()
|
int |
toBytes(byte[] buf,
int offset)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VectorClock()
public VectorClock(long timestamp)
@Deprecated public VectorClock(java.util.List<ClockEntry> versions, long timestamp)
public VectorClock(byte[] bytes)
bytes
- The serialized bytes of the VectorClockpublic VectorClock(byte[] bytes, int offset)
bytes
- The bytes to read fromoffset
- The offset to start reading fromMethod Detail |
---|
public java.util.TreeMap<java.lang.Short,java.lang.Long> getVersionMap()
public byte[] toBytes()
public int toBytes(byte[] buf, int offset)
public int sizeInBytes()
public void incrementVersion(int node, long time)
node
- The nodepublic VectorClock incremented(int nodeId, long time)
nodeId
- The id of the node to increment
public VectorClock clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public long getMaxVersion()
public VectorClock merge(VectorClock clock)
public Occurred compare(Version v)
Version
compare
in interface Version
v
- The other versionpublic long getTimestamp()
@Deprecated public java.util.List<ClockEntry> getEntries()
public void copyFromVectorClock(VectorClock vc)
vc
- The VectorClock object from which the inner values are to be
copied.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |