README
1NAME
2 Net::Riak - Interface to Riak
3
4VERSION
5 version 0.1702
6
7SYNOPSIS
8 # REST interface
9 my $client = Net::Riak->new(
10 host => 'http://10.0.0.40:8098',
11 ua_timeout => 900,
12 );
13
14 # Or PBC interface.
15 my $client = Net::Riak->new(
16 transport => 'PBC',
17 host => '10.0.0.40',
18 port => 8080
19 );
20
21 my $bucket = $client->bucket('blog');
22 my $obj = $bucket->new_object('new_post', {title => 'foo', content => 'bar'});
23 $obj->store;
24
25 $obj = $bucket->get('new_post');
26 say "title for ".$obj->key." is ".$obj->data->{title};
27
28 # Indexing and searching (REST interface)
29 $client->setup_indexing("bucket_name");
30 ...adding documents to riak...
31 my $response = $client->search(
32 index => 'bucket_name',
33 q => 'field:value'
34 );
35
36 # Secondary index setup (REST interface)
37 my $obj3 = $bucket->new_object('foo3', {...});
38 $obj3->add_index('myindex_bin','myvalue' );
39 $obj3->add_index('number_int', 1001);
40 $obj3->store;
41
42 # Get all keys for a specific index/value pair
43 my @keys = $client->index('mybucket', 'myindex_bin', 'myvalue' );
44
45 # Get all keys for a range of index value pairs
46 my @keys = $client->index('mybucket', 'number_int', 500, 1500);
47
48 # Removing a secondary index (REST interface)
49 my $new_obj = $bucket->get('foo3');
50 $new_obj->remove_index('number_int', 1001);
51 $new_obj->store;
52
53DESCRIPTION
54 ATTRIBUTES
55 host
56 REST: The URL of the node
57
58 PBC: The hostname of the node
59
60 default 'http://127.0.0.1:8098'
61
62 Note that providing multiple hosts is now deprecated.
63
64 port
65 Port of the PBC interface.
66
67 transport
68 Used to select the PB protocol by passing in 'PBC'
69
70 prefix
71 Interface prefix (default 'riak')
72
73 mapred_prefix
74 MapReduce prefix (default 'mapred')
75
76 r R value setting for this client (default 2)
77
78 w W value setting for this client (default 2)
79
80 dw
81 DW value setting for this client (default 2)
82
83 client_id
84 client_id for this client
85
86 ua_timeout (REST only)
87 timeout for LWP::UserAgent in seconds, defaults to 3.
88
89 disable_return_body (REST only)
90 Disable returning of object content in response in a store operation.
91
92 If set to true and the object has siblings these will not be available
93 without an additional fetch.
94
95 This will become the default behaviour in 0.17
96
97METHODS
98 bucket
99 my $bucket = $client->bucket($name);
100
101 Get the bucket by the specified name. Since buckets always exist, this
102 will always return a Net::Riak::Bucket
103
104 is_alive
105 if (!$client->is_alive) {
106 ...
107 }
108
109 Check if the Riak server for this client is alive
110
111 all_buckets
112 List all buckets, requires Riak 0.14+ or PBC connection.
113
114 add
115 my $map_reduce = $client->add('bucket_name', 'key');
116
117 Start assembling a Map/Reduce operation
118
119 link
120 my $map_reduce = $client->link();
121
122 Start assembling a Map/Reduce operation
123
124 map
125 my $map_reduce = $client->add('bucket_name', 'key')->map("function ...");
126
127 Start assembling a Map/Reduce operation
128
129 reduce
130 my $map_reduce = $client->add(..)->map(..)->reduce("function ...");
131
132 Start assembling a Map/Reduce operation
133
134 server_info (PBC only)
135 $client->server_info->{server_version};
136
137 stats (REST only)
138 say Dumper $client->stats;
139
140 search (REST only)
141 $client->search( index => 'bucket_name', q => 'field:value' );
142
143 Makes a query to the index (see Net::Riak::Search for more details on
144 parameters)
145
146 setup_indexing (REST only)
147 $client->setup_indexing('bucket_name');
148
149 Define precommit hook in order to enable indexing documents written into
150 the given bucket
151
152SEE ALSO
153 Net::Riak::MapReduce
154
155 Net::Riak::Object
156
157 Net::Riak::Bucket
158
159AUTHOR
160 franck cuny <franck@lumberjaph.net>, robin edwards <robin.ge@gmail.com>
161
162COPYRIGHT AND LICENSE
163 This software is copyright (c) 2013 by linkfluence.
164
165 This is free software; you can redistribute it and/or modify it under
166 the same terms as the Perl 5 programming language system itself.
167
168