Package org.apache.cassandra.db.context
Class CounterContext.ContextState
- java.lang.Object
-
- org.apache.cassandra.db.context.CounterContext.ContextState
-
- Enclosing class:
- CounterContext
public static class CounterContext.ContextState extends java.lang.ObjectHelper class to work on contexts (works by iterating over them). A context being abstractly a list of tuple (counterid, clock, count), a ContextState encapsulate a context and a position to one of the tuple. It also allow to create new context iteratively. Note: this is intrinsically a private class intended for use by the methods of CounterContext only. It is however public because it is convenient to create handcrafted context for unit tests.
-
-
Field Summary
Fields Modifier and Type Field Description java.nio.ByteBuffercontextintheaderLength
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CounterContext.ContextStateallocate(int globalCount, int localCount, int remoteCount)Allocate a new context big enough for globalCount + localCount + remoteCount elements and return the initial corresponding ContextState.intcompareIdTo(CounterContext.ContextState other)voidcopyTo(CounterContext.ContextState other)longgetClock()longgetCount()CounterIdgetCounterId()intgetElementIndex()booleanhasRemaining()booleanisGlobal()booleanisLocal()booleanisRemote()voidmoveToNext()voidreset()static CounterContext.ContextStatewrap(java.nio.ByteBuffer context)voidwriteGlobal(CounterId id, long clock, long count)voidwriteLocal(CounterId id, long clock, long count)voidwriteRemote(CounterId id, long clock, long count)
-
-
-
Method Detail
-
wrap
public static CounterContext.ContextState wrap(java.nio.ByteBuffer context)
-
allocate
public static CounterContext.ContextState allocate(int globalCount, int localCount, int remoteCount)
Allocate a new context big enough for globalCount + localCount + remoteCount elements and return the initial corresponding ContextState.
-
isGlobal
public boolean isGlobal()
-
isLocal
public boolean isLocal()
-
isRemote
public boolean isRemote()
-
hasRemaining
public boolean hasRemaining()
-
moveToNext
public void moveToNext()
-
copyTo
public void copyTo(CounterContext.ContextState other)
-
compareIdTo
public int compareIdTo(CounterContext.ContextState other)
-
reset
public void reset()
-
getElementIndex
public int getElementIndex()
-
getCounterId
public CounterId getCounterId()
-
getClock
public long getClock()
-
getCount
public long getCount()
-
writeGlobal
public void writeGlobal(CounterId id, long clock, long count)
-
writeLocal
public void writeLocal(CounterId id, long clock, long count)
-
writeRemote
public void writeRemote(CounterId id, long clock, long count)
-
-