bson 4.9.2 → 4.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/ext/bson/bson-native.h +2 -0
- data/ext/bson/init.c +51 -22
- data/ext/bson/read.c +35 -12
- data/ext/bson/write.c +42 -3
- data/lib/bson/array.rb +3 -0
- data/lib/bson/date_time.rb +1 -1
- data/lib/bson/error.rb +6 -0
- data/lib/bson/hash.rb +3 -0
- data/lib/bson/timestamp.rb +4 -4
- data/lib/bson/version.rb +1 -1
- data/lib/bson_native.bundle +0 -0
- data/spec/bson/array_spec.rb +17 -0
- data/spec/bson/byte_buffer_read_spec.rb +59 -3
- data/spec/bson/byte_buffer_spec.rb +10 -7
- data/spec/bson/byte_buffer_write_spec.rb +96 -0
- data/spec/bson/date_time_spec.rb +53 -0
- data/spec/bson/hash_spec.rb +17 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/spec_tests/data/corpus/timestamp.json +10 -0
- data/spec/spec_tests/data/corpus/top.json +3 -3
- data/spec/support/spec_config.rb +6 -0
- metadata +97 -96
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e39811e4c57495904b3efdb835093609b89e3eea90bc5c493c56bc3adf803a29
|
4
|
+
data.tar.gz: ac5ca45bcfe81e133931420591d8c866b674912138cbcc5de36edfb94d0ee2ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a9d6eb3a581073ba8de7bf5d718d2368426841ea6681d82bb771239759aa62038c281c596caf853e898d00af7549b96e1b5f48e3b04a04ff652e93f94f8c5f3
|
7
|
+
data.tar.gz: f7f4b93b14c632ce2b70211bbb879b24a0e65cc2f4bdf430b75d88c9f6b994f931ce8fdd1021dbd987b52ce634972a0155dc0468caca22bb4264a60a7c2b895d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/ext/bson/bson-native.h
CHANGED
@@ -76,6 +76,7 @@ VALUE rb_bson_byte_buffer_get_cstring(VALUE self);
|
|
76
76
|
VALUE rb_bson_byte_buffer_get_decimal128_bytes(VALUE self);
|
77
77
|
VALUE rb_bson_byte_buffer_get_double(VALUE self);
|
78
78
|
VALUE rb_bson_byte_buffer_get_int32(VALUE self);
|
79
|
+
VALUE rb_bson_byte_buffer_get_uint32(VALUE self);
|
79
80
|
VALUE rb_bson_byte_buffer_get_int64(VALUE self);
|
80
81
|
VALUE rb_bson_byte_buffer_get_string(VALUE self);
|
81
82
|
VALUE rb_bson_byte_buffer_get_hash(int argc, VALUE *argv, VALUE self);
|
@@ -86,6 +87,7 @@ VALUE rb_bson_byte_buffer_put_cstring(VALUE self, VALUE string);
|
|
86
87
|
VALUE rb_bson_byte_buffer_put_decimal128(VALUE self, VALUE low, VALUE high);
|
87
88
|
VALUE rb_bson_byte_buffer_put_double(VALUE self, VALUE f);
|
88
89
|
VALUE rb_bson_byte_buffer_put_int32(VALUE self, VALUE i);
|
90
|
+
VALUE rb_bson_byte_buffer_put_uint32(VALUE self, VALUE i);
|
89
91
|
VALUE rb_bson_byte_buffer_put_int64(VALUE self, VALUE i);
|
90
92
|
VALUE rb_bson_byte_buffer_put_string(VALUE self, VALUE string);
|
91
93
|
VALUE rb_bson_byte_buffer_put_symbol(VALUE self, VALUE symbol);
|
data/ext/bson/init.c
CHANGED
@@ -38,25 +38,26 @@ void Init_bson_native()
|
|
38
38
|
char rb_bson_machine_id[256];
|
39
39
|
|
40
40
|
VALUE rb_bson_module = rb_define_module("BSON");
|
41
|
-
|
41
|
+
|
42
42
|
/* Document-class: BSON::ByteBuffer
|
43
43
|
*
|
44
44
|
* Stores BSON-serialized data and provides efficient serialization and
|
45
45
|
* deserialization of common Ruby classes using native code.
|
46
46
|
*/
|
47
47
|
VALUE rb_byte_buffer_class = rb_define_class_under(rb_bson_module, "ByteBuffer", rb_cObject);
|
48
|
-
|
48
|
+
|
49
49
|
VALUE rb_bson_object_id_class = rb_const_get(rb_bson_module, rb_intern("ObjectId"));
|
50
50
|
VALUE rb_bson_object_id_generator_class = rb_const_get(rb_bson_object_id_class, rb_intern("Generator"));
|
51
51
|
VALUE rb_digest_class = rb_const_get(rb_cObject, rb_intern("Digest"));
|
52
52
|
VALUE rb_md5_class = rb_const_get(rb_digest_class, rb_intern("MD5"));
|
53
53
|
|
54
54
|
rb_bson_illegal_key = rb_const_get(rb_const_get(rb_bson_module, rb_intern("String")),rb_intern("IllegalKey"));
|
55
|
+
rb_gc_register_mark_object(rb_bson_illegal_key);
|
55
56
|
|
56
57
|
rb_define_alloc_func(rb_byte_buffer_class, rb_bson_byte_buffer_allocate);
|
57
58
|
rb_define_method(rb_byte_buffer_class, "initialize", rb_bson_byte_buffer_initialize, -1);
|
58
59
|
rb_define_method(rb_byte_buffer_class, "length", rb_bson_byte_buffer_length, 0);
|
59
|
-
|
60
|
+
|
60
61
|
/*
|
61
62
|
* call-seq:
|
62
63
|
* buffer.read_position -> Fixnum
|
@@ -64,13 +65,13 @@ void Init_bson_native()
|
|
64
65
|
* Returns the read position in the buffer.
|
65
66
|
*/
|
66
67
|
rb_define_method(rb_byte_buffer_class, "read_position", rb_bson_byte_buffer_read_position, 0);
|
67
|
-
|
68
|
+
|
68
69
|
rb_define_method(rb_byte_buffer_class, "get_byte", rb_bson_byte_buffer_get_byte, 0);
|
69
70
|
rb_define_method(rb_byte_buffer_class, "get_bytes", rb_bson_byte_buffer_get_bytes, 1);
|
70
71
|
rb_define_method(rb_byte_buffer_class, "get_cstring", rb_bson_byte_buffer_get_cstring, 0);
|
71
72
|
rb_define_method(rb_byte_buffer_class, "get_decimal128_bytes", rb_bson_byte_buffer_get_decimal128_bytes, 0);
|
72
73
|
rb_define_method(rb_byte_buffer_class, "get_double", rb_bson_byte_buffer_get_double, 0);
|
73
|
-
|
74
|
+
|
74
75
|
/*
|
75
76
|
* call-seq:
|
76
77
|
* buffer.get_hash(**options) -> Hash
|
@@ -82,23 +83,35 @@ void Init_bson_native()
|
|
82
83
|
* @return [ BSON::Document ] The decoded document.
|
83
84
|
*/
|
84
85
|
rb_define_method(rb_byte_buffer_class, "get_hash", rb_bson_byte_buffer_get_hash, -1);
|
85
|
-
|
86
|
+
|
86
87
|
/*
|
87
88
|
* call-seq:
|
88
89
|
* buffer.get_array(**options) -> Array
|
89
90
|
*
|
90
|
-
* Reads an array from the byte buffer
|
91
|
+
* Reads an array from the byte buffer.
|
91
92
|
*
|
92
93
|
* @option options [ nil | :bson ] :mode Decoding mode to use.
|
93
94
|
*
|
94
95
|
* @return [ Array ] The decoded array.
|
95
96
|
*/
|
96
97
|
rb_define_method(rb_byte_buffer_class, "get_array", rb_bson_byte_buffer_get_array, -1);
|
97
|
-
|
98
|
+
|
98
99
|
rb_define_method(rb_byte_buffer_class, "get_int32", rb_bson_byte_buffer_get_int32, 0);
|
100
|
+
|
101
|
+
/*
|
102
|
+
* call-seq:
|
103
|
+
* buffer.get_uint32(buffer) -> Fixnum
|
104
|
+
*
|
105
|
+
* Reads an unsigned 32 bit number from the byte buffer.
|
106
|
+
*
|
107
|
+
* @return [ Fixnum ] The unsigned 32 bits integer from the buffer
|
108
|
+
*
|
109
|
+
* @api private
|
110
|
+
*/
|
111
|
+
rb_define_method(rb_byte_buffer_class, "get_uint32", rb_bson_byte_buffer_get_uint32, 0);
|
99
112
|
rb_define_method(rb_byte_buffer_class, "get_int64", rb_bson_byte_buffer_get_int64, 0);
|
100
113
|
rb_define_method(rb_byte_buffer_class, "get_string", rb_bson_byte_buffer_get_string, 0);
|
101
|
-
|
114
|
+
|
102
115
|
/*
|
103
116
|
* call-seq:
|
104
117
|
* buffer.write_position -> Fixnum
|
@@ -106,7 +119,7 @@ void Init_bson_native()
|
|
106
119
|
* Returns the write position in the buffer.
|
107
120
|
*/
|
108
121
|
rb_define_method(rb_byte_buffer_class, "write_position", rb_bson_byte_buffer_write_position, 0);
|
109
|
-
|
122
|
+
|
110
123
|
/*
|
111
124
|
* call-seq:
|
112
125
|
* buffer.put_byte(binary_str) -> ByteBuffer
|
@@ -117,7 +130,7 @@ void Init_bson_native()
|
|
117
130
|
* Returns the modified +self+.
|
118
131
|
*/
|
119
132
|
rb_define_method(rb_byte_buffer_class, "put_byte", rb_bson_byte_buffer_put_byte, 1);
|
120
|
-
|
133
|
+
|
121
134
|
/*
|
122
135
|
* call-seq:
|
123
136
|
* buffer.put_bytes(binary_str) -> ByteBuffer
|
@@ -170,7 +183,7 @@ void Init_bson_native()
|
|
170
183
|
* instead on the null terminator), unlike the BSON string serialization.
|
171
184
|
*/
|
172
185
|
rb_define_method(rb_byte_buffer_class, "put_cstring", rb_bson_byte_buffer_put_cstring, 1);
|
173
|
-
|
186
|
+
|
174
187
|
/**
|
175
188
|
* call-seq:
|
176
189
|
* buffer.put_symbol(sym) -> ByteBuffer
|
@@ -188,7 +201,7 @@ void Init_bson_native()
|
|
188
201
|
* indistinguishable from a string with the same value written to the buffer.
|
189
202
|
*/
|
190
203
|
rb_define_method(rb_byte_buffer_class, "put_symbol", rb_bson_byte_buffer_put_symbol, 1);
|
191
|
-
|
204
|
+
|
192
205
|
/*
|
193
206
|
* call-seq:
|
194
207
|
* buffer.put_int32(fixnum) -> ByteBuffer
|
@@ -200,7 +213,22 @@ void Init_bson_native()
|
|
200
213
|
* Returns the modified +self+.
|
201
214
|
*/
|
202
215
|
rb_define_method(rb_byte_buffer_class, "put_int32", rb_bson_byte_buffer_put_int32, 1);
|
203
|
-
|
216
|
+
|
217
|
+
/*
|
218
|
+
* call-seq:
|
219
|
+
* buffer.put_uint32(fixnum) -> ByteBuffer
|
220
|
+
*
|
221
|
+
* Writes an unsigned 32-bit integer value to the buffer.
|
222
|
+
*
|
223
|
+
* If the argument cannot be represented in 32 bits, raises RangeError.
|
224
|
+
*
|
225
|
+
* Returns the modified +self+.
|
226
|
+
*
|
227
|
+
* @api private
|
228
|
+
*
|
229
|
+
*/
|
230
|
+
rb_define_method(rb_byte_buffer_class, "put_uint32", rb_bson_byte_buffer_put_uint32, 1);
|
231
|
+
|
204
232
|
/*
|
205
233
|
* call-seq:
|
206
234
|
* buffer.put_int64(fixnum) -> ByteBuffer
|
@@ -212,7 +240,7 @@ void Init_bson_native()
|
|
212
240
|
* Returns the modified +self+.
|
213
241
|
*/
|
214
242
|
rb_define_method(rb_byte_buffer_class, "put_int64", rb_bson_byte_buffer_put_int64, 1);
|
215
|
-
|
243
|
+
|
216
244
|
/*
|
217
245
|
* call-seq:
|
218
246
|
* buffer.put_double(double) -> ByteBuffer
|
@@ -222,7 +250,7 @@ void Init_bson_native()
|
|
222
250
|
* Returns the modified +self+.
|
223
251
|
*/
|
224
252
|
rb_define_method(rb_byte_buffer_class, "put_double", rb_bson_byte_buffer_put_double, 1);
|
225
|
-
|
253
|
+
|
226
254
|
/*
|
227
255
|
* call-seq:
|
228
256
|
* buffer.put_decimal128(low_64bit, high_64bit) -> ByteBuffer
|
@@ -235,7 +263,7 @@ void Init_bson_native()
|
|
235
263
|
* Returns the modified +self+.
|
236
264
|
*/
|
237
265
|
rb_define_method(rb_byte_buffer_class, "put_decimal128", rb_bson_byte_buffer_put_decimal128, 2);
|
238
|
-
|
266
|
+
|
239
267
|
/*
|
240
268
|
* call-seq:
|
241
269
|
* buffer.put_hash(hash) -> ByteBuffer
|
@@ -245,7 +273,7 @@ void Init_bson_native()
|
|
245
273
|
* Returns the modified +self+.
|
246
274
|
*/
|
247
275
|
rb_define_method(rb_byte_buffer_class, "put_hash", rb_bson_byte_buffer_put_hash, 2);
|
248
|
-
|
276
|
+
|
249
277
|
/*
|
250
278
|
* call-seq:
|
251
279
|
* buffer.put_array(array) -> ByteBuffer
|
@@ -255,7 +283,7 @@ void Init_bson_native()
|
|
255
283
|
* Returns the modified +self+.
|
256
284
|
*/
|
257
285
|
rb_define_method(rb_byte_buffer_class, "put_array", rb_bson_byte_buffer_put_array, 2);
|
258
|
-
|
286
|
+
|
259
287
|
/*
|
260
288
|
* call-seq:
|
261
289
|
* buffer.replace_int32(position, fixnum) -> ByteBuffer
|
@@ -272,7 +300,7 @@ void Init_bson_native()
|
|
272
300
|
* Returns the modified +self+.
|
273
301
|
*/
|
274
302
|
rb_define_method(rb_byte_buffer_class, "replace_int32", rb_bson_byte_buffer_replace_int32, 2);
|
275
|
-
|
303
|
+
|
276
304
|
/*
|
277
305
|
* call-seq:
|
278
306
|
* buffer.rewind! -> ByteBuffer
|
@@ -284,7 +312,7 @@ void Init_bson_native()
|
|
284
312
|
* Returns the modified +self+.
|
285
313
|
*/
|
286
314
|
rb_define_method(rb_byte_buffer_class, "rewind!", rb_bson_byte_buffer_rewind, 0);
|
287
|
-
|
315
|
+
|
288
316
|
/*
|
289
317
|
* call-seq:
|
290
318
|
* buffer.to_s -> String
|
@@ -296,7 +324,7 @@ void Init_bson_native()
|
|
296
324
|
* the buffer itself.
|
297
325
|
*/
|
298
326
|
rb_define_method(rb_byte_buffer_class, "to_s", rb_bson_byte_buffer_to_s, 0);
|
299
|
-
|
327
|
+
|
300
328
|
rb_define_method(rb_bson_object_id_generator_class, "next_object_id", rb_bson_object_id_generator_next, -1);
|
301
329
|
|
302
330
|
// Get the object id machine id and hash it.
|
@@ -309,4 +337,5 @@ void Init_bson_native()
|
|
309
337
|
rb_bson_object_id_counter = FIX2INT(rb_funcall(rb_mKernel, rb_intern("rand"), 1, INT2FIX(0x1000000)));
|
310
338
|
|
311
339
|
rb_bson_registry = rb_const_get(rb_bson_module, rb_intern("Registry"));
|
340
|
+
rb_gc_register_mark_object(rb_bson_registry);
|
312
341
|
}
|
data/ext/bson/read.c
CHANGED
@@ -21,6 +21,7 @@ static void pvt_raise_decode_error(volatile VALUE msg);
|
|
21
21
|
static int32_t pvt_validate_length(byte_buffer_t *b);
|
22
22
|
static uint8_t pvt_get_type_byte(byte_buffer_t *b);
|
23
23
|
static VALUE pvt_get_int32(byte_buffer_t *b);
|
24
|
+
static VALUE pvt_get_uint32(byte_buffer_t *b);
|
24
25
|
static VALUE pvt_get_int64(byte_buffer_t *b, int argc, VALUE *argv);
|
25
26
|
static VALUE pvt_get_double(byte_buffer_t *b);
|
26
27
|
static VALUE pvt_get_string(byte_buffer_t *b, const char *data_type);
|
@@ -41,12 +42,12 @@ void pvt_raise_decode_error(volatile VALUE msg) {
|
|
41
42
|
int32_t pvt_validate_length(byte_buffer_t *b)
|
42
43
|
{
|
43
44
|
int32_t length;
|
44
|
-
|
45
|
+
|
45
46
|
ENSURE_BSON_READ(b, 4);
|
46
47
|
memcpy(&length, READ_PTR(b), 4);
|
47
48
|
length = BSON_UINT32_TO_LE(length);
|
48
49
|
|
49
|
-
/* minimum valid length is 4 (byte count) + 1 (terminating byte) */
|
50
|
+
/* minimum valid length is 4 (byte count) + 1 (terminating byte) */
|
50
51
|
if(length >= 5){
|
51
52
|
ENSURE_BSON_READ(b, length);
|
52
53
|
|
@@ -59,7 +60,7 @@ int32_t pvt_validate_length(byte_buffer_t *b)
|
|
59
60
|
else{
|
60
61
|
rb_raise(rb_eRangeError, "Buffer contained invalid length %d at %zu", length, b->read_position);
|
61
62
|
}
|
62
|
-
|
63
|
+
|
63
64
|
return length;
|
64
65
|
}
|
65
66
|
|
@@ -175,13 +176,13 @@ VALUE pvt_get_string(byte_buffer_t *b, const char *data_type)
|
|
175
176
|
}
|
176
177
|
ENSURE_BSON_READ(b, 4 + length);
|
177
178
|
str_ptr = READ_PTR(b) + 4;
|
178
|
-
last_byte = *(READ_PTR(b) + 4 +
|
179
|
+
last_byte = *(READ_PTR(b) + 4 + length - 1);
|
179
180
|
if (last_byte != 0) {
|
180
181
|
pvt_raise_decode_error(rb_sprintf("Last byte of the string is not null: 0x%x", (int) last_byte));
|
181
182
|
}
|
182
183
|
rb_bson_utf8_validate(str_ptr, length - 1, true, data_type);
|
183
184
|
string = rb_enc_str_new(str_ptr, length - 1, rb_utf8_encoding());
|
184
|
-
b->read_position += 4 +
|
185
|
+
b->read_position += 4 + length;
|
185
186
|
return string;
|
186
187
|
}
|
187
188
|
|
@@ -205,7 +206,7 @@ VALUE pvt_get_symbol(byte_buffer_t *b, VALUE rb_buffer, int argc, VALUE *argv)
|
|
205
206
|
klass = rb_funcall(rb_bson_registry, rb_intern("get"), 1, INT2FIX(BSON_TYPE_SYMBOL));
|
206
207
|
value = rb_funcall(klass, rb_intern("from_bson"), 1, rb_buffer);
|
207
208
|
}
|
208
|
-
|
209
|
+
|
209
210
|
RB_GC_GUARD(klass);
|
210
211
|
return value;
|
211
212
|
}
|
@@ -259,6 +260,28 @@ VALUE pvt_get_int32(byte_buffer_t *b)
|
|
259
260
|
return INT2NUM(BSON_UINT32_FROM_LE(i32));
|
260
261
|
}
|
261
262
|
|
263
|
+
/**
|
264
|
+
* Get an unsigned int32 from the buffer.
|
265
|
+
*/
|
266
|
+
VALUE rb_bson_byte_buffer_get_uint32(VALUE self)
|
267
|
+
{
|
268
|
+
byte_buffer_t *b;
|
269
|
+
|
270
|
+
TypedData_Get_Struct(self, byte_buffer_t, &rb_byte_buffer_data_type, b);
|
271
|
+
return pvt_get_uint32(b);
|
272
|
+
}
|
273
|
+
|
274
|
+
VALUE pvt_get_uint32(byte_buffer_t *b)
|
275
|
+
{
|
276
|
+
uint32_t i32;
|
277
|
+
|
278
|
+
ENSURE_BSON_READ(b, 4);
|
279
|
+
memcpy(&i32, READ_PTR(b), 4);
|
280
|
+
b->read_position += 4;
|
281
|
+
return UINT2NUM(BSON_UINT32_FROM_LE(i32));
|
282
|
+
}
|
283
|
+
|
284
|
+
|
262
285
|
/**
|
263
286
|
* Get a int64 from the buffer.
|
264
287
|
*/
|
@@ -284,7 +307,7 @@ VALUE pvt_get_int64(byte_buffer_t *b, int argc, VALUE *argv)
|
|
284
307
|
memcpy(&i64, READ_PTR(b), 8);
|
285
308
|
b->read_position += 8;
|
286
309
|
num = LL2NUM(BSON_UINT64_FROM_LE(i64));
|
287
|
-
|
310
|
+
|
288
311
|
if (pvt_get_mode_option(argc, argv) == BSON_MODE_BSON) {
|
289
312
|
VALUE klass = rb_funcall(rb_bson_registry,rb_intern("get"),1, INT2FIX(BSON_TYPE_INT64));
|
290
313
|
VALUE value = rb_funcall(klass, rb_intern("new"), 1, num);
|
@@ -293,7 +316,7 @@ VALUE pvt_get_int64(byte_buffer_t *b, int argc, VALUE *argv)
|
|
293
316
|
} else {
|
294
317
|
return num;
|
295
318
|
}
|
296
|
-
|
319
|
+
|
297
320
|
RB_GC_GUARD(num);
|
298
321
|
}
|
299
322
|
|
@@ -353,11 +376,11 @@ VALUE rb_bson_byte_buffer_get_hash(int argc, VALUE *argv, VALUE self){
|
|
353
376
|
rb_hash_aset(doc, field, pvt_read_field(b, self, type, argc, argv));
|
354
377
|
RB_GC_GUARD(field);
|
355
378
|
}
|
356
|
-
|
379
|
+
|
357
380
|
if (READ_PTR(b) - start_ptr != length) {
|
358
381
|
pvt_raise_decode_error(rb_sprintf("Expected to read %d bytes for the hash but read %ld bytes", length, READ_PTR(b) - start_ptr));
|
359
382
|
}
|
360
|
-
|
383
|
+
|
361
384
|
return doc;
|
362
385
|
}
|
363
386
|
|
@@ -379,10 +402,10 @@ VALUE rb_bson_byte_buffer_get_array(int argc, VALUE *argv, VALUE self){
|
|
379
402
|
rb_ary_push(array, pvt_read_field(b, self, type, argc, argv));
|
380
403
|
}
|
381
404
|
RB_GC_GUARD(array);
|
382
|
-
|
405
|
+
|
383
406
|
if (READ_PTR(b) - start_ptr != length) {
|
384
407
|
pvt_raise_decode_error(rb_sprintf("Expected to read %d bytes for the hash but read %ld bytes", length, READ_PTR(b) - start_ptr));
|
385
408
|
}
|
386
|
-
|
409
|
+
|
387
410
|
return array;
|
388
411
|
}
|
data/ext/bson/write.c
CHANGED
@@ -27,6 +27,7 @@ static void pvt_replace_int32(byte_buffer_t *b, int32_t position, int32_t newval
|
|
27
27
|
static void pvt_put_field(byte_buffer_t *b, VALUE rb_buffer, VALUE val, VALUE validating_keys);
|
28
28
|
static void pvt_put_byte(byte_buffer_t *b, const char byte);
|
29
29
|
static void pvt_put_int32(byte_buffer_t *b, const int32_t i32);
|
30
|
+
static void pvt_put_uint32(byte_buffer_t *b, const uint32_t i32);
|
30
31
|
static void pvt_put_int64(byte_buffer_t *b, const int64_t i);
|
31
32
|
static void pvt_put_double(byte_buffer_t *b, double f);
|
32
33
|
static void pvt_put_cstring(byte_buffer_t *b, const char *str, int32_t length, const char *data_type);
|
@@ -154,8 +155,15 @@ void pvt_put_type_byte(byte_buffer_t *b, VALUE val){
|
|
154
155
|
case T_FLOAT:
|
155
156
|
type_byte = BSON_TYPE_DOUBLE;
|
156
157
|
break;
|
157
|
-
default:{
|
158
|
-
VALUE type
|
158
|
+
default: {
|
159
|
+
VALUE type;
|
160
|
+
VALUE responds = rb_funcall(val, rb_intern("respond_to?"), 1, ID2SYM(rb_intern("bson_type")));
|
161
|
+
if (!RTEST(responds)) {
|
162
|
+
VALUE klass = pvt_const_get_3("BSON", "Error", "UnserializableClass");
|
163
|
+
VALUE val_str = rb_funcall(val, rb_intern("to_s"), 0);
|
164
|
+
rb_raise(klass, "Value does not define its BSON serialized type: %s", RSTRING_PTR(val_str));
|
165
|
+
}
|
166
|
+
type = rb_funcall(val, rb_intern("bson_type"), 0);
|
159
167
|
type_byte = *RSTRING_PTR(type);
|
160
168
|
RB_GC_GUARD(type);
|
161
169
|
break;
|
@@ -383,6 +391,37 @@ void pvt_put_int32(byte_buffer_t *b, const int32_t i)
|
|
383
391
|
b->write_position += 4;
|
384
392
|
}
|
385
393
|
|
394
|
+
/* The docstring is in init.c. */
|
395
|
+
VALUE rb_bson_byte_buffer_put_uint32(VALUE self, VALUE i)
|
396
|
+
{
|
397
|
+
byte_buffer_t *b;
|
398
|
+
int64_t temp;
|
399
|
+
uint32_t i32;
|
400
|
+
|
401
|
+
if (RB_TYPE_P(i, T_FLOAT)) {
|
402
|
+
rb_raise(rb_eArgError, "put_uint32: incorrect type: float, expected: integer");
|
403
|
+
}
|
404
|
+
|
405
|
+
temp = NUM2LL(i);
|
406
|
+
if (temp < 0 || temp > UINT32_MAX) {
|
407
|
+
rb_raise(rb_eRangeError, "Number %lld is out of range [0, 2^32)", (long long)temp);
|
408
|
+
}
|
409
|
+
|
410
|
+
i32 = NUM2UINT(i);
|
411
|
+
|
412
|
+
TypedData_Get_Struct(self, byte_buffer_t, &rb_byte_buffer_data_type, b);
|
413
|
+
pvt_put_uint32(b, i32);
|
414
|
+
return self;
|
415
|
+
}
|
416
|
+
|
417
|
+
void pvt_put_uint32(byte_buffer_t *b, const uint32_t i)
|
418
|
+
{
|
419
|
+
const uint32_t i32 = BSON_UINT32_TO_LE(i);
|
420
|
+
ENSURE_BSON_WRITE(b, 4);
|
421
|
+
memcpy(WRITE_PTR(b), &i32, 4);
|
422
|
+
b->write_position += 4;
|
423
|
+
}
|
424
|
+
|
386
425
|
/* The docstring is in init.c. */
|
387
426
|
VALUE rb_bson_byte_buffer_put_int64(VALUE self, VALUE i)
|
388
427
|
{
|
@@ -627,7 +666,7 @@ VALUE rb_bson_byte_buffer_put_array(VALUE self, VALUE array, VALUE validating_ke
|
|
627
666
|
|
628
667
|
for(int32_t index=0; index < RARRAY_LEN(array); index++, array_element++){
|
629
668
|
pvt_put_type_byte(b, *array_element);
|
630
|
-
pvt_put_array_index(b,index);
|
669
|
+
pvt_put_array_index(b, index);
|
631
670
|
pvt_put_field(b, self, *array_element, validating_keys);
|
632
671
|
}
|
633
672
|
pvt_put_byte(b, 0);
|
data/lib/bson/array.rb
CHANGED
@@ -47,6 +47,9 @@ module BSON
|
|
47
47
|
position = buffer.length
|
48
48
|
buffer.put_int32(0)
|
49
49
|
each_with_index do |value, index|
|
50
|
+
unless value.respond_to?(:bson_type)
|
51
|
+
raise Error::UnserializableClass, "Array element at position #{index} does not define its BSON serialized type: #{value}"
|
52
|
+
end
|
50
53
|
buffer.put_byte(value.bson_type)
|
51
54
|
buffer.put_cstring(index.to_s)
|
52
55
|
value.to_bson(buffer, validating_keys)
|
data/lib/bson/date_time.rb
CHANGED
data/lib/bson/error.rb
CHANGED
@@ -17,5 +17,11 @@ module BSON
|
|
17
17
|
# Exception raised when BSON decoding fails.
|
18
18
|
class BSONDecodeError < Error
|
19
19
|
end
|
20
|
+
|
21
|
+
# Exception raised when serializing an Array or Hash to BSON and an
|
22
|
+
# array or hash element is of a class that does not define how to serialize
|
23
|
+
# itself to BSON.
|
24
|
+
class UnserializableClass < Error
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
data/lib/bson/hash.rb
CHANGED
@@ -44,6 +44,9 @@ module BSON
|
|
44
44
|
position = buffer.length
|
45
45
|
buffer.put_int32(0)
|
46
46
|
each do |field, value|
|
47
|
+
unless value.respond_to?(:bson_type)
|
48
|
+
raise Error::UnserializableClass, "Hash value for key '#{field}' does not define its BSON serialized type: #{value}"
|
49
|
+
end
|
47
50
|
buffer.put_byte(value.bson_type)
|
48
51
|
key = field.to_bson_key(validating_keys)
|
49
52
|
begin
|
data/lib/bson/timestamp.rb
CHANGED
@@ -124,8 +124,8 @@ module BSON
|
|
124
124
|
#
|
125
125
|
# @since 2.0.0
|
126
126
|
def to_bson(buffer = ByteBuffer.new, validating_keys = Config.validating_keys?)
|
127
|
-
buffer.
|
128
|
-
buffer.
|
127
|
+
buffer.put_uint32(increment)
|
128
|
+
buffer.put_uint32(seconds)
|
129
129
|
end
|
130
130
|
|
131
131
|
# Deserialize timestamp from BSON.
|
@@ -140,8 +140,8 @@ module BSON
|
|
140
140
|
#
|
141
141
|
# @since 2.0.0
|
142
142
|
def self.from_bson(buffer, **options)
|
143
|
-
increment = buffer.
|
144
|
-
seconds = buffer.
|
143
|
+
increment = buffer.get_uint32
|
144
|
+
seconds = buffer.get_uint32
|
145
145
|
new(seconds, increment)
|
146
146
|
end
|
147
147
|
|
data/lib/bson/version.rb
CHANGED
Binary file
|
data/spec/bson/array_spec.rb
CHANGED
@@ -132,6 +132,23 @@ describe Array do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
135
|
+
|
136
|
+
context 'when array contains value of an unserializable class' do
|
137
|
+
class ArraySpecUnserializableClass
|
138
|
+
end
|
139
|
+
|
140
|
+
let(:obj) do
|
141
|
+
[ArraySpecUnserializableClass.new]
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'raises UnserializableClass' do
|
145
|
+
lambda do
|
146
|
+
obj.to_bson
|
147
|
+
end.should raise_error(BSON::Error::UnserializableClass,
|
148
|
+
# C extension does not provide element position in the exception message.
|
149
|
+
/(Array element at position 0|Value) does not define its BSON serialized type:.*ArraySpecUnserializableClass/)
|
150
|
+
end
|
151
|
+
end
|
135
152
|
end
|
136
153
|
|
137
154
|
describe "#to_bson_normalized_value" do
|
@@ -66,7 +66,7 @@ describe BSON::ByteBuffer do
|
|
66
66
|
describe '#get_double' do
|
67
67
|
|
68
68
|
let(:buffer) do
|
69
|
-
described_class.new(
|
69
|
+
described_class.new(12.5.to_bson.to_s)
|
70
70
|
end
|
71
71
|
|
72
72
|
let!(:double) do
|
@@ -85,7 +85,7 @@ describe BSON::ByteBuffer do
|
|
85
85
|
describe '#get_int32' do
|
86
86
|
|
87
87
|
let(:buffer) do
|
88
|
-
described_class.new(
|
88
|
+
described_class.new(12.to_bson.to_s)
|
89
89
|
end
|
90
90
|
|
91
91
|
let!(:int32) do
|
@@ -101,10 +101,66 @@ describe BSON::ByteBuffer do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
describe '#get_uint32' do
|
105
|
+
context 'when using 2^32-1' do
|
106
|
+
let(:buffer) do
|
107
|
+
described_class.new(4294967295.to_bson.to_s)
|
108
|
+
end
|
109
|
+
|
110
|
+
let!(:int32) do
|
111
|
+
buffer.get_uint32
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'gets the uint32 from the buffer' do
|
115
|
+
expect(int32).to eq(4294967295)
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'increments the position by 4' do
|
119
|
+
expect(buffer.read_position).to eq(4)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
context 'when using 2^32-2' do
|
124
|
+
let(:buffer) do
|
125
|
+
described_class.new(4294967294.to_bson.to_s)
|
126
|
+
end
|
127
|
+
|
128
|
+
let!(:int32) do
|
129
|
+
buffer.get_uint32
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'gets the uint32 from the buffer' do
|
133
|
+
expect(int32).to eq(4294967294)
|
134
|
+
end
|
135
|
+
|
136
|
+
it 'increments the position by 4' do
|
137
|
+
expect(buffer.read_position).to eq(4)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'when using 0' do
|
142
|
+
let(:buffer) do
|
143
|
+
described_class.new(0.to_bson.to_s)
|
144
|
+
end
|
145
|
+
|
146
|
+
let!(:int32) do
|
147
|
+
buffer.get_uint32
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'gets the uint32 from the buffer' do
|
151
|
+
expect(int32).to eq(0)
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'increments the position by 4' do
|
155
|
+
expect(buffer.read_position).to eq(4)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
104
160
|
describe '#get_int64' do
|
105
161
|
|
106
162
|
let(:buffer) do
|
107
|
-
described_class.new(
|
163
|
+
described_class.new((Integer::MAX_64BIT - 1).to_bson.to_s)
|
108
164
|
end
|
109
165
|
|
110
166
|
let!(:int64) do
|
@@ -30,16 +30,19 @@ describe BSON::ByteBuffer do
|
|
30
30
|
let(:buffer) do
|
31
31
|
described_class.new
|
32
32
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
|
34
|
+
context '#put_int32' do
|
35
|
+
before do
|
36
|
+
buffer.put_int32(5)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns the length of the buffer' do
|
40
|
+
expect(buffer.length).to eq(4)
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
45
|
+
|
43
46
|
context 'when the byte buffer is initialized with some bytes' do
|
44
47
|
|
45
48
|
let(:buffer) do
|
@@ -585,6 +585,102 @@ describe BSON::ByteBuffer do
|
|
585
585
|
end
|
586
586
|
end
|
587
587
|
|
588
|
+
describe '#put_uint32' do
|
589
|
+
context 'when argument is a float' do
|
590
|
+
it 'raises an Argument Error' do
|
591
|
+
expect{ buffer.put_uint32(4.934) }.to raise_error(ArgumentError, "put_uint32: incorrect type: float, expected: integer")
|
592
|
+
end
|
593
|
+
end
|
594
|
+
|
595
|
+
context 'when number is in range' do
|
596
|
+
let(:modified) do
|
597
|
+
buffer.put_uint32(5)
|
598
|
+
end
|
599
|
+
|
600
|
+
it 'returns gets the correct number from the buffer' do
|
601
|
+
expect(modified.get_uint32).to eq(5)
|
602
|
+
end
|
603
|
+
|
604
|
+
it 'returns the length of the buffer' do
|
605
|
+
expect(modified.length).to eq(4)
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
context 'when number is 0' do
|
610
|
+
let(:modified) do
|
611
|
+
buffer.put_uint32(0)
|
612
|
+
end
|
613
|
+
|
614
|
+
it 'returns gets the correct number from the buffer' do
|
615
|
+
expect(modified.get_uint32).to eq(0)
|
616
|
+
end
|
617
|
+
|
618
|
+
it 'returns the length of the buffer' do
|
619
|
+
expect(modified.length).to eq(4)
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
623
|
+
context 'when number doesn\'t fit in signed int32' do
|
624
|
+
let(:modified) do
|
625
|
+
buffer.put_uint32(4294967295)
|
626
|
+
end
|
627
|
+
|
628
|
+
let(:expected) do
|
629
|
+
[ 4294967295 ].pack(BSON::Int32::PACK)
|
630
|
+
end
|
631
|
+
|
632
|
+
it 'appends the int32 to the byte buffer' do
|
633
|
+
expect(modified.to_s).to eq(expected)
|
634
|
+
end
|
635
|
+
|
636
|
+
it 'get returns correct number' do
|
637
|
+
expect(modified.get_uint32).to eq(4294967295)
|
638
|
+
end
|
639
|
+
|
640
|
+
it 'returns the length of the buffer' do
|
641
|
+
expect(modified.length).to eq(4)
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
645
|
+
context 'when number is 2^31' do
|
646
|
+
let(:modified) do
|
647
|
+
buffer.put_uint32(2147483648)
|
648
|
+
end
|
649
|
+
|
650
|
+
it 'returns gets the correct number from the buffer' do
|
651
|
+
expect(modified.get_uint32).to eq(2147483648)
|
652
|
+
end
|
653
|
+
|
654
|
+
it 'returns the length of the buffer' do
|
655
|
+
expect(modified.length).to eq(4)
|
656
|
+
end
|
657
|
+
end
|
658
|
+
|
659
|
+
context 'when number is 2^31-1' do
|
660
|
+
let(:modified) do
|
661
|
+
buffer.put_uint32(2147483647)
|
662
|
+
end
|
663
|
+
|
664
|
+
it 'returns gets the correct number from the buffer' do
|
665
|
+
expect(modified.get_uint32).to eq(2147483647)
|
666
|
+
end
|
667
|
+
|
668
|
+
it 'returns the length of the buffer' do
|
669
|
+
expect(modified.length).to eq(4)
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
context 'when number is not in range' do
|
674
|
+
it 'raises error on out of top range' do
|
675
|
+
expect{ buffer.put_uint32(4294967296) }.to raise_error(RangeError, "Number 4294967296 is out of range [0, 2^32)")
|
676
|
+
end
|
677
|
+
|
678
|
+
it 'raises error on out of bottom range' do
|
679
|
+
expect{ buffer.put_uint32(-1) }.to raise_error(RangeError, "Number -1 is out of range [0, 2^32)")
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
588
684
|
describe '#put_int64' do
|
589
685
|
|
590
686
|
context 'when the integer is 64 bit' do
|
data/spec/bson/date_time_spec.rb
CHANGED
@@ -35,5 +35,58 @@ describe DateTime do
|
|
35
35
|
|
36
36
|
it_behaves_like "a serializable bson element"
|
37
37
|
end
|
38
|
+
|
39
|
+
context "when the dates don't both use Gregorian" do
|
40
|
+
|
41
|
+
let(:shakespeare_datetime) do
|
42
|
+
DateTime.iso8601('1616-04-23', Date::ENGLAND)
|
43
|
+
end
|
44
|
+
|
45
|
+
let(:gregorian_datetime) do
|
46
|
+
DateTime.iso8601('1616-04-23', Date::GREGORIAN)
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when putting to bson" do
|
50
|
+
|
51
|
+
let(:shakespeare) do
|
52
|
+
{ a: shakespeare_datetime }.to_bson
|
53
|
+
end
|
54
|
+
|
55
|
+
let(:gregorian) do
|
56
|
+
{ a: gregorian_datetime }.to_bson
|
57
|
+
end
|
58
|
+
|
59
|
+
it "does not equal each other" do
|
60
|
+
expect(shakespeare.to_s).to_not eq(gregorian.to_s)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "the english date is 10 days later" do
|
64
|
+
expect(shakespeare.to_s).to eq({ a: DateTime.iso8601('1616-05-03', Date::GREGORIAN) }.to_bson.to_s)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when putting and receiving from bson" do
|
69
|
+
|
70
|
+
let(:shakespeare) do
|
71
|
+
Hash.from_bson(BSON::ByteBuffer.new({ a: shakespeare_datetime }.to_bson.to_s))
|
72
|
+
end
|
73
|
+
|
74
|
+
let(:gregorian) do
|
75
|
+
Hash.from_bson(BSON::ByteBuffer.new({ a: gregorian_datetime }.to_bson.to_s))
|
76
|
+
end
|
77
|
+
|
78
|
+
it "does not equal each other" do
|
79
|
+
expect(shakespeare).to_not eq(gregorian)
|
80
|
+
end
|
81
|
+
|
82
|
+
it "the english date is 10 days later" do
|
83
|
+
expect(shakespeare[:a]).to eq(DateTime.iso8601('1616-05-03', Date::GREGORIAN).to_time)
|
84
|
+
end
|
85
|
+
|
86
|
+
it "the gregorian date is the same" do
|
87
|
+
expect(gregorian[:a]).to eq(DateTime.iso8601('1616-04-23', Date::GREGORIAN).to_time)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
38
91
|
end
|
39
92
|
end
|
data/spec/bson/hash_spec.rb
CHANGED
@@ -227,6 +227,23 @@ describe Hash do
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
230
|
+
|
231
|
+
context 'when hash contains value of an unserializable class' do
|
232
|
+
class HashSpecUnserializableClass
|
233
|
+
end
|
234
|
+
|
235
|
+
let(:obj) do
|
236
|
+
{foo: HashSpecUnserializableClass.new}
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'raises UnserializableClass' do
|
240
|
+
lambda do
|
241
|
+
obj.to_bson
|
242
|
+
end.should raise_error(BSON::Error::UnserializableClass,
|
243
|
+
# C extension does not provide hash key in the exception message.
|
244
|
+
/(Hash value for key 'foo'|Value) does not define its BSON serialized type:.*HashSpecUnserializableClass/)
|
245
|
+
end
|
246
|
+
end
|
230
247
|
end
|
231
248
|
|
232
249
|
describe '#to_bson' do
|
data/spec/spec_helper.rb
CHANGED
@@ -60,4 +60,15 @@ RSpec.configure do |config|
|
|
60
60
|
config.expect_with :rspec do |c|
|
61
61
|
c.syntax = [:should, :expect]
|
62
62
|
end
|
63
|
+
|
64
|
+
# To ensure that calling GC.compact does not produce unexpected behavior,
|
65
|
+
# randomly call GC.compact after a small percentage of tests in the suite.
|
66
|
+
# This behavior is only enabled when the COMPACT environment variable is true.
|
67
|
+
if SpecConfig.instance.compact?
|
68
|
+
config.after do
|
69
|
+
if rand < SpecConfig::COMPACTION_CHANCE
|
70
|
+
GC.compact
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
63
74
|
end
|
@@ -13,6 +13,16 @@
|
|
13
13
|
"canonical_bson": "100000001161002A00000015CD5B0700",
|
14
14
|
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 123456789, \"i\" : 42} } }",
|
15
15
|
"degenerate_extjson": "{\"a\" : {\"$timestamp\" : {\"i\" : 42, \"t\" : 123456789} } }"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"description": "Timestamp with high-order bit set on both seconds and increment",
|
19
|
+
"canonical_bson": "10000000116100FFFFFFFFFFFFFFFF00",
|
20
|
+
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 4294967295, \"i\" : 4294967295} } }"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"description": "Timestamp with high-order bit set on both seconds and increment (not UINT32_MAX)",
|
24
|
+
"canonical_bson": "1000000011610000286BEE00286BEE00",
|
25
|
+
"canonical_extjson": "{\"a\" : {\"$timestamp\" : {\"t\" : 4000000000, \"i\" : 4000000000} } }"
|
16
26
|
}
|
17
27
|
],
|
18
28
|
"decodeErrors": [
|
@@ -65,11 +65,11 @@
|
|
65
65
|
"parseErrors": [
|
66
66
|
{
|
67
67
|
"description" : "Bad $regularExpression (extra field)",
|
68
|
-
"string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}"
|
68
|
+
"string" : "{\"a\" : {\"$regularExpression\": {\"pattern\": \"abc\", \"options\": \"\", \"unrelated\": true}}}"
|
69
69
|
},
|
70
70
|
{
|
71
71
|
"description" : "Bad $regularExpression (missing options field)",
|
72
|
-
"string" : "{\"a\" : \"$regularExpression\": {\"pattern\": \"abc\"}}}"
|
72
|
+
"string" : "{\"a\" : {\"$regularExpression\": {\"pattern\": \"abc\"}}}"
|
73
73
|
},
|
74
74
|
{
|
75
75
|
"description": "Bad $regularExpression (pattern is number, not string)",
|
@@ -81,7 +81,7 @@
|
|
81
81
|
},
|
82
82
|
{
|
83
83
|
"description" : "Bad $regularExpression (missing pattern field)",
|
84
|
-
"string" : "{\"a\" : \"$regularExpression\": {\"options\":\"ix\"}}}"
|
84
|
+
"string" : "{\"a\" : {\"$regularExpression\": {\"options\":\"ix\"}}}"
|
85
85
|
},
|
86
86
|
{
|
87
87
|
"description": "Bad $oid (number, not string)",
|
data/spec/support/spec_config.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
gpvfPNWMwyBDlHaNS3GfO6cRRxBOvEG05GUCsvtTY4Bpe8yjE64wg1ymb47LMOnv
|
34
34
|
Qb1lGORmf/opg45mluKUYl7pQNZHD0d3
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2020-
|
36
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
37
37
|
dependencies: []
|
38
38
|
description: A fully featured BSON specification implementation in Ruby
|
39
39
|
email:
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/bson/true_class.rb
|
100
100
|
- lib/bson/undefined.rb
|
101
101
|
- lib/bson/version.rb
|
102
|
+
- lib/bson_native.bundle
|
102
103
|
- spec/bson/array_spec.rb
|
103
104
|
- spec/bson/binary_spec.rb
|
104
105
|
- spec/bson/binary_uuid_spec.rb
|
@@ -239,113 +240,113 @@ signing_key:
|
|
239
240
|
specification_version: 4
|
240
241
|
summary: Ruby implementation of the BSON specification
|
241
242
|
test_files:
|
242
|
-
- spec/
|
243
|
-
- spec/
|
244
|
-
- spec/runners/common_driver.rb
|
245
|
-
- spec/bson/max_key_spec.rb
|
246
|
-
- spec/bson/byte_buffer_spec.rb
|
247
|
-
- spec/bson/ext_json_parse_spec.rb
|
248
|
-
- spec/bson/byte_buffer_read_spec.rb
|
249
|
-
- spec/bson/decimal128_spec.rb
|
250
|
-
- spec/bson/date_spec.rb
|
251
|
-
- spec/bson/object_spec.rb
|
252
|
-
- spec/bson/int64_spec.rb
|
253
|
-
- spec/bson/int32_spec.rb
|
254
|
-
- spec/bson/object_id_spec.rb
|
255
|
-
- spec/bson/hash_spec.rb
|
256
|
-
- spec/bson/string_spec.rb
|
257
|
-
- spec/bson/boolean_spec.rb
|
258
|
-
- spec/bson/timestamp_spec.rb
|
259
|
-
- spec/bson/open_struct_spec.rb
|
260
|
-
- spec/bson/config_spec.rb
|
261
|
-
- spec/bson/nil_class_spec.rb
|
262
|
-
- spec/bson/regexp_spec.rb
|
263
|
-
- spec/bson/time_with_zone_spec.rb
|
264
|
-
- spec/bson/code_spec.rb
|
265
|
-
- spec/bson/false_class_spec.rb
|
266
|
-
- spec/bson/raw_spec.rb
|
267
|
-
- spec/bson/binary_spec.rb
|
268
|
-
- spec/bson/array_spec.rb
|
269
|
-
- spec/bson/code_with_scope_spec.rb
|
270
|
-
- spec/bson/symbol_spec.rb
|
271
|
-
- spec/bson/float_spec.rb
|
272
|
-
- spec/bson/symbol_raw_spec.rb
|
273
|
-
- spec/bson/true_class_spec.rb
|
274
|
-
- spec/bson/integer_spec.rb
|
275
|
-
- spec/bson/binary_uuid_spec.rb
|
276
|
-
- spec/bson/time_spec.rb
|
277
|
-
- spec/bson/json_spec.rb
|
278
|
-
- spec/bson/date_time_spec.rb
|
279
|
-
- spec/bson/document_spec.rb
|
280
|
-
- spec/bson/byte_buffer_write_spec.rb
|
281
|
-
- spec/bson/min_key_spec.rb
|
282
|
-
- spec/bson/undefined_spec.rb
|
283
|
-
- spec/bson/registry_spec.rb
|
284
|
-
- spec/support/shared_examples.rb
|
285
|
-
- spec/support/spec_config.rb
|
286
|
-
- spec/support/utils.rb
|
287
|
-
- spec/spec_tests/data/corpus_legacy/code.json
|
288
|
-
- spec/spec_tests/data/corpus_legacy/code_w_scope.json
|
289
|
-
- spec/spec_tests/data/corpus_legacy/failures/symbol.json
|
290
|
-
- spec/spec_tests/data/corpus_legacy/failures/datetime.json
|
291
|
-
- spec/spec_tests/data/corpus_legacy/failures/int64.json
|
292
|
-
- spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
|
293
|
-
- spec/spec_tests/data/corpus_legacy/null.json
|
294
|
-
- spec/spec_tests/data/corpus_legacy/boolean.json
|
295
|
-
- spec/spec_tests/data/corpus_legacy/oid.json
|
296
|
-
- spec/spec_tests/data/corpus_legacy/regex.json
|
297
|
-
- spec/spec_tests/data/corpus_legacy/array.json
|
298
|
-
- spec/spec_tests/data/corpus_legacy/document.json
|
299
|
-
- spec/spec_tests/data/corpus_legacy/undefined.json
|
300
|
-
- spec/spec_tests/data/corpus_legacy/binary.json
|
301
|
-
- spec/spec_tests/data/corpus_legacy/minkey.json
|
302
|
-
- spec/spec_tests/data/corpus_legacy/maxkey.json
|
303
|
-
- spec/spec_tests/data/corpus_legacy/int32.json
|
304
|
-
- spec/spec_tests/data/corpus_legacy/timestamp.json
|
305
|
-
- spec/spec_tests/data/corpus_legacy/top.json
|
306
|
-
- spec/spec_tests/data/corpus_legacy/string.json
|
307
|
-
- spec/spec_tests/data/corpus_legacy/double.json
|
308
|
-
- spec/spec_tests/data/corpus/code.json
|
309
|
-
- spec/spec_tests/data/corpus/code_w_scope.json
|
310
|
-
- spec/spec_tests/data/corpus/decimal128-1.json
|
311
|
-
- spec/spec_tests/data/corpus/null.json
|
312
|
-
- spec/spec_tests/data/corpus/multi-type.json
|
313
|
-
- spec/spec_tests/data/corpus/boolean.json
|
314
|
-
- spec/spec_tests/data/corpus/symbol.json
|
315
|
-
- spec/spec_tests/data/corpus/datetime.json
|
316
|
-
- spec/spec_tests/data/corpus/oid.json
|
317
|
-
- spec/spec_tests/data/corpus/regex.json
|
318
|
-
- spec/spec_tests/data/corpus/int64.json
|
319
|
-
- spec/spec_tests/data/corpus/decimal128-7.json
|
243
|
+
- spec/spec_tests/common_driver_spec.rb
|
244
|
+
- spec/spec_tests/corpus_legacy_spec.rb
|
320
245
|
- spec/spec_tests/data/corpus/array.json
|
321
|
-
- spec/spec_tests/data/corpus/decimal128-3.json
|
322
|
-
- spec/spec_tests/data/corpus/decimal128-5.json
|
323
246
|
- spec/spec_tests/data/corpus/document.json
|
324
|
-
- spec/spec_tests/data/corpus/
|
325
|
-
- spec/spec_tests/data/corpus/
|
247
|
+
- spec/spec_tests/data/corpus/decimal128-7.json
|
248
|
+
- spec/spec_tests/data/corpus/decimal128-3.json
|
249
|
+
- spec/spec_tests/data/corpus/maxkey.json
|
250
|
+
- spec/spec_tests/data/corpus/code.json
|
326
251
|
- spec/spec_tests/data/corpus/dbpointer.json
|
252
|
+
- spec/spec_tests/data/corpus/int32.json
|
253
|
+
- spec/spec_tests/data/corpus/README.md
|
254
|
+
- spec/spec_tests/data/corpus/decimal128-5.json
|
327
255
|
- spec/spec_tests/data/corpus/decimal128-4.json
|
328
|
-
- spec/spec_tests/data/corpus/
|
256
|
+
- spec/spec_tests/data/corpus/decimal128-2.json
|
257
|
+
- spec/spec_tests/data/corpus/double.json
|
258
|
+
- spec/spec_tests/data/corpus/code_w_scope.json
|
259
|
+
- spec/spec_tests/data/corpus/binary.json
|
260
|
+
- spec/spec_tests/data/corpus/oid.json
|
261
|
+
- spec/spec_tests/data/corpus/null.json
|
329
262
|
- spec/spec_tests/data/corpus/decimal128-6.json
|
263
|
+
- spec/spec_tests/data/corpus/int64.json
|
330
264
|
- spec/spec_tests/data/corpus/dbref.json
|
331
|
-
- spec/spec_tests/data/corpus/
|
265
|
+
- spec/spec_tests/data/corpus/regex.json
|
332
266
|
- spec/spec_tests/data/corpus/minkey.json
|
333
|
-
- spec/spec_tests/data/corpus/
|
334
|
-
- spec/spec_tests/data/corpus/maxkey.json
|
335
|
-
- spec/spec_tests/data/corpus/int32.json
|
336
|
-
- spec/spec_tests/data/corpus/timestamp.json
|
267
|
+
- spec/spec_tests/data/corpus/multi-type.json
|
337
268
|
- spec/spec_tests/data/corpus/top.json
|
269
|
+
- spec/spec_tests/data/corpus/symbol.json
|
270
|
+
- spec/spec_tests/data/corpus/multi-type-deprecated.json
|
271
|
+
- spec/spec_tests/data/corpus/undefined.json
|
272
|
+
- spec/spec_tests/data/corpus/datetime.json
|
338
273
|
- spec/spec_tests/data/corpus/string.json
|
339
|
-
- spec/spec_tests/data/corpus/
|
340
|
-
- spec/spec_tests/data/
|
274
|
+
- spec/spec_tests/data/corpus/boolean.json
|
275
|
+
- spec/spec_tests/data/corpus/timestamp.json
|
276
|
+
- spec/spec_tests/data/corpus/decimal128-1.json
|
341
277
|
- spec/spec_tests/data/decimal128/decimal128-7.json
|
342
278
|
- spec/spec_tests/data/decimal128/decimal128-3.json
|
343
279
|
- spec/spec_tests/data/decimal128/decimal128-5.json
|
344
280
|
- spec/spec_tests/data/decimal128/decimal128-4.json
|
345
|
-
- spec/spec_tests/data/decimal128/decimal128-6.json
|
346
281
|
- spec/spec_tests/data/decimal128/decimal128-2.json
|
347
|
-
- spec/spec_tests/
|
282
|
+
- spec/spec_tests/data/decimal128/decimal128-6.json
|
283
|
+
- spec/spec_tests/data/decimal128/decimal128-1.json
|
284
|
+
- spec/spec_tests/data/corpus_legacy/array.json
|
285
|
+
- spec/spec_tests/data/corpus_legacy/document.json
|
286
|
+
- spec/spec_tests/data/corpus_legacy/maxkey.json
|
287
|
+
- spec/spec_tests/data/corpus_legacy/code.json
|
288
|
+
- spec/spec_tests/data/corpus_legacy/int32.json
|
289
|
+
- spec/spec_tests/data/corpus_legacy/double.json
|
290
|
+
- spec/spec_tests/data/corpus_legacy/code_w_scope.json
|
291
|
+
- spec/spec_tests/data/corpus_legacy/binary.json
|
292
|
+
- spec/spec_tests/data/corpus_legacy/oid.json
|
293
|
+
- spec/spec_tests/data/corpus_legacy/null.json
|
294
|
+
- spec/spec_tests/data/corpus_legacy/regex.json
|
295
|
+
- spec/spec_tests/data/corpus_legacy/minkey.json
|
296
|
+
- spec/spec_tests/data/corpus_legacy/top.json
|
297
|
+
- spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
|
298
|
+
- spec/spec_tests/data/corpus_legacy/failures/int64.json
|
299
|
+
- spec/spec_tests/data/corpus_legacy/failures/symbol.json
|
300
|
+
- spec/spec_tests/data/corpus_legacy/failures/datetime.json
|
301
|
+
- spec/spec_tests/data/corpus_legacy/undefined.json
|
302
|
+
- spec/spec_tests/data/corpus_legacy/string.json
|
303
|
+
- spec/spec_tests/data/corpus_legacy/boolean.json
|
304
|
+
- spec/spec_tests/data/corpus_legacy/timestamp.json
|
348
305
|
- spec/spec_tests/corpus_spec.rb
|
349
|
-
- spec/
|
350
|
-
- spec/
|
306
|
+
- spec/runners/corpus.rb
|
307
|
+
- spec/runners/corpus_legacy.rb
|
308
|
+
- spec/runners/common_driver.rb
|
351
309
|
- spec/spec_helper.rb
|
310
|
+
- spec/support/spec_config.rb
|
311
|
+
- spec/support/shared_examples.rb
|
312
|
+
- spec/support/utils.rb
|
313
|
+
- spec/bson/ext_json_parse_spec.rb
|
314
|
+
- spec/bson/object_spec.rb
|
315
|
+
- spec/bson/json_spec.rb
|
316
|
+
- spec/bson/true_class_spec.rb
|
317
|
+
- spec/bson/byte_buffer_read_spec.rb
|
318
|
+
- spec/bson/config_spec.rb
|
319
|
+
- spec/bson/int32_spec.rb
|
320
|
+
- spec/bson/regexp_spec.rb
|
321
|
+
- spec/bson/symbol_raw_spec.rb
|
322
|
+
- spec/bson/open_struct_spec.rb
|
323
|
+
- spec/bson/document_spec.rb
|
324
|
+
- spec/bson/min_key_spec.rb
|
325
|
+
- spec/bson/false_class_spec.rb
|
326
|
+
- spec/bson/code_spec.rb
|
327
|
+
- spec/bson/symbol_spec.rb
|
328
|
+
- spec/bson/object_id_spec.rb
|
329
|
+
- spec/bson/decimal128_spec.rb
|
330
|
+
- spec/bson/registry_spec.rb
|
331
|
+
- spec/bson/time_spec.rb
|
332
|
+
- spec/bson/boolean_spec.rb
|
333
|
+
- spec/bson/byte_buffer_spec.rb
|
334
|
+
- spec/bson/hash_spec.rb
|
335
|
+
- spec/bson/undefined_spec.rb
|
336
|
+
- spec/bson/raw_spec.rb
|
337
|
+
- spec/bson/string_spec.rb
|
338
|
+
- spec/bson/timestamp_spec.rb
|
339
|
+
- spec/bson/date_time_spec.rb
|
340
|
+
- spec/bson/max_key_spec.rb
|
341
|
+
- spec/bson/int64_spec.rb
|
342
|
+
- spec/bson/byte_buffer_write_spec.rb
|
343
|
+
- spec/bson/date_spec.rb
|
344
|
+
- spec/bson/binary_spec.rb
|
345
|
+
- spec/bson/code_with_scope_spec.rb
|
346
|
+
- spec/bson/integer_spec.rb
|
347
|
+
- spec/bson/binary_uuid_spec.rb
|
348
|
+
- spec/bson/nil_class_spec.rb
|
349
|
+
- spec/bson/array_spec.rb
|
350
|
+
- spec/bson/time_with_zone_spec.rb
|
351
|
+
- spec/bson/float_spec.rb
|
352
|
+
- spec/bson_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|