me.prettyprint.cassandra.service.template
Class AbstractTemplateUpdater<K,N>

java.lang.Object
  extended by me.prettyprint.cassandra.service.template.AbstractTemplateUpdater<K,N>
Direct Known Subclasses:
ColumnFamilyUpdater, SuperCfUpdater

public abstract class AbstractTemplateUpdater<K,N>
extends Object


Field Summary
protected  long clock
           
protected  ColumnFactory columnFactory
           
protected static int DEF_TTL
           
protected  int globalTtl
           
protected  int keyPos
           
protected  List<K> keys
           
protected  Mutator<K> mutator
           
protected  AbstractColumnFamilyTemplate<K,N> template
           
 
Constructor Summary
AbstractTemplateUpdater(AbstractColumnFamilyTemplate<K,N> template, ColumnFactory columnFactory, Mutator<K> mutator)
           
 
Method Summary
 AbstractTemplateUpdater<K,N> addKey(K key)
           
 K getCurrentKey()
           
 Mutator<K> getCurrentMutator()
           
 void setClock(long clock)
          Reset the clock used for column creation.
 void setTtl(int ttl)
          Globally sets the ttl for this updater instance.
 void update()
          To be overridden by folks choosing to add their own functionality.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_TTL

protected static final int DEF_TTL
See Also:
Constant Field Values

keys

protected List<K> keys

keyPos

protected int keyPos

columnFactory

protected ColumnFactory columnFactory

template

protected AbstractColumnFamilyTemplate<K,N> template

mutator

protected Mutator<K> mutator

clock

protected long clock

globalTtl

protected int globalTtl
Constructor Detail

AbstractTemplateUpdater

public AbstractTemplateUpdater(AbstractColumnFamilyTemplate<K,N> template,
                               ColumnFactory columnFactory,
                               Mutator<K> mutator)
Method Detail

addKey

public AbstractTemplateUpdater<K,N> addKey(K key)

getCurrentKey

public K getCurrentKey()
Returns:
Give the updater access to the current key if it needs it

update

public void update()
To be overridden by folks choosing to add their own functionality. Default is a no-op.


getCurrentMutator

public Mutator<K> getCurrentMutator()

setClock

public void setClock(long clock)
Reset the clock used for column creation. By default, we hold a reference to a single clock value created at construction from AbstractColumnFamilyTemplate.getClock() Since updater implementations are instance-based (and thus should not be shared among threads), call this as often as you need to apply the clock to the underlying columns.

Parameters:
clock -

setTtl

public void setTtl(int ttl)
Globally sets the ttl for this updater instance. Any columns created via the updater will use this ttl value unless a ttl is explicitly provided to one of the set* methods of subclasses.

Parameters:
ttl -


Copyright © 2013. All Rights Reserved.