AnyEvent-CouchDB

 view release on metacpan or  search on metacpan

lib/AnyEvent/CouchDB.pm  view on Meta::CPAN


This method requests an arrayref that contains the names of all the databases
hosted on the current CouchDB server.  It returns an AnyEvent condvar that
you'll be expected to call C<recv> on to get the data back.

=head3 $cv = $couch->info()

This method requests a hashref of info about the current CouchDB server and
returns a condvar that you should call C<recv> on.  The hashref that's returned
looks like this:

  {
    couchdb => 'Welcome',
    version => '0.7.3a658574'
  }

=head3 $cv = $couch->config()

This method requests a hashref of info regarding the configuration of the
current CouchDB server.  It returns a condvar that you should call C<recv> on.

=head3 $cv = $couch->replicate($source, $target, [ \%options ])

This method requests that a C<$source> CouchDB database be replicated to a
C<$target> CouchDB database.  To represent a local database, pass in just
the name of the database.  To represent a remote database, pass in the
URL to that database.  Note that both databases must already exist for
the replication to work. To create a continuous replication, set the
B<continuous> option to true.

B<Examples>:

  # local to local
  $couch->replicate('local_db', 'local_db_backup')->recv;

  # local to remote
  $couch->replicate('local_db', 'http://elsewhere/remote_db')->recv

  # remote to local
  $couch->replicate('http://elsewhere/remote_db', 'local_db')->recv

  # local to remote with continuous replication
  $couch->replicate('local_db', 'http://elsewhere/remote_db', {continuous => 1})->recv

As usual, this method returns a condvar that you're expected to call C<recv> on.
Doing this will return a hashref that looks something like this upon success:

  {
    history => [
      {
        docs_read       => 0,
        docs_written    => 0,
        end_last_seq    => 149,
        end_time        => "Thu, 17 Jul 2008 18:08:13 GMT",
        missing_checked => 44,
        missing_found   => 0,
        start_last_seq  => 0,
        start_time      => "Thu, 17 Jul 2008 18:08:13 GMT",
      },
    ],
    ok => bless(do { \(my $o = 1) }, "JSON::XS::Boolean"),
    session_id      => "cac3c6259b452c36230efe5b41259c04",
    source_last_seq => 149,
  }

=head1 SEE ALSO

=head2 Scripts

=over 4

=item L<couchdb-push>

Push documents from the filesystem to CouchDB

=back

=head2 Related Modules

L<AnyEvent::CouchDB::Database>, L<AnyEvent::CouchDB::Exceptions>,
L<AnyEvent::HTTP>, L<AnyEvent>, L<Exception::Class>

=head2 Other CouchDB-related Perl Modules

=head3 Client Libraries

L<Net::CouchDb>,
L<CouchDB::Client>,
L<POE::Component::CouchDB::Client>,
L<DB::CouchDB>

=head3 View Servers

L<CouchDB::View> - This lets you write your map/reduce functions in Perl
instead of JavaScript.

=head2 The Original JavaScript Version

L<http://svn.apache.org/repos/asf/couchdb/trunk/share/www/script/jquery.couch.js>

=head2 The GitHub Repository

L<http://github.com/beppu/anyevent-couchdb/tree/master>

=head2 The Antepenultimate CouchDB Reference Card

L<http://blog.fupps.com/2010/04/20/the-antepenultimate-couchdb-reference-card/>

=head2 The Reason for Existence

AnyEvent::CouchDB exists, because I needed a non-blocking CouchDB client that
I could use within L<Continuity> and L<Squatting>.

=head1 AUTHOR

John BEPPU E<lt>beppu@cpan.orgE<gt>

=head1 SPECIAL THANKS

Jan-Felix Wittman (for bug fixes, feature enhancements, and interesting couchdb discussion)



( run in 1.676 second using v1.01-cache-2.11-cpan-97f6503c9c8 )