oboe-heroku 0.8.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/LICENSE +199 -0
- data/README.md +6 -0
- data/Rakefile +3 -0
- data/ext/oboe_metal/extconf.rb +51 -0
- data/ext/oboe_metal/src/bson/bson.h +221 -0
- data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
- data/ext/oboe_metal/src/libs/.keep +0 -0
- data/ext/oboe_metal/src/libs/README +2 -0
- data/ext/oboe_metal/src/libs/libboost_date_time.so.1.53.0 +0 -0
- data/ext/oboe_metal/src/libs/libboost_system.so.1.53.0 +0 -0
- data/ext/oboe_metal/src/libs/libboost_thread.so.1.53.0 +0 -0
- data/ext/oboe_metal/src/libs/libevent-2.0.so.5.1.9 +0 -0
- data/ext/oboe_metal/src/libs/libfb303.so +0 -0
- data/ext/oboe_metal/src/libs/liboboe-1.0.so.1.3.1 +0 -0
- data/ext/oboe_metal/src/libs/liboboe.a +0 -0
- data/ext/oboe_metal/src/libs/liboboe.la +41 -0
- data/ext/oboe_metal/src/libs/libthrift-0.9.0.so +0 -0
- data/ext/oboe_metal/src/libs/libthrift.la +41 -0
- data/ext/oboe_metal/src/libs/libthriftnb-0.9.0.so +0 -0
- data/ext/oboe_metal/src/libs/libthriftnb.la +41 -0
- data/ext/oboe_metal/src/libs/libthriftz-0.9.0.so +0 -0
- data/ext/oboe_metal/src/libs/libthriftz.la +41 -0
- data/ext/oboe_metal/src/oboe.h +609 -0
- data/ext/oboe_metal/src/oboe.hpp +635 -0
- data/ext/oboe_metal/src/oboe_debug.h +46 -0
- data/ext/oboe_metal/src/oboe_wrap.cxx +4859 -0
- data/lib/heroku_metal.rb +111 -0
- data/lib/oboe-heroku/loading.rb +29 -0
- data/lib/oboe-heroku/version.rb +10 -0
- data/lib/oboe-heroku.rb +20 -0
- data/oboe-heroku.gemspec +21 -0
- data/tasks/.keep +0 -0
- metadata +97 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
AppNeta Open License, Version 1.0
|
2
|
+
|
3
|
+
AppNeta Open License
|
4
|
+
Version 1.0, April, 2013
|
5
|
+
|
6
|
+
http://www.appneta.com/appneta-license
|
7
|
+
|
8
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
9
|
+
|
10
|
+
1. Definitions.
|
11
|
+
|
12
|
+
"License" shall mean the terms and conditions for use, reproduction, and
|
13
|
+
distribution as defined by Sections 1 through 11 of this document.
|
14
|
+
|
15
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
16
|
+
owner that is granting the License. Licensor can include AppNeta as an
|
17
|
+
original contributor to the Work as defined below.
|
18
|
+
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities
|
20
|
+
that control, are controlled by, or are under common control with that entity.
|
21
|
+
For the purposes of this definition, "control" means (i) the power, direct or
|
22
|
+
indirect, to cause the direction or management of such entity, whether by
|
23
|
+
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
24
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
25
|
+
|
26
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
27
|
+
permissions granted by this License.
|
28
|
+
|
29
|
+
"Source" form shall mean the preferred form for making modifications, including
|
30
|
+
but not limited to software source code, documentation source, and
|
31
|
+
configuration files.
|
32
|
+
|
33
|
+
"Object" form shall mean any form resulting from mechanical transformation or
|
34
|
+
translation of a Source form, including but not limited to compiled object
|
35
|
+
code, generated documentation, and conversions to other media types.
|
36
|
+
|
37
|
+
"Work" shall mean the work of authorship, whether in Source or Object form,
|
38
|
+
made available under the License, as indicated by a copyright notice that is
|
39
|
+
included in or attached to the work (an example is provided in the Appendix
|
40
|
+
below).
|
41
|
+
|
42
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
43
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
44
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
45
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
46
|
+
shall not include works that remain separable from, or merely link (or bind by
|
47
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including the original
|
50
|
+
version of the Work and any modifications or additions to that Work or
|
51
|
+
Derivative Works thereof, that is intentionally submitted to Licensor for
|
52
|
+
inclusion in the Work by the copyright owner or by an individual or Legal
|
53
|
+
Entity authorized to submit on behalf of the copyright owner. For the purposes
|
54
|
+
of this definition, "submitted" means any form of electronic, verbal, or
|
55
|
+
written communication sent to the Licensor or its representatives, including
|
56
|
+
but not limited to communication on electronic mailing lists, source code
|
57
|
+
control systems, and issue tracking systems that are managed by, or on behalf
|
58
|
+
of, the Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise designated in
|
60
|
+
writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
63
|
+
of whom a Contribution has been received by Licensor and subsequently
|
64
|
+
incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License.
|
67
|
+
|
68
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
69
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
70
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the Work and
|
72
|
+
such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License.
|
75
|
+
|
76
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
77
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
78
|
+
irrevocable (except as stated in this section) patent license to make, have
|
79
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
80
|
+
such license applies only to those patent claims licensable by such Contributor
|
81
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
82
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
83
|
+
submitted. If You institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
85
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
86
|
+
patent infringement, then any patent licenses granted to You under this License
|
87
|
+
for that Work shall terminate as of the date such litigation is filed.
|
88
|
+
|
89
|
+
Each time You convey a covered Work, the recipient automatically receives a
|
90
|
+
license from the original Licensor(s), to run, modify and propagate that work,
|
91
|
+
subject to this License. You are not responsible for enforcing compliance by
|
92
|
+
third parties with this License.
|
93
|
+
|
94
|
+
You may not impose any further restrictions on the exercise of the rights
|
95
|
+
granted or affirmed under this License. For example, you may not impose a
|
96
|
+
license fee, royalty, or other charge for exercise of rights granted under this
|
97
|
+
License, and you may not initiate litigation (including a cross-claim or
|
98
|
+
counterclaim in a lawsuit) alleging that any patent claim is infringed by
|
99
|
+
making, using, selling, offering for sale, or importing the Work or any portion
|
100
|
+
of it.
|
101
|
+
|
102
|
+
4. Redistribution.
|
103
|
+
|
104
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
105
|
+
in any medium, with or without modifications, and in Source or Object form,
|
106
|
+
provided that You meet the following conditions:
|
107
|
+
|
108
|
+
1. You must give any other recipients of the Work or Derivative Works a copy
|
109
|
+
of this License; and
|
110
|
+
2. You must cause any modified files to carry prominent notices stating that
|
111
|
+
You changed the files; and
|
112
|
+
3. You must retain, in the Source form of any Derivative Works that You
|
113
|
+
distribute, all copyright, patent, trademark, and attribution notices from the
|
114
|
+
Source form of the Work, excluding those notices that do not pertain to any
|
115
|
+
part of the Derivative Works; and
|
116
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution,
|
117
|
+
then any Derivative Works that You distribute must include a readable copy of
|
118
|
+
the attribution notices contained within such NOTICE file, excluding those
|
119
|
+
notices that do not pertain to any part of the Derivative Works, in at least
|
120
|
+
one of the following places: within a NOTICE text file distributed as part of
|
121
|
+
the Derivative Works; within the Source form or documentation, if provided
|
122
|
+
along with the Derivative Works; or, within a display generated by the
|
123
|
+
Derivative Works, if and wherever such third-party notices normally appear. The
|
124
|
+
contents of the NOTICE file are for informational purposes only and do not
|
125
|
+
modify the License. You may add Your own attribution notices within Derivative
|
126
|
+
Works that You distribute, alongside or as an addendum to the NOTICE text from
|
127
|
+
the Work, provided that such additional attribution notices cannot be construed
|
128
|
+
as modifying the License.
|
129
|
+
|
130
|
+
You may add Your own copyright statement to Your modifications and may provide
|
131
|
+
additional or different license terms and conditions for use, reproduction, or
|
132
|
+
distribution of Your modifications, or for any such Derivative Works as a
|
133
|
+
whole, provided Your use, reproduction, and distribution of the Work otherwise
|
134
|
+
complies with the conditions stated in this License.
|
135
|
+
|
136
|
+
5. Submission of Contributions.
|
137
|
+
|
138
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
139
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
140
|
+
conditions of this License, without any additional terms or conditions.
|
141
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms
|
142
|
+
of any separate license agreement you may have executed with Licensor regarding
|
143
|
+
such Contributions.
|
144
|
+
|
145
|
+
6. Trademarks.
|
146
|
+
|
147
|
+
This License does not grant permission to use the trade names, trademarks,
|
148
|
+
service marks, or product names of the Licensor, except as required for
|
149
|
+
reasonable and customary use in describing the origin of the Work and
|
150
|
+
reproducing the content of the NOTICE file.
|
151
|
+
|
152
|
+
7. Disclaimer of Warranty.
|
153
|
+
|
154
|
+
Unless required by applicable law or agreed to in writing, Licensor provides
|
155
|
+
the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
156
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
157
|
+
including, without limitation, any warranties or conditions of TITLE,
|
158
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
159
|
+
solely responsible for determining the appropriateness of using or
|
160
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
161
|
+
permissions under this License.
|
162
|
+
|
163
|
+
8. Limitation of Liability.
|
164
|
+
|
165
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
166
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
167
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
168
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
169
|
+
or consequential damages of any character arising as a result of this License
|
170
|
+
or out of the use or inability to use the Work (including but not limited to
|
171
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction,
|
172
|
+
or any and all other commercial damages or losses), even if such Contributor
|
173
|
+
has been advised of the possibility of such damages.
|
174
|
+
|
175
|
+
9. Accepting Warranty or Additional Liability.
|
176
|
+
|
177
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
178
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
179
|
+
other liability obligations and/or rights consistent with this License.
|
180
|
+
However, in accepting such obligations, You may act only on Your own behalf and
|
181
|
+
on Your sole responsibility, not on behalf of any other Contributor, and only
|
182
|
+
if You agree to indemnify, defend, and hold each Contributor harmless for any
|
183
|
+
liability incurred by, or claims asserted against, such Contributor by reason
|
184
|
+
of your accepting any such warranty or additional liability.
|
185
|
+
|
186
|
+
10. Noncompetition
|
187
|
+
|
188
|
+
You may install and execute the Work only in conjunction with the direct use of
|
189
|
+
AppNeta software. This Work, any file or any derivative thereof shall not be
|
190
|
+
used in conjunction with any product that competes with any AppNeta software.
|
191
|
+
|
192
|
+
11. Termination
|
193
|
+
|
194
|
+
The License stated above is automatically terminated and revoked if you exceed
|
195
|
+
its scope or violate any of the terms of this License or any related License or
|
196
|
+
notice.
|
197
|
+
|
198
|
+
END OF TERMS AND CONDITIONS
|
199
|
+
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Copyright (c) 2012 by Tracelytics, Inc.
|
2
|
+
# All rights reserved.
|
3
|
+
|
4
|
+
require 'mkmf'
|
5
|
+
require "../../lib/oboe-heroku/version"
|
6
|
+
|
7
|
+
dir_config('oboe', nil, './src/libs')
|
8
|
+
|
9
|
+
# Symlinks aren't supported in gems (it packages originals) so to keep
|
10
|
+
# the gem size manageable we create the symlinks here on the fly.
|
11
|
+
pwd = Dir.pwd
|
12
|
+
Dir.chdir './src/libs'
|
13
|
+
File.symlink('libboost_date_time.so.1.53.0', 'libboost_date_time.so') unless File.symlink?('libboost_date_time.so')
|
14
|
+
File.symlink('libboost_system.so.1.53.0', 'libboost_system.so') unless File.symlink?('libboost_system.so')
|
15
|
+
File.symlink('libboost_thread.so.1.53.0', 'libboost_thread.so') unless File.symlink?('libboost_thread.so')
|
16
|
+
File.symlink('libevent-2.0.so.5.1.9', 'libevent-2.0.so.5') unless File.symlink?('libevent-2.0.so.5')
|
17
|
+
File.symlink('libevent-2.0.so.5', 'libevent.so') unless File.symlink?('libevent.so')
|
18
|
+
File.symlink('liboboe-1.0.so.1.3.1', 'liboboe-1.0.so.1') unless File.symlink?('liboboe-1.0.so.1')
|
19
|
+
File.symlink('liboboe-1.0.so.1.3.1', 'liboboe.so') unless File.symlink?('liboboe.so')
|
20
|
+
File.symlink('libthrift-0.9.0.so', 'libthrift.so') unless File.symlink?('libthrift.so')
|
21
|
+
File.symlink('libthriftnb-0.9.0.so', 'libthriftnb.so') unless File.symlink?('libthriftnb.so')
|
22
|
+
File.symlink('libthriftz-0.9.0.so', 'libthriftz.so') unless File.symlink?('libthriftz.so')
|
23
|
+
Dir.chdir pwd
|
24
|
+
|
25
|
+
$libs = append_library($libs, "stdc++")
|
26
|
+
$libs = append_library($libs, "oboe")
|
27
|
+
$libs = append_library($libs, "boost_system")
|
28
|
+
$libs = append_library($libs, "boost_date_time")
|
29
|
+
$libs = append_library($libs, "fb303")
|
30
|
+
$libs = append_library($libs, "thrift")
|
31
|
+
$libs = append_library($libs, "thriftnb")
|
32
|
+
$libs = append_library($libs, "thriftz")
|
33
|
+
$libs = append_library($libs, "event")
|
34
|
+
|
35
|
+
# FIXME: Static path hack
|
36
|
+
# This is used to get around Heroku's temporary area build pack
|
37
|
+
# compilation process. We use this path to supply to ld rpath
|
38
|
+
# so that bundled libraries can be linked dynamically at runtime.
|
39
|
+
# The alternative to this would be to set LD_LIBRARY_PATH
|
40
|
+
# in the application which can be risky since we bundle
|
41
|
+
# a couple common libraries such as libevent.
|
42
|
+
static_lib_path = "/app/vendor/bundle/ruby/#{Gem::ConfigMap[:ruby_version]}/gems/oboe-heroku-#{OboeHeroku::Version::STRING}/ext/oboe_metal/src/libs"
|
43
|
+
|
44
|
+
$CFLAGS << " #{ENV["CFLAGS"]}"
|
45
|
+
$CPPFLAGS << " #{ENV["CPPFLAGS"]}"
|
46
|
+
$LIBS << " #{ENV["LIBS"]}"
|
47
|
+
$LDFLAGS << " #{ENV["LDFLAGS"]} -Wl,-rpath,#{static_lib_path}"
|
48
|
+
|
49
|
+
cpp_command('g++') if RUBY_VERSION < '1.9'
|
50
|
+
create_makefile('oboe_metal', 'src')
|
51
|
+
|
@@ -0,0 +1,221 @@
|
|
1
|
+
/* bson.h */
|
2
|
+
|
3
|
+
/* Copyright 2009, 2010 10gen Inc.
|
4
|
+
*
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
* you may not use this file except in compliance with the License.
|
7
|
+
* You may obtain a copy of the License at
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
* See the License for the specific language governing permissions and
|
15
|
+
* limitations under the License.
|
16
|
+
*/
|
17
|
+
|
18
|
+
#ifndef _BSON_H_
|
19
|
+
#define _BSON_H_
|
20
|
+
|
21
|
+
#define MONGO_HAVE_STDINT
|
22
|
+
#include "platform_hacks.h"
|
23
|
+
#include <time.h>
|
24
|
+
|
25
|
+
MONGO_EXTERN_C_START
|
26
|
+
|
27
|
+
typedef enum {
|
28
|
+
bson_error=-1,
|
29
|
+
bson_eoo=0,
|
30
|
+
bson_double=1,
|
31
|
+
bson_string=2,
|
32
|
+
bson_object=3,
|
33
|
+
bson_array=4,
|
34
|
+
bson_bindata=5,
|
35
|
+
bson_undefined=6,
|
36
|
+
bson_oid=7,
|
37
|
+
bson_bool=8,
|
38
|
+
bson_date=9,
|
39
|
+
bson_null=10,
|
40
|
+
bson_regex=11,
|
41
|
+
bson_dbref=12, /* deprecated */
|
42
|
+
bson_code=13,
|
43
|
+
bson_symbol=14,
|
44
|
+
bson_codewscope=15,
|
45
|
+
bson_int = 16,
|
46
|
+
bson_timestamp = 17,
|
47
|
+
bson_long = 18
|
48
|
+
} bson_type;
|
49
|
+
|
50
|
+
typedef int bson_bool_t;
|
51
|
+
|
52
|
+
typedef struct {
|
53
|
+
char * data;
|
54
|
+
bson_bool_t owned;
|
55
|
+
} bson;
|
56
|
+
|
57
|
+
typedef struct {
|
58
|
+
const char * cur;
|
59
|
+
bson_bool_t first;
|
60
|
+
} bson_iterator;
|
61
|
+
|
62
|
+
typedef struct {
|
63
|
+
char * buf;
|
64
|
+
char * cur;
|
65
|
+
int bufSize;
|
66
|
+
bson_bool_t finished;
|
67
|
+
int stack[32];
|
68
|
+
int stackPos;
|
69
|
+
} bson_buffer;
|
70
|
+
|
71
|
+
#pragma pack(1)
|
72
|
+
typedef union{
|
73
|
+
char bytes[12];
|
74
|
+
int ints[3];
|
75
|
+
} bson_oid_t;
|
76
|
+
#pragma pack()
|
77
|
+
|
78
|
+
typedef int64_t bson_date_t; /* milliseconds since epoch UTC */
|
79
|
+
|
80
|
+
/* ----------------------------
|
81
|
+
READING
|
82
|
+
------------------------------ */
|
83
|
+
|
84
|
+
|
85
|
+
bson * bson_empty(bson * obj); /* returns pointer to static empty bson object */
|
86
|
+
int bson_copy(bson* out, const bson* in); /* puts data in new buffer. NOOP if out==NULL */
|
87
|
+
bson * bson_from_buffer(bson * b, bson_buffer * buf);
|
88
|
+
bson * bson_init( bson * b , char * data , bson_bool_t mine );
|
89
|
+
bson * bson_init_safe( bson * b , char * data , bson_bool_t mine , size_t buflen);
|
90
|
+
int bson_size(const bson * b );
|
91
|
+
void bson_destroy( bson * b );
|
92
|
+
|
93
|
+
void bson_print( bson * b );
|
94
|
+
void bson_print_raw( const char * bson , int depth );
|
95
|
+
|
96
|
+
/* advances iterator to named field */
|
97
|
+
/* returns bson_eoo (which is false) if field not found */
|
98
|
+
bson_type bson_find(bson_iterator* it, const bson* obj, const char* name);
|
99
|
+
|
100
|
+
void bson_iterator_init( bson_iterator * i , const char * bson );
|
101
|
+
|
102
|
+
/* more returns true for eoo. best to loop with bson_iterator_next(&it) */
|
103
|
+
bson_bool_t bson_iterator_more( const bson_iterator * i );
|
104
|
+
bson_type bson_iterator_next( bson_iterator * i );
|
105
|
+
|
106
|
+
bson_type bson_iterator_type( const bson_iterator * i );
|
107
|
+
const char * bson_iterator_key( const bson_iterator * i );
|
108
|
+
const char * bson_iterator_value( const bson_iterator * i );
|
109
|
+
|
110
|
+
/* these convert to the right type (return 0 if non-numeric) */
|
111
|
+
double bson_iterator_double( const bson_iterator * i );
|
112
|
+
int bson_iterator_int( const bson_iterator * i );
|
113
|
+
int64_t bson_iterator_long( const bson_iterator * i );
|
114
|
+
|
115
|
+
/* false: boolean false, 0 in any type, or null */
|
116
|
+
/* true: anything else (even empty strings and objects) */
|
117
|
+
bson_bool_t bson_iterator_bool( const bson_iterator * i );
|
118
|
+
|
119
|
+
/* these assume you are using the right type */
|
120
|
+
double bson_iterator_double_raw( const bson_iterator * i );
|
121
|
+
int bson_iterator_int_raw( const bson_iterator * i );
|
122
|
+
int64_t bson_iterator_long_raw( const bson_iterator * i );
|
123
|
+
bson_bool_t bson_iterator_bool_raw( const bson_iterator * i );
|
124
|
+
bson_oid_t* bson_iterator_oid( const bson_iterator * i );
|
125
|
+
|
126
|
+
/* these can also be used with bson_code and bson_symbol*/
|
127
|
+
const char * bson_iterator_string( const bson_iterator * i );
|
128
|
+
int bson_iterator_string_len( const bson_iterator * i );
|
129
|
+
|
130
|
+
/* works with bson_code, bson_codewscope, and bson_string */
|
131
|
+
/* returns NULL for everything else */
|
132
|
+
const char * bson_iterator_code(const bson_iterator * i);
|
133
|
+
|
134
|
+
/* calls bson_empty on scope if not a bson_codewscope */
|
135
|
+
void bson_iterator_code_scope(const bson_iterator * i, bson * scope);
|
136
|
+
|
137
|
+
/* both of these only work with bson_date */
|
138
|
+
bson_date_t bson_iterator_date(const bson_iterator * i);
|
139
|
+
time_t bson_iterator_time_t(const bson_iterator * i);
|
140
|
+
|
141
|
+
int bson_iterator_bin_len( const bson_iterator * i );
|
142
|
+
char bson_iterator_bin_type( const bson_iterator * i );
|
143
|
+
const char * bson_iterator_bin_data( const bson_iterator * i );
|
144
|
+
|
145
|
+
const char * bson_iterator_regex( const bson_iterator * i );
|
146
|
+
const char * bson_iterator_regex_opts( const bson_iterator * i );
|
147
|
+
|
148
|
+
/* these work with bson_object and bson_array */
|
149
|
+
void bson_iterator_subobject(const bson_iterator * i, bson * sub);
|
150
|
+
void bson_iterator_subiterator(const bson_iterator * i, bson_iterator * sub);
|
151
|
+
|
152
|
+
/* str must be at least 24 hex chars + null byte */
|
153
|
+
void bson_oid_from_string(bson_oid_t* oid, const char* str);
|
154
|
+
void bson_oid_to_string(const bson_oid_t* oid, char* str);
|
155
|
+
void bson_oid_gen(bson_oid_t* oid);
|
156
|
+
|
157
|
+
time_t bson_oid_generated_time(bson_oid_t* oid); /* Gives the time the OID was created */
|
158
|
+
|
159
|
+
/* ----------------------------
|
160
|
+
BUILDING
|
161
|
+
------------------------------ */
|
162
|
+
|
163
|
+
bson_buffer * bson_buffer_init( bson_buffer * b );
|
164
|
+
bson_buffer * bson_ensure_space( bson_buffer * b , const int bytesNeeded );
|
165
|
+
|
166
|
+
/**
|
167
|
+
* @return the raw data. you either should free this OR call bson_destroy not both
|
168
|
+
*/
|
169
|
+
char * bson_buffer_finish( bson_buffer * b );
|
170
|
+
void bson_buffer_destroy( bson_buffer * b );
|
171
|
+
|
172
|
+
bson_buffer * bson_append_oid( bson_buffer * b , const char * name , const bson_oid_t* oid );
|
173
|
+
bson_buffer * bson_append_new_oid( bson_buffer * b , const char * name );
|
174
|
+
bson_buffer * bson_append_int( bson_buffer * b , const char * name , const int i );
|
175
|
+
bson_buffer * bson_append_long( bson_buffer * b , const char * name , const int64_t i );
|
176
|
+
bson_buffer * bson_append_double( bson_buffer * b , const char * name , const double d );
|
177
|
+
bson_buffer * bson_append_string( bson_buffer * b , const char * name , const char * str );
|
178
|
+
bson_buffer * bson_append_symbol( bson_buffer * b , const char * name , const char * str );
|
179
|
+
bson_buffer * bson_append_code( bson_buffer * b , const char * name , const char * str );
|
180
|
+
bson_buffer * bson_append_code_w_scope( bson_buffer * b , const char * name , const char * code , const bson * scope);
|
181
|
+
bson_buffer * bson_append_binary( bson_buffer * b, const char * name, char type, const char * str, int len );
|
182
|
+
bson_buffer * bson_append_bool( bson_buffer * b , const char * name , const bson_bool_t v );
|
183
|
+
bson_buffer * bson_append_null( bson_buffer * b , const char * name );
|
184
|
+
bson_buffer * bson_append_undefined( bson_buffer * b , const char * name );
|
185
|
+
bson_buffer * bson_append_regex( bson_buffer * b , const char * name , const char * pattern, const char * opts );
|
186
|
+
bson_buffer * bson_append_bson( bson_buffer * b , const char * name , const bson* bson);
|
187
|
+
bson_buffer * bson_append_element( bson_buffer * b, const char * name_or_null, const bson_iterator* elem);
|
188
|
+
|
189
|
+
/* these both append a bson_date */
|
190
|
+
bson_buffer * bson_append_date(bson_buffer * b, const char * name, bson_date_t millis);
|
191
|
+
bson_buffer * bson_append_time_t(bson_buffer * b, const char * name, time_t secs);
|
192
|
+
|
193
|
+
bson_buffer * bson_append_start_object( bson_buffer * b , const char * name );
|
194
|
+
bson_buffer * bson_append_start_array( bson_buffer * b , const char * name );
|
195
|
+
bson_buffer * bson_append_finish_object( bson_buffer * b );
|
196
|
+
|
197
|
+
void bson_numstr(char* str, int i);
|
198
|
+
void bson_incnumstr(char* str);
|
199
|
+
|
200
|
+
|
201
|
+
/* ------------------------------
|
202
|
+
ERROR HANDLING - also used in mongo code
|
203
|
+
------------------------------ */
|
204
|
+
|
205
|
+
void * bson_malloc(int size); /* checks return value */
|
206
|
+
|
207
|
+
/* bson_err_handlers shouldn't return!!! */
|
208
|
+
typedef void(*bson_err_handler)(const char* errmsg);
|
209
|
+
|
210
|
+
/* returns old handler or NULL */
|
211
|
+
/* default handler prints error then exits with failure*/
|
212
|
+
bson_err_handler set_bson_err_handler(bson_err_handler func);
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
/* does nothing is ok != 0 */
|
217
|
+
void bson_fatal( int ok );
|
218
|
+
int bson_fatal_msg( int ok, const char* msg );
|
219
|
+
|
220
|
+
MONGO_EXTERN_C_END
|
221
|
+
#endif
|
@@ -0,0 +1,91 @@
|
|
1
|
+
/* platform_hacks.h */
|
2
|
+
/* Copyright 2009, 2010 10gen Inc.
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
|
18
|
+
/* all platform-specific ifdefs should go here */
|
19
|
+
|
20
|
+
#ifndef _PLATFORM_HACKS_H_
|
21
|
+
#define _PLATFORM_HACKS_H_
|
22
|
+
|
23
|
+
#ifdef __GNUC__
|
24
|
+
#define MONGO_INLINE static __inline__
|
25
|
+
#else
|
26
|
+
#define MONGO_INLINE static
|
27
|
+
#endif
|
28
|
+
|
29
|
+
#ifdef __cplusplus
|
30
|
+
#define MONGO_EXTERN_C_START extern "C" {
|
31
|
+
#define MONGO_EXTERN_C_END }
|
32
|
+
#else
|
33
|
+
#define MONGO_EXTERN_C_START
|
34
|
+
#define MONGO_EXTERN_C_END
|
35
|
+
#endif
|
36
|
+
|
37
|
+
|
38
|
+
#if defined(MONGO_HAVE_STDINT) || __STDC_VERSION__ >= 199901L
|
39
|
+
#include <stdint.h>
|
40
|
+
#elif defined(MONGO_HAVE_UNISTD)
|
41
|
+
#include <unistd.h>
|
42
|
+
#elif defined(MONGO_USE__INT64)
|
43
|
+
typedef __int64 int64_t;
|
44
|
+
#elif defined(MONGO_USE_LONG_LONG_INT)
|
45
|
+
typedef long long int int64_t;
|
46
|
+
#else
|
47
|
+
#error must have a 64bit int type
|
48
|
+
#endif
|
49
|
+
|
50
|
+
/* big endian is only used for OID generation. little is used everywhere else */
|
51
|
+
#ifdef MONGO_BIG_ENDIAN
|
52
|
+
#define bson_little_endian64(out, in) ( bson_swap_endian64(out, in) )
|
53
|
+
#define bson_little_endian32(out, in) ( bson_swap_endian32(out, in) )
|
54
|
+
#define bson_big_endian64(out, in) ( memcpy(out, in, 8) )
|
55
|
+
#define bson_big_endian32(out, in) ( memcpy(out, in, 4) )
|
56
|
+
#else
|
57
|
+
#define bson_little_endian64(out, in) ( memcpy(out, in, 8) )
|
58
|
+
#define bson_little_endian32(out, in) ( memcpy(out, in, 4) )
|
59
|
+
#define bson_big_endian64(out, in) ( bson_swap_endian64(out, in) )
|
60
|
+
#define bson_big_endian32(out, in) ( bson_swap_endian32(out, in) )
|
61
|
+
#endif
|
62
|
+
|
63
|
+
MONGO_EXTERN_C_START
|
64
|
+
|
65
|
+
MONGO_INLINE void bson_swap_endian64(void* outp, const void* inp){
|
66
|
+
const char *in = (const char*)inp;
|
67
|
+
char *out = (char*)outp;
|
68
|
+
|
69
|
+
out[0] = in[7];
|
70
|
+
out[1] = in[6];
|
71
|
+
out[2] = in[5];
|
72
|
+
out[3] = in[4];
|
73
|
+
out[4] = in[3];
|
74
|
+
out[5] = in[2];
|
75
|
+
out[6] = in[1];
|
76
|
+
out[7] = in[0];
|
77
|
+
|
78
|
+
}
|
79
|
+
MONGO_INLINE void bson_swap_endian32(void* outp, const void* inp){
|
80
|
+
const char *in = (const char*)inp;
|
81
|
+
char *out = (char*)outp;
|
82
|
+
|
83
|
+
out[0] = in[3];
|
84
|
+
out[1] = in[2];
|
85
|
+
out[2] = in[1];
|
86
|
+
out[3] = in[0];
|
87
|
+
}
|
88
|
+
|
89
|
+
MONGO_EXTERN_C_END
|
90
|
+
|
91
|
+
#endif
|
File without changes
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# liboboe.la - a libtool library file
|
2
|
+
# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
|
3
|
+
#
|
4
|
+
# Please DO NOT delete this file!
|
5
|
+
# It is necessary for linking the library.
|
6
|
+
|
7
|
+
# The name that we can dlopen(3).
|
8
|
+
dlname='liboboe-1.0.so.1'
|
9
|
+
|
10
|
+
# Names of this library.
|
11
|
+
library_names='liboboe-1.0.so.1.3.1 liboboe-1.0.so.1 liboboe.so'
|
12
|
+
|
13
|
+
# The name of the static archive.
|
14
|
+
old_library='liboboe.a'
|
15
|
+
|
16
|
+
# Linker flags that can not go in dependency_libs.
|
17
|
+
inherited_linker_flags=''
|
18
|
+
|
19
|
+
# Libraries that this one depends upon.
|
20
|
+
dependency_libs=' -levent -L/tmp/local/lib -lfb303 /tmp/local/lib/libthrift.la /tmp/local/lib/libthriftnb.la /tmp/local/lib/libthriftz.la -lssl -lboost_thread -lboost_date_time -lpthread -lcrypto /tmp/local/lib/libevent.la -lrt'
|
21
|
+
|
22
|
+
# Names of additional weak libraries provided by this library
|
23
|
+
weak_library_names=''
|
24
|
+
|
25
|
+
# Version information for liboboe.
|
26
|
+
current=4
|
27
|
+
age=3
|
28
|
+
revision=1
|
29
|
+
|
30
|
+
# Is this an already installed library?
|
31
|
+
installed=yes
|
32
|
+
|
33
|
+
# Should we warn about portability when linking against -modules?
|
34
|
+
shouldnotlink=no
|
35
|
+
|
36
|
+
# Files to dlopen/dlpreopen
|
37
|
+
dlopen=''
|
38
|
+
dlpreopen=''
|
39
|
+
|
40
|
+
# Directory that this library needs to be installed in:
|
41
|
+
libdir='/tmp/local/lib'
|
Binary file
|