Cassandraのインターフェース

https://svn.apache.org/repos/asf/incubator/cassandra/trunk/interface/cassandra.thrift

これ見るのが一番。serviceのとこみればインターフェースが、structのところを見ればデータモデルがわかります。thriftで実際にインターフェースからクライアントを生成してみると、各言語にbindできるのでよりわかりやすいです。

実装については、CassandraServerが下記のインターフェースを実装しているので、そこからどのような処理が行われるのかを見ていくのが吉です。

service Cassandra {
  # auth methods
  void login(1: required string keyspace, 2:required AuthenticationRequest auth_request) throws (1:AuthenticationException authnx, 2:AuthorizationException authzx),
 
  # retrieval methods

  /**
    Get the Column or SuperColumn at the given column_path. If no value is present, NotFoundException is thrown. (This is
    the only method that can throw an exception under non-failure conditions.)
   */
  ColumnOrSuperColumn get(1:required string keyspace,
                          2:required string key,
                          3:required ColumnPath column_path,
                          4:required ConsistencyLevel consistency_level=ONE)
                      throws (1:InvalidRequestException ire, 2:NotFoundException nfe, 3:UnavailableException ue, 4:TimedOutException te),

  /**
    Get the group of columns contained by column_parent (either a ColumnFamily name or a ColumnFamily/SuperColumn name
    pair) specified by the given SlicePredicate. If no matching values are found, an empty list is returned.
   */
  list<ColumnOrSuperColumn> get_slice(1:required string keyspace, 
                                      2:required string key, 
                                      3:required ColumnParent column_parent, 
                                      4:required SlicePredicate predicate, 
                                      5:required ConsistencyLevel consistency_level=ONE)
                            throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
    Perform a get for column_path in parallel on the given list<string> keys. The return value maps keys to the
    ColumnOrSuperColumn found. If no value corresponding to a key is present, the key will still be in the map, but both
    the column and super_column references of the ColumnOrSuperColumn object it maps to will be null.  
    @deprecated; use multiget_slice
  */
  map<string,ColumnOrSuperColumn> multiget(1:required string keyspace, 
                                           2:required list<string> keys, 
                                           3:required ColumnPath column_path, 
                                           4:required ConsistencyLevel consistency_level=ONE)
                                  throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
    Performs a get_slice for column_parent and predicate for the given keys in parallel.
  */
  map<string,list<ColumnOrSuperColumn>> multiget_slice(1:required string keyspace, 
                                                       2:required list<string> keys, 
                                                       3:required ColumnParent column_parent, 
                                                       4:required SlicePredicate predicate, 
                                                       5:required ConsistencyLevel consistency_level=ONE)
                                        throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
    returns the number of columns for a particular <code>key</code> and <code>ColumnFamily</code> or <code>SuperColumn</code>.
  */
  i32 get_count(1:required string keyspace, 
                2:required string key, 
                3:required ColumnParent column_parent, 
                4:required ConsistencyLevel consistency_level=ONE)
      throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
   returns a subset of columns for a range of keys.
   @Deprecated.  Use get_range_slices instead
  */
  list<KeySlice> get_range_slice(1:required string keyspace, 
                                 2:required ColumnParent column_parent, 
                                 3:required SlicePredicate predicate,
                                 4:required string start_key="", 
                                 5:required string finish_key="", 
                                 6:required i32 row_count=100, 
                                 7:required ConsistencyLevel consistency_level=ONE)
                 throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
   returns a subset of columns for a range of keys.
  */
  list<KeySlice> get_range_slices(1:required string keyspace, 
                                  2:required ColumnParent column_parent, 
                                  3:required SlicePredicate predicate,
                                  4:required KeyRange range,
                                  5:required ConsistencyLevel consistency_level=ONE)
                 throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  # modification methods

  /**
    Insert a Column consisting of (column_path.column, value, timestamp) at the given column_path.column_family and optional
    column_path.super_column. Note that column_path.column is here required, since a SuperColumn cannot directly contain binary
    values -- it can only contain sub-Columns. 
   */
  void insert(1:required string keyspace, 
              2:required string key, 
              3:required ColumnPath column_path, 
              4:required binary value, 
              5:required i64 timestamp, 
              6:required ConsistencyLevel consistency_level=ZERO)
       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
    Insert Columns or SuperColumns across different Column Families for the same row key. batch_mutation is a
    map<string, list<ColumnOrSuperColumn>> -- a map which pairs column family names with the relevant ColumnOrSuperColumn
    objects to insert.
    @deprecated; use batch_mutate instead
   */
  void batch_insert(1:required string keyspace, 
                    2:required string key, 
                    3:required map<string, list<ColumnOrSuperColumn>> cfmap,
                    4:required ConsistencyLevel consistency_level=ZERO)
       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  /**
    Remove data from the row specified by key at the granularity specified by column_path, and the given timestamp. Note
    that all the values in column_path besides column_path.column_family are truly optional: you can remove the entire
    row by just specifying the ColumnFamily, or you can remove a SuperColumn or a single Column by specifying those levels too.
   */
  void remove(1:required string keyspace,
              2:required string key,
              3:required ColumnPath column_path,
              4:required i64 timestamp,
              5:ConsistencyLevel consistency_level=ZERO)
       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),

  void batch_mutate(1:required string keyspace,
                    2:required map<string, map<string, list<Mutation>>> mutation_map,
                    3:required ConsistencyLevel consistency_level=ZERO)
       throws (1:InvalidRequestException ire, 2:UnavailableException ue, 3:TimedOutException te),
       
  // Meta-APIs -- APIs to get information about the node or cluster,
  // rather than user data.  The nodeprobe program provides usage examples.

  /** get property whose value is of type string. @Deprecated */
  string get_string_property(1:required string property),

  /** get property whose value is list of strings. @Deprecated */
  list<string> get_string_list_property(1:required string property),

  /** list the defined keyspaces in this cluster */
  set<string> describe_keyspaces(),

  /** get the cluster name */
  string describe_cluster_name(),

  /** get the thrift api version */
  string describe_version(),

  /** get the token ring: a map of ranges to host addresses,
      represented as a set of TokenRange instead of a map from range
      to list of endpoints, because you can&#39;t use Thrift structs as
      map keys:
      https://issues.apache.org/jira/browse/THRIFT-162 

      for the same reason, we can&#39;t return a set here, even though
      order is neither important nor predictable. */
  list<TokenRange> describe_ring(1:required string keyspace),

  /** describe specified keyspace */
  map<string, map<string, string>> describe_keyspace(1:required string keyspace)
                                   throws (1:NotFoundException nfe),

  /** experimental API for hadoop/parallel query support.  
      may change violently and without warning. 

      returns list of token strings such that first subrange is (list[0], list[1]],
      next is (list[1], list[2]], etc. */
  list<string> describe_splits(1:required string start_token, 
  	                       2:required string end_token,
                               3:required i32 keys_per_split),
}