cassandra/interface/cassandra.genavro

222 lines
6.6 KiB
Plaintext

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Cassandra client interface
*/
@namespace("org.apache.cassandra.avro")
protocol Cassandra {
enum AccessLevel {
NONE, READONLY, READWRITE, FALL
}
record ColumnPath {
string column_family;
union { bytes, null } super_column;
union { bytes, null } column;
}
record ColumnParent {
string column_family;
union { bytes, null } super_column;
}
record Clock {
long timestamp;
}
record Column {
bytes name;
bytes value;
Clock clock;
union { int, null } ttl;
}
record SuperColumn {
bytes name;
array<Column> columns;
}
record ColumnOrSuperColumn {
union { Column, null } column;
union { SuperColumn, null } super_column;
}
record SliceRange {
bytes start;
bytes finish;
boolean reversed;
int count;
union { array<bytes>, null } bitmasks;
}
record SlicePredicate {
union { array<bytes>, null } column_names;
union { SliceRange, null } slice_range;
}
record Deletion {
Clock clock;
union { bytes, null } super_column;
union { SlicePredicate, null } predicate;
}
record Mutation {
union { ColumnOrSuperColumn, null } column_or_supercolumn;
union { Deletion, null } deletion;
}
enum IndexType {
KEYS
}
/* describes a column in a column family. */
record ColumnDef {
bytes name;
string validation_class;
union { IndexType, null } index_type;
union { string, null } index_name;
}
/**
* describes a keyspace:
* NB: the id field is ignored during column family creation: the server will choose an appropriate value.
*/
record CfDef {
string keyspace;
string name;
union { string, null } column_type;
union { string, null } clock_type;
union { string, null } comparator_type;
union { string, null } subcomparator_type;
union { string, null } reconciler;
union { string, null } comment;
union { double, null } row_cache_size;
union { boolean, null } preload_row_cache;
union { double, null } key_cache_size;
union { double, null } read_repair_chance;
union { int, null } gc_grace_seconds;
union { array<ColumnDef>, null } column_metadata;
union { int, null } id;
}
/* describes a keyspace. */
record KsDef {
string name;
string strategy_class;
union{ map<string>, null } strategy_options;
int replication_factor;
array<CfDef> cf_defs;
}
record MutationsMapEntry {
bytes key;
map<array<Mutation>> mutations;
}
record CoscsMapEntry {
bytes key;
array<ColumnOrSuperColumn> columns;
}
enum ConsistencyLevel {
ZERO, ONE, QUORUM, DCQUORUM, DCQUORUMSYNC, ALL
}
error InvalidRequestException {
union { string, null } why;
}
error NotFoundException {
union { string, null } why;
}
error UnavailableException {
union { string, null } why;
}
error TimedOutException {
union { string, null } why;
}
ColumnOrSuperColumn get(bytes key,
ColumnPath column_path,
ConsistencyLevel consistency_level)
throws InvalidRequestException, NotFoundException, UnavailableException,
TimedOutException;
/**
* Get the group of columns contained by a 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.
*/
array<ColumnOrSuperColumn> get_slice(bytes key,
ColumnParent column_parent,
SlicePredicate predicate,
ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException;
/**
* Performs a get_slice for column_parent and predicate against the given
* set of keys in parallel.
*/
array<CoscsMapEntry> multiget_slice(array<bytes> keys,
ColumnParent column_parent,
SlicePredicate predicate,
ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException;
/**
* Returns the number of columns matching a predicate for a particular
* key, ColumnFamily, and optionally SuperColumn.
*/
int get_count(bytes key,
ColumnParent column_parent,
SlicePredicate predicate,
ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException;
void insert(bytes key,
ColumnParent column_parent,
Column column,
ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException;
void remove(bytes key,
ColumnPath column_path,
Clock clock,
ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException;
void batch_mutate(array<MutationsMapEntry> mutation_map,
ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException;
void system_add_keyspace(KsDef ks_def) throws InvalidRequestException;
void set_keyspace(string keyspace) throws InvalidRequestException;
array<string> describe_keyspaces();
string describe_cluster_name();
string describe_version();
}