AnyMongo
view release on metacpan or search on metacpan
lib/AnyMongo/Connection.pm view on Meta::CPAN
package AnyMongo::Connection;
BEGIN {
$AnyMongo::Connection::VERSION = '0.03';
}
# ABSTRACT: Asynchronous MongoDB::Connection
use strict;
use warnings;
use constant {
DEBUG => $ENV{ANYMONGO_DEBUG},
# bson type
BSON_INT32 => 4,
BSON_INT64 => 8,
# msg header size
STANDARD_HEADER_SIZE => 16,
RESPONSE_HEADER_SIZE => 20,
# opcode
OP_REPLY => 1,
OP_MSG => 1000, #generic msg command followed by a string
OP_UPDATE => 2001, #update document
OP_INSERT => 2002, #insert new document
RESERVED => 2003, #formerly used for OP_GET_BY_OID
OP_QUERY => 2004, #query a collection
OP_GET_MORE => 2005, #Get more data from a query. See Cursors
OP_DELETE => 2006, #Delete documents
OP_KILL_CURSORS => 2007,
# flags
REPLY_CURSOR_NOT_FOUND => 1,
REPLY_QUERY_FAILURE => 2,
REPLY_SHARD_CONFIG_STALE => 4,
REPLY_AWAIT_CAPABLE => 8,
};
use Carp qw(croak);
use Data::Dumper;
use AnyEvent::Socket;
use AnyEvent::Handle;
use AnyMongo::BSON qw(bson_decode);
use AnyMongo::MongoSupport qw(decode_bson_documents);
use AnyMongo::Cursor;
use namespace::autoclean;
use Any::Moose;
has find_master => (
is => 'ro',
isa => 'Bool',
required => 1,
default => 0,
);
has master_handle => (
isa => 'Maybe[AnyEvent::Handle]',
is => 'rw',
clearer => 'clear_master_handle',
);
has secondary_nodes => (
isa => 'ArrayRef',
is => 'rw',
);
has secondary_nodes => (
isa => 'ArrayRef',
is => 'rw',
lazy_build => 1,
clearer => 'clear_secondary_nodes',
);
sub _build_secondary_nodes {
my ($self) = @_;
[];
}
has arbitor_nodes => (
isa => 'ArrayRef',
is => 'rw',
lazy_build => 1,
clearer => 'clear_arbitor_nodes',
);
sub _build_arbitor_nodes {
my ($self) = @_;
[];
}
has ts => (
is => 'rw',
isa => 'Int',
default => 0
);
has db_name => (
is => 'rw',
isa => 'Str',
( run in 0.505 second using v1.01-cache-2.11-cpan-39bf76dae61 )