diff options
| author | Robin Edwards <robin.ge@gmail.com> | 2011-04-20 14:38:43 +0100 |
|---|---|---|
| committer | Robin Edwards <robin.ge@gmail.com> | 2011-04-20 14:38:43 +0100 |
| commit | 79bea382fd2c0753ca9ace79a11bb74c9a1d722b (patch) | |
| tree | bde42a47792a27e0a863ee527b88c8c24258f7e9 /lib/Net/Riak/Role/PBC/Link.pm | |
| parent | Merge remote branch 'simon/fix_link_encoding' (diff) | |
| download | net-riak-79bea382fd2c0753ca9ace79a11bb74c9a1d722b.tar.gz | |
merged pbc branch to master
Diffstat (limited to 'lib/Net/Riak/Role/PBC/Link.pm')
| -rw-r--r-- | lib/Net/Riak/Role/PBC/Link.pm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/Net/Riak/Role/PBC/Link.pm b/lib/Net/Riak/Role/PBC/Link.pm new file mode 100644 index 0000000..5e6a336 --- /dev/null +++ b/lib/Net/Riak/Role/PBC/Link.pm @@ -0,0 +1,35 @@ +package Net::Riak::Role::PBC::Link; +use Moose::Role; +use Net::Riak::Link; +use Net::Riak::Bucket; + +sub _populate_links { + my ($self, $object, $links) = @_; + + for my $link (@$links) { + my $l = Net::Riak::Link->new( + bucket => Net::Riak::Bucket->new( + name => $link->bucket, + client => $self + ), + key => $link->key, + tag => $link->tag + ); + $object->add_link($l); + } +} + +sub _links_for_message { + my ($self, $object) = @_; + + return [ + map { { + tag => $_->tag, + key => $_->key, + bucket => $_->bucket->name + } + } $object->all_links + ] +} + +1; |
