Skip to content
Newer
Older
100644 306 lines (188 sloc) 8.81 KB
15cfcd2 @fmgoncalves Initial Commit.
authored
1 NAME
2 Cassandra::Simple
3
4 VERSION
5 version 0.1
6
7 DESCRIPTION
8 Easy to use, Perl oriented client interface to Apache Cassandra.
9
10 This module attempts to abstract the underlying Thrift methods as much
11 as possible to allow any Perl developer a small learning curve when
12 using Cassandra.
13
14 SYNOPSYS
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
15 my ($keyspace, $column_family) = qw/simple simple/;
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
16
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
17 my $conn = Cassandra::Simple->new(keyspace => $keyspace,);
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
18
5f2c7b6 @fmgoncalves Changed insert and batch insert $columns argument type
authored
19 $conn->create_column_family( $keyspace, $column_family);
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
20
219d037 Updated Cassandra::Simple POD
Filipe Gonçalves authored
21 $conn->insert($column_family, 'KeyA', { 'ColumnA' => 'AA' , 'ColumnB' => 'AB' } );
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
22
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
23 $conn->get($column_family, 'KeyA');
24 $conn->get($column_family, 'KeyA', { columns => [ qw/ColumnA/ ] });
25 $conn->get($column_family, 'KeyA', { column_count => 1, column_reversed => 1 });
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
26
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
27 $conn->batch_insert($column_family, { 'KeyB' => [ [ 'ColumnA' => 'BA' ] , [ 'ColumnB' => 'BB' ] ], 'KeyC' => [ [ 'ColumnA' => 'CA' ] , [ 'ColumnD' => 'CD' ] ] });
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
28
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
29 $conn->multiget($column_family, [qw/KeyA KeyC/]);
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
30
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
31 $conn->get_range($column_family, { start=> 'KeyA', finish => 'KeyB', column_count => 1 });
32 $conn->get_range($column_family);
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
33
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
34 $conn->get_indexed_slices($column_family, { expression_list => [ [ 'ColumnA' => 'BA' ] ] });
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
35
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
36 $conn->remove($column_family, [ 'KeyA' ], { columns => [ 'ColumnA' ]});
37 $conn->remove($column_family, [ 'KeyA' ]);
38 $conn->remove($column_family);
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
39
5b7d812 @fmgoncalves Fixed method returns (when possible return hash)
authored
40 $conn->get_count($column_family, 'KeyA');
41 $conn->multiget_count($column_family, [ 'KeyB', 'KeyC' ]);
15cfcd2 @fmgoncalves Initial Commit.
authored
42
43 get
44 Usage: "get($column_family, $key[, opt])"
45
46 $opt is a *HASH* and can have the following keys:
47
48 columns, column_start, column_finish, column_count, column_reversed,
fc27c86 @fmgoncalves Updated POD documentation
authored
49 super_column, consistency_level_read
15cfcd2 @fmgoncalves Initial Commit.
authored
50
51 Returns an HASH of the form "{ column => value, column => value }"
52
53 multiget
54 Usage: "multiget($column_family, $keys[, opt])"
55
56 $keys should be an *ARRAYREF* of keys to fetch.
57
58 All parameters in $opt are the same as in "get()"
59
60 Returns an HASH of the form "{ key => { column => value, column => value
61 }, key => { column => value, column => value } }"
62
63 get_count
64 Usage: "get_count($column_family, $key[, opt])"
65
66 $opt is a *HASH* and can have the following keys:
67
fc27c86 @fmgoncalves Updated POD documentation
authored
68 columns, column_start, column_finish, super_column,
69 consistency_level_read
15cfcd2 @fmgoncalves Initial Commit.
authored
70
71 Returns the count as an int
72
73 multiget_count
74 Usage: "multiget_count($column_family, $keys[, opt])"
75
76 $keys should be an *ARRAYREF* of keys.
77
78 All parameters in $opt are the same as in "get_count()"
79
80 Returns a mapping of "key -> count"
81
82 get_range
83 Usage: "get_range( $column_family[, opt])"
84
85 $opt is a *HASH* and can have the following keys:
86
87 start, finish, columns, column_start, column_finish, column_reversed,
fc27c86 @fmgoncalves Updated POD documentation
authored
88 column_count, row_count, super_column, consistency_level_read
15cfcd2 @fmgoncalves Initial Commit.
authored
89
90 Returns an *HASH* of the form "{ key => { column => value, column =>
91 value }, key => { column => value, column => value } }"
92
93 get_indexed_slices
94 Usage: "get_indexed_slices($column_family, $index_clause[, opt])"
95
96 $index_clause is an *HASH* containing the following keys:
97
98 expression_list, start_key, row_count
99
1b50eff @fmgoncalves Updated README
authored
100 The *expression_list* is an *ARRAYREF* of *ARRAYREF* containing
101 "$column[, $operator], $value". $operator can be '=', '<', '>', '<='
102 or '>='.
15cfcd2 @fmgoncalves Initial Commit.
authored
103
104 $opt is an *HASH* and can have the following keys:
105
106 columns, column_start, column_finish, column_reversed, column_count,
107 consistency_level_read
108
109 Returns an *HASH* of the form "{ key => { column => value, column =>
110 value }, key => { column => value, column => value } }"
111
112 insert
113 Usage: "insert($column_family, $key, $columns[, opt])"
114
f28428e @fmgoncalves Update POD documentation
authored
115 The $columns is an *HASHREF* of the form "{ column => value, column =>
116 value }"
fc27c86 @fmgoncalves Updated POD documentation
authored
117
118 $opt is an *HASH* and can have the following keys:
119
120 timestamp, ttl, consistency_level_write
121
122 insert_super
5f2c7b6 @fmgoncalves Changed insert and batch insert $columns argument type
authored
123 Usage: "insert_super($column_family, $key, $columns[, opt])"
fc27c86 @fmgoncalves Updated POD documentation
authored
124
125 The $columns is an *HASH* of the form "{ super_column => { column =>
126 value, column => value } }"
15cfcd2 @fmgoncalves Initial Commit.
authored
127
128 $opt is an *HASH* and can have the following keys:
129
130 timestamp, ttl, consistency_level_write
131
132 batch_insert
133 Usage: "batch_insert($column_family, $rows[, opt])"
134
f28428e @fmgoncalves Update POD documentation
authored
135 $rows is an *HASH* of the form "{ key => { column => value , column =>
136 value }, key => { column => value , column => value } }"
15cfcd2 @fmgoncalves Initial Commit.
authored
137
138 $opt is an *HASH* and can have the following keys:
139
7b2b1e1 Order of keys parameter on multiget is now respected in the result.
Filipe Gonçalves authored
140 timestamp, ttl, consistency_level_write
15cfcd2 @fmgoncalves Initial Commit.
authored
141
1e0665c @fmgoncalves Returns on all methods. Fixed README
authored
142 add
143 Usage: "add($column_family, $key, $column, [$value [, opt]])"
144
145 Increment or decrement counter $column by $value. $value is 1 by
146 default.
147
148 $opt is a *HASH* and can have the following keys:
149
150 super_column, consistency_level_write
151
aa56600 Added batch_add call to allow bulk update counters. fixes #8
Filipe Gonçalves authored
152 batch_add
153 Usage: "batch_add($column_family, $rows[, opt])"
154
155 $rows is an *HASH* of the form "{ key => { column => value , column =>
156 value }, key => { column => value , column => value } }"
157
158 $opt is an *HASH* and can have the following keys:
159
7b2b1e1 Order of keys parameter on multiget is now respected in the result.
Filipe Gonçalves authored
160 consistency_level_write
aa56600 Added batch_add call to allow bulk update counters. fixes #8
Filipe Gonçalves authored
161
1e0665c @fmgoncalves Returns on all methods. Fixed README
authored
162 remove_counter
163 Usage: "remove_counter($column_family, $key, $column [, opt])"
164
165 Remove counter $column on $key.
166
167 $opt is a *HASH* and can have the following keys:
168
169 super_column, consistency_level_write
170
15cfcd2 @fmgoncalves Initial Commit.
authored
171 remove
172 Usage: "remove($column_family[, $keys][, opt])"
173
a9997c2 @fmgoncalves Implemented connection pool. Added ring method.
authored
174 $keys is a key or an *ARRAY* of keys to be deleted.
15cfcd2 @fmgoncalves Initial Commit.
authored
175
176 A removal whitout keys truncates the whole column_family.
177
178 $opt is an *HASH* and can have the following keys:
179
180 columns, super_column, write_consistency_level
181
182 The timestamp used for remove is returned.
183
22923ad @fmgoncalves Added column family listing and creation methods.
authored
184 list_keyspace_cfs
4cdd34d @fmgoncalves Lowered debian dependencies versions.
authored
185 Usage: "list_keyspace_cfs()"
22923ad @fmgoncalves Added column family listing and creation methods.
authored
186
187 Returns an HASH of "{ column_family_name => column_family_type }" where
188 column family type is either "Standard" or "Super"
189
190 create_column_family
5cdb72d @fmgoncalves Updated README
authored
191 Usage "create_column_family($keyspace, $column_family[, $cfdef])"
22923ad @fmgoncalves Added column family listing and creation methods.
authored
192
5cdb72d @fmgoncalves Updated README
authored
193 Creates a new column family $column_family in keyspace $keyspace. $cfdef
194 is an HASH containing Column Family Definition options (column_type,
195 comparator_type, etc.).
22923ad @fmgoncalves Added column family listing and creation methods.
authored
196
3881047 @fmgoncalves Added keyspace manipulation methods. Fixed major bug (same keys in Lo…
authored
197 create_keyspace
198 Usage "create_keyspace($keyspace [, $opt])"
199
200 $opt is an *HASH* and can have the following keys:
201
202 strategy
203
4cdd34d @fmgoncalves Lowered debian dependencies versions.
authored
204 list_keyspaces
205 Usage "list_keyspaces()"
206
207 drop_keyspace
208 Usage "drop_keyspace($keyspace [, $opt])"
209
f28428e @fmgoncalves Update POD documentation
authored
210 create_index
cafd939 @fmgoncalves Added Counters support
authored
211 Usage: "create_index($keyspace, $column_family, $columns,
f28428e @fmgoncalves Update POD documentation
authored
212 [$validation_class])"
213
cafd939 @fmgoncalves Added Counters support
authored
214 Creates an index on $columns of $column_family. $columns is an ARRAY of
215 column names to be indexed. $validation_class only applies when $column
216 doesn't yet exist, and even then it is optional (defaults to
217 *BytesType*).
f28428e @fmgoncalves Update POD documentation
authored
218
451dad3 @fmgoncalves Fixed client address bug in pool.
authored
219 ring
220 Usage: "ring($keyspace)"
221
222 Lists the addresses of all nodes on the cluster associated with the
223 keyspace "<$keyspace">.
224
15cfcd2 @fmgoncalves Initial Commit.
authored
225 BUGS
226 Bugs should be reported on github at
227 <https://github.com/fmgoncalves/p5-cassandra-simple>.
228
229 TODO
408d3b3 @fmgoncalves Removed CompositeType logic from Simple.pm and transfered the burden …
authored
230 Thrift Type Checking and Packing/Unpacking
231
232 The defined types (or defaults) for each column family are known and
233 should therefore be complied with. Introducing Composite Types has
234 forcefully introduced this functionality to an extent, but there should
235 be a refactoring to make this ubiquitous to the client.
236
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
237 Error Handling
238
7c0ef3e @fmgoncalves Allowed full cfdef in create_column_family. Fixed examples. Restored …
authored
239 Exceptions raised when calling Cassandra code should be reported in
240 error form with appropriate description.
1e72e6f @fmgoncalves Added composite types support (still undocumented). Added composite t…
authored
241
15cfcd2 @fmgoncalves Initial Commit.
authored
242 Unit Tests
243
fc27c86 @fmgoncalves Updated POD documentation
authored
244 Sort of done in the examples folder
245 <https://github.com/fmgoncalves/p5-cassandra-simple/tree/master/exampl
246 es>
247
cabb172 @fmgoncalves Fixed a few bugs.
authored
248 Tombstones
249
250 get, get_range and get_indexed_slices should probably filter out
251 tombstones, even if it means returning less than the requested count.
252 Ideally it would retry until it got enough results.
253
15cfcd2 @fmgoncalves Initial Commit.
authored
254 Methods
255
256 The following are Thrift methods left unimplemented.
257
258 Not all of these will be implemented, since some aren't useful to the
259 common developer.
260
261 Priority will be given to live schema updating methods.
262
263 describe_cluster_name
264
265 string describe_cluster_name()
266
267 describe_keyspace
268
269 KsDef describe_keyspace(string keyspace)
270
271 describe_partitioner
272
273 string describe_partitioner()
274
275 describe_snitch
276
277 string describe_snitch()
278
279 describe_version
280
281 string describe_version()
282
283 system_drop_column_family
284
285 string system_drop_column_family(ColumnFamily column_family)
286
287 ACKNOWLEDGEMENTS
5571250 Added weights to servers in pool. Modified examples for clarity.
Filipe Gonçalves authored
288 Implementation loosely based on Cassandra::Lite.
15cfcd2 @fmgoncalves Initial Commit.
authored
289
290 <http://search.cpan.org/~gslin/Cassandra-Lite-0.0.4/lib/Cassandra/Lite
291 .pm>
292
293 API based on Pycassa.
294
295 <http://pycassa.github.com/pycassa/>
296
297 AUTHOR
298 Filipe Gonçalves "<the.wa.syndrome@gmail>"
299
300 COPYRIGHT AND LICENSE
301 This software is copyright (c) 2011 by Filipe Gonçalves.
302
303 This is free software; you can redistribute it and/or modify it under
304 the same terms as the Perl 5 programming language system itself.
305
Something went wrong with that request. Please try again.