AnyMongo
view release on metacpan or search on metacpan
mongo_support.h view on Meta::CPAN
#else
#define MONGO_32(b) (b)
#define MONGO_64(b) (b)
#endif
#define INT_32 4
#define INT_64 8
#define DOUBLE_64 8
#define BYTE_8 1
#define OID_SIZE 12
#define BSON_DOUBLE 1
#define BSON_STRING 2
#define BSON_OBJECT 3
#define BSON_ARRAY 4
#define BSON_BINARY 5
#define BSON_UNDEF 6
#define BSON_OID 7
#define BSON_BOOL 8
#define BSON_DATE 9
#define BSON_NULL 10
#define BSON_REGEX 11
#define BSON_DBREF 12
#define BSON_CODE__D 13
#define BSON_SYMBOL 14
#define BSON_CODE 15
#define BSON_INT 16
#define BSON_TIMESTAMP 17
#define BSON_LONG 18
#define BSON_MINKEY -1
#define BSON_MAXKEY 127
#define GROW_SLOWLY 1048576
#define MAX_OBJ_SIZE 1024*1024*4
typedef struct {
char *start;
char *pos;
char *end;
} buffer;
// struct for
typedef struct _stackette {
void *ptr;
struct _stackette *prev;
} stackette;
#define EMPTY_STACK 0
#define BUF_REMAINING (buf->end-buf->pos)
#define set_type(buf, type) perl_mongo_serialize_byte(buf, (char)type)
#define perl_mongo_serialize_null(buf) perl_mongo_serialize_byte(buf, (char)0)
#define perl_mongo_serialize_bool(buf, b) perl_mongo_serialize_byte(buf, (char)b)
void perl_mongo_call_xs (pTHX_ void (*subaddr) (pTHX_ CV *cv), CV *cv, SV **mark);
SV *perl_mongo_call_reader (SV *self, const char *reader);
SV *perl_mongo_call_method (SV *self, const char *method, int num, ...);
SV *perl_mongo_call_function (const char *func, int num, ...);
void perl_mongo_attach_ptr_to_instance (SV *self, void *ptr);
void *perl_mongo_get_ptr_from_instance (SV *self);
SV *perl_mongo_construct_instance (const char *klass, ...);
SV *perl_mongo_construct_instance_va (const char *klass, va_list ap);
SV *perl_mongo_construct_instance_with_magic (const char *klass, void *ptr, ...);
void perl_mongo_make_id(char *id);
void perl_mongo_make_oid(char* twelve, char *twenty4);
// serialization
SV *perl_mongo_bson_to_sv (buffer *buf);
void perl_mongo_sv_to_bson (buffer *buf, SV *sv, AV *ids);
int perl_mongo_resize_buf (buffer*, int);
void perl_mongo_serialize_key(buffer *buf, const char *str, int is_insert);
void perl_mongo_serialize_size(char*, buffer*);
void perl_mongo_serialize_double(buffer*, double);
void perl_mongo_serialize_string(buffer*, const char*, int);
void perl_mongo_serialize_long(buffer*, int64_t);
void perl_mongo_serialize_int(buffer*, int);
void perl_mongo_serialize_byte(buffer*, char);
void perl_mongo_serialize_bytes(buffer*, const char*, int);
// merge from original mongo_link.h
// db ops
#define OP_REPLY 1
#define OP_MSG 1000
#define OP_UPDATE 2001
#define OP_INSERT 2002
#define OP_GET_BY_OID 2003
#define OP_QUERY 2004
#define OP_GET_MORE 2005
#define OP_DELETE 2006
#define OP_KILL_CURSORS 2007
// cursor flags
#define CURSOR_NOT_FOUND 1
#define CURSOR_ERR 2
#define MSG_HEADER_SIZE 16
#define REPLY_HEADER_SIZE (MSG_HEADER_SIZE+20)
#define INITIAL_BUF_SIZE 4096
// should only be 4MB, can be 64MB with big docs
#define MAX_RESPONSE_LEN 67108864
#define DEFAULT_CHUNK_SIZE (256*1024)
// if _id field should be added
#define PREP 1
#define NO_PREP 0
#define CREATE_MSG_HEADER(rid, rto, opcode) \
header.length = 0; \
header.request_id = rid; \
header.response_to = rto; \
header.op = opcode;
#define CREATE_RESPONSE_HEADER(buf, ns, rto, opcode) \
CREATE_MSG_HEADER(SvIV(request_id), rto, opcode); \
APPEND_HEADER_NS(buf, ns, 0);
( run in 0.684 second using v1.01-cache-2.11-cpan-e1769b4cff6 )