forked from mkjellman/perlcassa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
93 lines (73 loc) · 3.3 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
This is Perl module perlcassa.
VERSION
v0.03
INSTALLATION
perlcassa can be installed by doing the usual:
$ perl Makefile.PL
$ make
$ make install
DESCRIPTION
perlcassa is a native Perl client for interfacing with Apache Cassandra. It is essentially an API for Apache Thrift. It intelligently deals with CompositeType columns and ValidationClasses and encodes and packs them appropriately for the columnfamily specified.
Note: This package does not support SuperColumns. Please look into CompositeType Comparators instead.
DOCUMENTATION
Documentation is light at this time and will be improved in the next version. For now please refer to the documentation available in POD format or look through the examples in the examples folder.
SYNOPOSIS
my $obj = new perlcassa(
'columnfamily' => 'myCF',
'keyspace' => 'myKeyspace',
'hosts' => ['host1.cassandra.local', 'host2.cassandra.local', 'host3.cassandra.local'],
#optional
'write_consistency_level' => Cassandra::ConsistencyLevel::QUORUM,
'read_consistency_level' => Cassandra::ConsistencyLevel::QUORUM,
'port' => '9160'
);
my %composite = ('values' => ['name_pt1', 'name_pt2']);
$obj->insert(
'key' => 'myKey',
'columnname' => \%composite,
'value' => 'myVal'
);
$obj->get(
'key' => 'myKey',
'columnname' => 'myColumn'
);
$obj->get_slice(
'key' => 'myKey',
'start' => ['name_pt1'],
'finish' => ['name_pt2','name_pt2_c'],
'start_equality' => 'equal', #optional (defaults to equal, options: equal, less_than_equal, or greater_than_equal)
'finish_equality'=> 'greater_than_equal' #optional (defaults to greater_than_equal, options: equal, less_than_equal, or greater_than_equal)
);
$obj->get_range_slices(
key_start => '',
key_finish => '',
column_start => ['colpt1','a'],
column_finish => ['thiscol'],
key_max_count => 10000,
buffer_size => 100
);
my %bulk = (
#value => [columnname]
'test' => ['name_pt1', 'name_pt2'],
'test2' => ['name_pt3', 'name_pr4']
);
$obj->bulk_insert(
'key' => 'testkey'
'columns' => \%bulk
);
TODO
* better documentation
* better handling thrift exceptions to try from another provided Cassandra instance/host automagically
* general performance optimizations
* auto retry failures where the node is up when the client is created but there is an exception such as a timeout on insert
COPYRIGHT & LICENSE
Copyright 2012 Michael Kjellman
Licensed 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.