Skip to content

Achilles Custom Types

DuyHai DOAN edited this page May 6, 2013 · 31 revisions

To support all Cassandra specific but powerfull features such as tunable consistency levels, wide rows or counters, Achilles introduces custom Java types:

  • WideMap: this interface offers a huge number of convenient methods to fetch data from wide rows in Cassandra. More details at WideMap API
  • KeyValue: this type is used with a WideMap. Basically a KeyValue represents a Cassandra column. It exposes the following signature:
// Constructors

public KeyValue();

public KeyValue(K key, V value);

public KeyValue(K key, V value, int ttl);

// Getters
public K getKey();

public V getValue();

public int getTtl();
  • KeyValueIterator: this type is used with a WideMap. This implements the Java Iterator<KeyValue<K,V>> interface and exposes the following interface:
public K nextKey();

public V nextValue();

public Integer nextTtl();
  • MultiKey: this is a marker interface. It indicates that the target class represents a Cassandra composite. For more details, please read Composite Search Keys

  • ConsistencyLevel: this enum lists all existing consistency levels in Cassandra:

    • ANY
    • ONE
    • TWO
    • THREE
    • QUORUM
    • EACH_QUORUM
    • LOCAL_QUORUM
    • ALL

See Consistency Level for more details

  • Counter: this type represents a Cassandra counter column. It exposes the following methods:
	public Long get();

	public Long get(ConsistencyLevel readLevel);

	public void incr();

	public void incr(ConsistencyLevel writeLevel);

	public void incr(Long increment);

	public void incr(Long increment, ConsistencyLevel writeLevel);

	public void decr();

	public void decr(ConsistencyLevel writeLevel);

	public void decr(Long decrement);

	public void decr(Long decrement, ConsistencyLevel writeLevel);

Home

Clone this wiki locally