org.apache.cassandra.db.context
Class CounterContext.ContextState

java.lang.Object
  extended by org.apache.cassandra.db.context.CounterContext.ContextState
Enclosing class:
CounterContext

public static class CounterContext.ContextState
extends java.lang.Object

Helper class to work on contexts (works by iterating over them). A context being abstractly a list of tuple (nodeid, 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
 java.nio.ByteBuffer context
           
 int headerLength
           
 
Constructor Summary
CounterContext.ContextState(java.nio.ByteBuffer context)
           
CounterContext.ContextState(java.nio.ByteBuffer context, int headerLength)
           
 
Method Summary
static CounterContext.ContextState allocate(int elementCount, int deltaCount)
           
static CounterContext.ContextState allocate(int elementCount, int deltaCount, Allocator allocator)
           
 int compareIdTo(CounterContext.ContextState other)
           
 void copyTo(CounterContext.ContextState other)
           
 CounterContext.ContextState duplicate()
           
 int elementIdx()
           
 long getClock()
           
 long getCount()
           
 NodeId getNodeId()
           
 boolean hasRemaining()
           
 boolean isDelta()
           
 void moveToNext()
           
 int remainingBodyLength()
           
 int remainingHeaderLength()
           
 void reset()
           
 void writeElement(NodeId id, long clock, long count)
           
 void writeElement(NodeId id, long clock, long count, boolean isDelta)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

public final java.nio.ByteBuffer context

headerLength

public final int headerLength
Constructor Detail

CounterContext.ContextState

public CounterContext.ContextState(java.nio.ByteBuffer context,
                                   int headerLength)

CounterContext.ContextState

public CounterContext.ContextState(java.nio.ByteBuffer context)
Method Detail

isDelta

public boolean isDelta()

hasRemaining

public boolean hasRemaining()

remainingHeaderLength

public int remainingHeaderLength()

remainingBodyLength

public int remainingBodyLength()

moveToNext

public void moveToNext()

copyTo

public void copyTo(CounterContext.ContextState other)

compareIdTo

public int compareIdTo(CounterContext.ContextState other)

reset

public void reset()

getNodeId

public NodeId getNodeId()

getClock

public long getClock()

getCount

public long getCount()

writeElement

public void writeElement(NodeId id,
                         long clock,
                         long count,
                         boolean isDelta)

writeElement

public void writeElement(NodeId id,
                         long clock,
                         long count)

elementIdx

public int elementIdx()

duplicate

public CounterContext.ContextState duplicate()

allocate

public static CounterContext.ContextState allocate(int elementCount,
                                                   int deltaCount)

allocate

public static CounterContext.ContextState allocate(int elementCount,
                                                   int deltaCount,
                                                   Allocator allocator)


Copyright © 2011 The Apache Software Foundation