Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kthakore/KiokuDB-Backend-Riak
base: 0287796598
...
head fork: kthakore/KiokuDB-Backend-Riak
compare: 8c34838ecb
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 40 additions and 4 deletions.
  1. +3 −2 Changes
  2. +2 −1  Makefile.PL
  3. +35 −1 lib/KiokuDB/Backend/Riak.pm
View
5 Changes
@@ -1,5 +1,6 @@
Revision history for KiokuDB-Backend-Riak
-0.01 Date/time
- First version, released on an unsuspecting world.
+0.01 Jan 7 2012
+ - Can get, update, delete and search results
+ - Made document schema loading work.
View
3  Makefile.PL
@@ -16,7 +16,8 @@ WriteMakefile(
'Net::Riak' => 0,
'Try::Tiny' => 0,
'LWP::Simple' => 0,
- 'Data::Stream::Bulk::Array' => 0
+ 'Data::Stream::Bulk::Array' => 0,
+ 'Module::Pluggable' => 0
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'KiokuDB-Backend-Riak-*' },
View
36 lib/KiokuDB/Backend/Riak.pm
@@ -32,6 +32,12 @@ has [qw/host port bucket_name/] => (
isa => 'Str'
);
+
+has 'schema' => (
+ is => 'rw',
+ isa => 'Str'
+);
+
has '_url' => (
is => 'rw',
isa => 'Str'
@@ -60,7 +66,6 @@ sub _build_bucket {
my $port = $self->port || 8091;
my $bucket = $self->bucket_name;
my $options = $self->options;
-
my $uri = 'http://' . $host . ':' . $port;
$self->_url($uri);
my $client = Net::Riak->new( host => $uri, %$options );
@@ -69,11 +74,36 @@ sub _build_bucket {
}
+sub load_schema {
+
+ my ($self, %args) = @_;
+ require Module::Pluggable;
+ my $shorten = delete $args{shorten};
+ my $search_path = delete $args{search_path};
+ Module::Pluggable->import ( search_path => $search_path );
+ for my $module ($self->plugins ) {
+ eval "require $module";
+ croak $@ if $@;
+ if ($shorten && $module =~ m/$search_path\:\:(.*?)$/ ) {
+ my $short_name = $1;
+
+ no strict 'refs';
+ *{ $short_name . "::" } = \*{ $module . "::" };
+ $short_name->meta->{kbr_schema_config} =
+ $module->meta->{kbr_schema_config};
+
+ }
+ }
+
+}
+
+
sub BUILD {
my ($self) = shift;
$self->bucket;
}
+
sub clear {
my $self = shift;
my $keys = $self->bucket->get_keys();
@@ -267,6 +297,10 @@ Searches using Solr interface to riak search. To search must prefix with data_ a
Nothing to do about Nothing
+=head2 load_schema
+
+Loads document schemas for quick use. Credited to authors of Mongoose library.
+
=head1 AUTHOR
Kartik Thakore, C<< <kthakore at cpan.org> >>

No commit comments for this range

Something went wrong with that request. Please try again.