bson 4.1.1 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +106 -7
- data/Rakefile +86 -43
- data/ext/bson/{native-endian.h → bson-endian.h} +14 -107
- data/ext/bson/bson-native.h +135 -0
- data/ext/bson/bytebuf.c +133 -0
- data/ext/bson/endian.c +117 -0
- data/ext/bson/extconf.rb +8 -3
- data/ext/bson/init.c +364 -0
- data/ext/bson/libbson-utf8.c +230 -0
- data/ext/bson/read.c +470 -0
- data/ext/bson/util.c +250 -0
- data/ext/bson/write.c +675 -0
- data/lib/bson/active_support.rb +19 -0
- data/lib/bson/array.rb +97 -30
- data/lib/bson/big_decimal.rb +77 -0
- data/lib/bson/binary.rb +510 -70
- data/lib/bson/boolean.rb +15 -4
- data/lib/bson/code.rb +25 -12
- data/lib/bson/code_with_scope.rb +41 -15
- data/lib/bson/config.rb +3 -28
- data/lib/bson/date.rb +16 -4
- data/lib/bson/date_time.rb +6 -4
- data/lib/bson/db_pointer.rb +110 -0
- data/lib/bson/dbref.rb +154 -0
- data/lib/bson/decimal128/builder.rb +456 -0
- data/lib/bson/decimal128.rb +272 -0
- data/lib/bson/document.rb +177 -7
- data/lib/bson/environment.rb +17 -2
- data/lib/bson/error/bson_decode_error.rb +11 -0
- data/lib/bson/error/ext_json_parse_error.rb +11 -0
- data/lib/bson/error/illegal_key.rb +23 -0
- data/lib/bson/error/invalid_binary_type.rb +37 -0
- data/lib/bson/error/invalid_dbref_argument.rb +12 -0
- data/lib/bson/error/invalid_decimal128_argument.rb +25 -0
- data/lib/bson/error/invalid_decimal128_range.rb +27 -0
- data/lib/bson/error/invalid_decimal128_string.rb +26 -0
- data/lib/bson/error/invalid_key.rb +24 -0
- data/lib/bson/error/invalid_object_id.rb +11 -0
- data/lib/bson/error/invalid_regexp_pattern.rb +13 -0
- data/lib/bson/error/unrepresentable_precision.rb +19 -0
- data/lib/bson/error/unserializable_class.rb +13 -0
- data/lib/bson/error/unsupported_binary_subtype.rb +12 -0
- data/lib/bson/error/unsupported_type.rb +11 -0
- data/lib/bson/error.rb +22 -0
- data/lib/bson/ext_json.rb +389 -0
- data/lib/bson/false_class.rb +6 -4
- data/lib/bson/float.rb +43 -7
- data/lib/bson/hash.rb +152 -37
- data/lib/bson/int32.rb +104 -6
- data/lib/bson/int64.rb +111 -8
- data/lib/bson/integer.rb +43 -9
- data/lib/bson/json.rb +3 -1
- data/lib/bson/max_key.rb +21 -10
- data/lib/bson/min_key.rb +21 -10
- data/lib/bson/nil_class.rb +7 -3
- data/lib/bson/object.rb +25 -17
- data/lib/bson/object_id.rb +98 -113
- data/lib/bson/open_struct.rb +59 -0
- data/lib/bson/regexp.rb +129 -56
- data/lib/bson/registry.rb +7 -10
- data/lib/bson/specialized.rb +8 -4
- data/lib/bson/string.rb +12 -32
- data/lib/bson/symbol.rb +107 -11
- data/lib/bson/time.rb +68 -7
- data/lib/bson/time_with_zone.rb +67 -0
- data/lib/bson/timestamp.rb +50 -10
- data/lib/bson/true_class.rb +6 -4
- data/lib/bson/undefined.rb +28 -2
- data/lib/bson/vector.rb +44 -0
- data/lib/bson/version.rb +6 -14
- data/lib/bson.rb +22 -12
- data/spec/README.md +14 -0
- data/spec/bson/array_spec.rb +38 -62
- data/spec/bson/big_decimal_spec.rb +328 -0
- data/spec/bson/binary_spec.rb +199 -53
- data/spec/bson/binary_uuid_spec.rb +190 -0
- data/spec/bson/boolean_spec.rb +2 -1
- data/spec/bson/byte_buffer_read_spec.rb +198 -0
- data/spec/bson/byte_buffer_spec.rb +122 -381
- data/spec/bson/byte_buffer_write_spec.rb +855 -0
- data/spec/bson/code_spec.rb +6 -4
- data/spec/bson/code_with_scope_spec.rb +6 -4
- data/spec/bson/config_spec.rb +1 -35
- data/spec/bson/date_spec.rb +2 -1
- data/spec/bson/date_time_spec.rb +55 -1
- data/spec/bson/dbref_legacy_spec.rb +186 -0
- data/spec/bson/dbref_spec.rb +487 -0
- data/spec/bson/decimal128_spec.rb +1840 -0
- data/spec/bson/document_as_spec.rb +61 -0
- data/spec/bson/document_spec.rb +205 -32
- data/spec/bson/ext_json_parse_spec.rb +346 -0
- data/spec/bson/false_class_spec.rb +9 -1
- data/spec/bson/float_spec.rb +42 -1
- data/spec/bson/hash_as_spec.rb +58 -0
- data/spec/bson/hash_spec.rb +318 -66
- data/spec/bson/int32_spec.rb +248 -1
- data/spec/bson/int64_spec.rb +308 -1
- data/spec/bson/integer_spec.rb +61 -3
- data/spec/bson/json_spec.rb +2 -1
- data/spec/bson/max_key_spec.rb +6 -4
- data/spec/bson/min_key_spec.rb +6 -4
- data/spec/bson/nil_class_spec.rb +2 -1
- data/spec/bson/object_id_spec.rb +95 -5
- data/spec/bson/object_spec.rb +3 -2
- data/spec/bson/open_struct_spec.rb +87 -0
- data/spec/bson/raw_spec.rb +594 -0
- data/spec/bson/regexp_spec.rb +61 -8
- data/spec/bson/registry_spec.rb +3 -2
- data/spec/bson/string_spec.rb +26 -33
- data/spec/bson/symbol_raw_spec.rb +70 -0
- data/spec/bson/symbol_spec.rb +77 -20
- data/spec/bson/time_spec.rb +206 -2
- data/spec/bson/time_with_zone_spec.rb +69 -0
- data/spec/bson/timestamp_spec.rb +58 -2
- data/spec/bson/true_class_spec.rb +9 -1
- data/spec/bson/undefined_spec.rb +28 -1
- data/spec/bson/vector_spec.rb +33 -0
- data/spec/bson_spec.rb +2 -1
- data/spec/runners/binary_vector.rb +78 -0
- data/spec/runners/common_driver.rb +348 -0
- data/spec/runners/corpus.rb +191 -0
- data/spec/runners/corpus_legacy.rb +248 -0
- data/spec/shared/LICENSE +20 -0
- data/spec/shared/bin/get-mongodb-download-url +17 -0
- data/spec/shared/bin/s3-copy +45 -0
- data/spec/shared/bin/s3-upload +69 -0
- data/spec/shared/lib/mrss/child_process_helper.rb +80 -0
- data/spec/shared/lib/mrss/cluster_config.rb +231 -0
- data/spec/shared/lib/mrss/constraints.rb +378 -0
- data/spec/shared/lib/mrss/docker_runner.rb +298 -0
- data/spec/shared/lib/mrss/eg_config_utils.rb +51 -0
- data/spec/shared/lib/mrss/event_subscriber.rb +210 -0
- data/spec/shared/lib/mrss/lite_constraints.rb +238 -0
- data/spec/shared/lib/mrss/release/candidate.rb +281 -0
- data/spec/shared/lib/mrss/release/product_data.rb +144 -0
- data/spec/shared/lib/mrss/server_version_registry.rb +113 -0
- data/spec/shared/lib/mrss/session_registry.rb +69 -0
- data/spec/shared/lib/mrss/session_registry_legacy.rb +60 -0
- data/spec/shared/lib/mrss/spec_organizer.rb +179 -0
- data/spec/shared/lib/mrss/utils.rb +37 -0
- data/spec/shared/lib/tasks/candidate.rake +64 -0
- data/spec/shared/share/Dockerfile.erb +251 -0
- data/spec/shared/share/haproxy-1.conf +16 -0
- data/spec/shared/share/haproxy-2.conf +17 -0
- data/spec/shared/shlib/config.sh +27 -0
- data/spec/shared/shlib/distro.sh +84 -0
- data/spec/shared/shlib/server.sh +423 -0
- data/spec/shared/shlib/set_env.sh +110 -0
- data/spec/spec_helper.rb +61 -1
- data/spec/spec_tests/binary_vector_spec.rb +82 -0
- data/spec/spec_tests/common_driver_spec.rb +84 -0
- data/spec/spec_tests/corpus_legacy_spec.rb +72 -0
- data/spec/spec_tests/corpus_spec.rb +134 -0
- data/spec/spec_tests/data/binary_vector/README.md +61 -0
- data/spec/spec_tests/data/binary_vector/float32.json +65 -0
- data/spec/spec_tests/data/binary_vector/int8.json +57 -0
- data/spec/spec_tests/data/binary_vector/packed_bit.json +83 -0
- data/spec/spec_tests/data/corpus/README.md +15 -0
- data/spec/spec_tests/data/corpus/array.json +49 -0
- data/spec/spec_tests/data/corpus/binary.json +153 -0
- data/spec/spec_tests/data/corpus/boolean.json +27 -0
- data/spec/spec_tests/data/corpus/code.json +67 -0
- data/spec/spec_tests/data/corpus/code_w_scope.json +78 -0
- data/spec/spec_tests/data/corpus/datetime.json +42 -0
- data/spec/spec_tests/data/corpus/dbpointer.json +56 -0
- data/spec/spec_tests/data/corpus/dbref.json +51 -0
- data/spec/spec_tests/data/corpus/decimal128-1.json +317 -0
- data/spec/spec_tests/data/corpus/decimal128-2.json +793 -0
- data/spec/spec_tests/data/corpus/decimal128-3.json +1771 -0
- data/spec/spec_tests/data/corpus/decimal128-4.json +165 -0
- data/spec/spec_tests/data/corpus/decimal128-5.json +402 -0
- data/spec/spec_tests/data/corpus/decimal128-6.json +131 -0
- data/spec/spec_tests/data/corpus/decimal128-7.json +327 -0
- data/spec/spec_tests/data/corpus/document.json +60 -0
- data/spec/spec_tests/data/corpus/double.json +87 -0
- data/spec/spec_tests/data/corpus/int32.json +43 -0
- data/spec/spec_tests/data/corpus/int64.json +43 -0
- data/spec/spec_tests/data/corpus/maxkey.json +12 -0
- data/spec/spec_tests/data/corpus/minkey.json +12 -0
- data/spec/spec_tests/data/corpus/multi-type-deprecated.json +15 -0
- data/spec/spec_tests/data/corpus/multi-type.json +11 -0
- data/spec/spec_tests/data/corpus/null.json +12 -0
- data/spec/spec_tests/data/corpus/oid.json +28 -0
- data/spec/spec_tests/data/corpus/regex.json +65 -0
- data/spec/spec_tests/data/corpus/string.json +72 -0
- data/spec/spec_tests/data/corpus/symbol.json +80 -0
- data/spec/spec_tests/data/corpus/timestamp.json +34 -0
- data/spec/spec_tests/data/corpus/top.json +262 -0
- data/spec/spec_tests/data/corpus/undefined.json +15 -0
- data/spec/spec_tests/data/corpus_legacy/array.json +49 -0
- data/spec/spec_tests/data/corpus_legacy/binary.json +69 -0
- data/spec/spec_tests/data/corpus_legacy/boolean.json +27 -0
- data/spec/spec_tests/data/corpus_legacy/code.json +67 -0
- data/spec/spec_tests/data/corpus_legacy/code_w_scope.json +78 -0
- data/spec/spec_tests/data/corpus_legacy/document.json +36 -0
- data/spec/spec_tests/data/corpus_legacy/double.json +69 -0
- data/spec/spec_tests/data/corpus_legacy/failures/datetime.json +31 -0
- data/spec/spec_tests/data/corpus_legacy/failures/dbpointer.json +42 -0
- data/spec/spec_tests/data/corpus_legacy/failures/int64.json +38 -0
- data/spec/spec_tests/data/corpus_legacy/failures/symbol.json +62 -0
- data/spec/spec_tests/data/corpus_legacy/int32.json +38 -0
- data/spec/spec_tests/data/corpus_legacy/maxkey.json +12 -0
- data/spec/spec_tests/data/corpus_legacy/minkey.json +12 -0
- data/spec/spec_tests/data/corpus_legacy/null.json +12 -0
- data/spec/spec_tests/data/corpus_legacy/oid.json +28 -0
- data/spec/spec_tests/data/corpus_legacy/regex.json +37 -0
- data/spec/spec_tests/data/corpus_legacy/string.json +67 -0
- data/spec/spec_tests/data/corpus_legacy/timestamp.json +18 -0
- data/spec/spec_tests/data/corpus_legacy/top.json +62 -0
- data/spec/spec_tests/data/corpus_legacy/undefined.json +13 -0
- data/spec/spec_tests/data/decimal128/decimal128-1.json +363 -0
- data/spec/spec_tests/data/decimal128/decimal128-2.json +793 -0
- data/spec/spec_tests/data/decimal128/decimal128-3.json +1771 -0
- data/spec/spec_tests/data/decimal128/decimal128-4.json +165 -0
- data/spec/spec_tests/data/decimal128/decimal128-5.json +402 -0
- data/spec/spec_tests/data/decimal128/decimal128-6.json +131 -0
- data/spec/spec_tests/data/decimal128/decimal128-7.json +327 -0
- data/spec/support/shared_examples.rb +32 -11
- data/spec/support/spec_config.rb +17 -0
- data/spec/support/utils.rb +58 -0
- metadata +284 -45
- checksums.yaml.gz.sig +0 -3
- data/ext/bson/native.c +0 -722
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f383730000f9b08a131535250a7855d8ec8dcb0e3bb334f4779dcdcc95b56023
|
|
4
|
+
data.tar.gz: 57cb5e6db027b6982263d4f4eb0228968b6fc71e6b6499ef5563c0a160a3b2b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 433d3758ccd6ad9222b98bf43a4746b71b5966d6eb01321dff869eca61acef89e58b42baae0bd9c979d41cc922b4baf227ae0b71fdc4f21d37b0d3ec7137a85b
|
|
7
|
+
data.tar.gz: 7f61000684c0acb7af4d2d50c3e2cbc1e47ab342c415fc91addf7e1c5533cb3e23cfe4d16ba2ccd5dea72d70d8a89698eec3f4520fee3320c3c64c7aec95f10d
|
data/README.md
CHANGED
|
@@ -1,38 +1,132 @@
|
|
|
1
|
-
BSON
|
|
1
|
+
BSON
|
|
2
|
+
[![Gem Version][rubygems-img]][rubygems-url]
|
|
3
|
+
[![Build Status][ghactions-img]][ghactions-url]
|
|
2
4
|
====
|
|
3
5
|
|
|
4
6
|
An implementation of the BSON specification in Ruby.
|
|
5
7
|
|
|
8
|
+
Installation
|
|
9
|
+
------------
|
|
10
|
+
|
|
11
|
+
BSON can be installed via RubyGems:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
> gem install bson
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or by adding it to your project's Gemfile:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem 'bson'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Release Integrity
|
|
24
|
+
|
|
25
|
+
Each release of the BSON library for Ruby after version 5.0.0 has been automatically built and signed using the team's GPG key.
|
|
26
|
+
|
|
27
|
+
To verify the bson gem file:
|
|
28
|
+
|
|
29
|
+
1. [Download the GPG key](https://pgp.mongodb.com/ruby-driver.asc).
|
|
30
|
+
2. Import the key into your GPG keyring with `gpg --import ruby-driver.asc`.
|
|
31
|
+
3. Download the gem file (if you don't already have it). You can download it from RubyGems with `gem fetch bson`, or you can download it from the [releases page](https://github.com/mongodb/bson-ruby/releases) on GitHub.
|
|
32
|
+
4. Download the corresponding detached signature file from the [same release](https://github.com/mongodb/bson-ruby/releases). Look at the bottom of the release that corresponds to the gem file, under the 'Assets' list, for a `.sig` file with the same version number as the gem you wish to install.
|
|
33
|
+
5. Verify the gem with `gpg --verify bson-X.Y.Z.gem.sig bson-X.Y.Z.gem` (replacing `X.Y.Z` with the actual version number).
|
|
34
|
+
|
|
35
|
+
You are looking for text like "Good signature from "MongoDB Ruby Driver Release Signing Key <packaging@mongodb.com>" in the output. If you see that, the signature was found to correspond to the given gem file.
|
|
36
|
+
|
|
37
|
+
(Note that other output, like "This key is not certified with a trusted signature!", is related to *web of trust* and depends on how strongly you, personally, trust the `ruby-driver.asc` key that you downloaded from us. To learn more, see https://www.gnupg.org/gph/en/manual/x334.html)
|
|
38
|
+
|
|
39
|
+
### Why not use RubyGems' gem-signing functionality?
|
|
40
|
+
|
|
41
|
+
RubyGems' own gem signing is problematic, most significantly because there is no established chain of trust related to the keys used to sign gems. RubyGems' own documentation admits that "this method of signing gems is not widely used" (see https://guides.rubygems.org/security/). Discussions about this in the RubyGems community have been off-and-on for more than a decade, and while a solution will eventually arrive, we have settled on using GPG instead for the following reasons:
|
|
42
|
+
|
|
43
|
+
1. Many of the other driver teams at MongoDB are using GPG to sign their product releases. Consistency with the other teams means that we can reuse existing tooling for our own product releases.
|
|
44
|
+
2. GPG is widely available and has existing tools and procedures for dealing with web of trust (though they are admittedly quite arcane and intimidating to the uninitiated, unfortunately).
|
|
45
|
+
|
|
46
|
+
Ultimately, most users do not bother to verify gems, and will not be impacted by our choice of GPG over RubyGems' native method.
|
|
47
|
+
|
|
6
48
|
Compatibility
|
|
7
49
|
-------------
|
|
8
50
|
|
|
9
|
-
BSON is tested against MRI (
|
|
51
|
+
BSON is tested against MRI (2.7+) and JRuby (9.3+).
|
|
10
52
|
|
|
11
53
|
Documentation
|
|
12
54
|
-------------
|
|
13
55
|
|
|
14
|
-
Current documentation can be found
|
|
56
|
+
Current documentation can be found
|
|
57
|
+
[here](https://www.mongodb.com/docs/ruby-driver/current/bson-tutorials/).
|
|
15
58
|
|
|
16
59
|
API Documentation
|
|
17
60
|
-----------------
|
|
18
61
|
|
|
19
|
-
The [API Documentation](
|
|
20
|
-
located at
|
|
62
|
+
The [API Documentation](https://www.mongodb.com/docs/ruby-driver/master/api/) is
|
|
63
|
+
located at mongodb.com/docs.
|
|
21
64
|
|
|
22
65
|
BSON Specification
|
|
23
66
|
------------------
|
|
24
67
|
|
|
25
68
|
The [BSON specification](http://bsonspec.org) is at bsonspec.org.
|
|
26
69
|
|
|
70
|
+
## Bugs & Feature Requests
|
|
71
|
+
|
|
72
|
+
To report a bug in the `bson` gem or request a feature:
|
|
73
|
+
|
|
74
|
+
1. Visit [our issue tracker](https://jira.mongodb.org/) and login
|
|
75
|
+
(or create an account if you do not have one already).
|
|
76
|
+
2. Navigate to the [RUBY project](https://jira.mongodb.org/browse/RUBY).
|
|
77
|
+
3. Click 'Create Issue' and fill out all of the applicable form fields, making
|
|
78
|
+
sure to select `BSON` in the _Component/s_ field.
|
|
79
|
+
|
|
80
|
+
When creating an issue, please keep in mind that all information in JIRA
|
|
81
|
+
for the RUBY project, as well as the core server (the SERVER project),
|
|
82
|
+
is publicly visible.
|
|
83
|
+
|
|
84
|
+
**PLEASE DO:**
|
|
85
|
+
|
|
86
|
+
- Provide as much information as possible about the issue.
|
|
87
|
+
- Provide detailed steps for reproducing the issue.
|
|
88
|
+
- Provide any applicable code snippets, stack traces and log data.
|
|
89
|
+
- Specify version numbers of the `bson` gem and/or Ruby driver and MongoDB
|
|
90
|
+
server.
|
|
91
|
+
|
|
92
|
+
**PLEASE DO NOT:**
|
|
93
|
+
|
|
94
|
+
- Provide any sensitive data or server logs.
|
|
95
|
+
- Report potential security issues publicly (see 'Security Issues' below).
|
|
96
|
+
|
|
97
|
+
## Security Issues
|
|
98
|
+
|
|
99
|
+
If you have identified a potential security-related issue in the `bson` gem
|
|
100
|
+
(or any other MongoDB product), please report it by following the
|
|
101
|
+
[instructions here](https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report).
|
|
102
|
+
|
|
103
|
+
## Product Feature Requests
|
|
104
|
+
|
|
105
|
+
To request a feature which is not specific to the `bson` gem, or which
|
|
106
|
+
affects more than the `bson` gem and/or Ruby driver alone (for example, a
|
|
107
|
+
feature which requires MongoDB server support), please submit your idea through
|
|
108
|
+
the [MongoDB Feedback Forum](https://feedback.mongodb.com/forums/924286-drivers).
|
|
109
|
+
|
|
110
|
+
## Maintenance and Bug Fix Policy
|
|
111
|
+
|
|
112
|
+
New library functionality is generally added in a backwards-compatible manner
|
|
113
|
+
and results in new minor releases. Bug fixes are generally made on
|
|
114
|
+
master first and are backported to the current minor library release. Exceptions
|
|
115
|
+
may be made on a case-by-case basis, for example security fixes may be
|
|
116
|
+
backported to older stable branches. Only the most recent minor release
|
|
117
|
+
is officially supported. Customers should use the most recent release in
|
|
118
|
+
their applications.
|
|
119
|
+
|
|
27
120
|
Versioning
|
|
28
121
|
----------
|
|
29
122
|
|
|
30
|
-
As of 2.0.0, this project adheres to the
|
|
123
|
+
As of 2.0.0, this project adheres to the
|
|
124
|
+
[Semantic Versioning Specification](http://semver.org/).
|
|
31
125
|
|
|
32
126
|
License
|
|
33
127
|
-------
|
|
34
128
|
|
|
35
|
-
Copyright (C) 2009-
|
|
129
|
+
Copyright (C) 2009-2020 MongoDB Inc.
|
|
36
130
|
|
|
37
131
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
38
132
|
you may not use this file except in compliance with the License.
|
|
@@ -45,3 +139,8 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
45
139
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
46
140
|
See the License for the specific language governing permissions and
|
|
47
141
|
limitations under the License.
|
|
142
|
+
|
|
143
|
+
[rubygems-img]: https://badge.fury.io/rb/bson.svg
|
|
144
|
+
[rubygems-url]: http://badge.fury.io/rb/bson
|
|
145
|
+
[ghactions-img]: https://github.com/mongodb/bson-ruby/actions/workflows/bson-ruby.yml/badge.svg?query=branch%3Amaster
|
|
146
|
+
[ghactions-url]: https://github.com/mongodb/bson-ruby/actions/workflows/bson-ruby.yml?query=branch%3Amaster
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# rubocop:todo all
|
|
3
|
+
|
|
1
4
|
# Copyright (C) 2009-2013 MongoDB Inc.
|
|
2
5
|
#
|
|
3
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -20,6 +23,11 @@ $LOAD_PATH.unshift(File.expand_path("../lib", __FILE__))
|
|
|
20
23
|
require "rake"
|
|
21
24
|
require "rake/extensiontask"
|
|
22
25
|
require "rspec/core/rake_task"
|
|
26
|
+
require 'fileutils'
|
|
27
|
+
|
|
28
|
+
if File.exist?('./spec/shared/lib/tasks/candidate.rake')
|
|
29
|
+
load './spec/shared/lib/tasks/candidate.rake'
|
|
30
|
+
end
|
|
23
31
|
|
|
24
32
|
def jruby?
|
|
25
33
|
defined?(JRUBY_VERSION)
|
|
@@ -31,45 +39,40 @@ if jruby?
|
|
|
31
39
|
ext.name = "bson-ruby"
|
|
32
40
|
ext.ext_dir = "src"
|
|
33
41
|
ext.lib_dir = "lib"
|
|
42
|
+
ext.target_version = ENV['TARGET_VERSION'] if ENV['TARGET_VERSION']
|
|
43
|
+
ext.source_version = ENV['SOURCE_VERSION'] if ENV['SOURCE_VERSION']
|
|
34
44
|
end
|
|
35
45
|
else
|
|
36
46
|
require "rake/extensiontask"
|
|
37
47
|
Rake::ExtensionTask.new do |ext|
|
|
38
|
-
ext.name = "
|
|
48
|
+
ext.name = "bson_native"
|
|
39
49
|
ext.ext_dir = "ext/bson"
|
|
40
50
|
ext.lib_dir = "lib"
|
|
41
51
|
end
|
|
42
52
|
end
|
|
43
53
|
|
|
44
|
-
|
|
54
|
+
RSpec::Core::RakeTask.new(:rspec)
|
|
45
55
|
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
desc 'Build the bson gem'
|
|
57
|
+
task :build => [ :clean_all, *(jruby? ? :compile : nil) ] do
|
|
58
|
+
command = [ 'gem', 'build' ]
|
|
59
|
+
command << "--output=#{ENV['GEM_FILE_NAME']}" if ENV['GEM_FILE_NAME']
|
|
60
|
+
command << ENV['GEMSPEC'] || 'bson.gemspec'
|
|
61
|
+
system(*command)
|
|
48
62
|
end
|
|
49
63
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
else
|
|
59
|
-
task :build => :clean_all do
|
|
60
|
-
system "gem build bson.gemspec"
|
|
61
|
-
end
|
|
64
|
+
# `rake version` is used by the deployment system so get the release version
|
|
65
|
+
# of the product beng deployed. It must do nothing more than just print the
|
|
66
|
+
# product version number.
|
|
67
|
+
desc 'Print the current version of the Ruby-BSON library'
|
|
68
|
+
task :version do
|
|
69
|
+
require 'bson/version'
|
|
70
|
+
puts BSON::VERSION
|
|
62
71
|
end
|
|
63
72
|
|
|
64
73
|
task :clean_all => :clean do
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`rm native.#{extension}`
|
|
68
|
-
`rm native.o`
|
|
69
|
-
`rm bson-ruby.jar`
|
|
70
|
-
end
|
|
71
|
-
rescue Exception => e
|
|
72
|
-
puts e.message
|
|
74
|
+
%w[ bson-ruby.jar bson_native.bundle bson_native.so bson_native.o ].each do |file|
|
|
75
|
+
FileUtils.rm_f(File.join(File.dirname(__FILE__), 'lib', file))
|
|
73
76
|
end
|
|
74
77
|
end
|
|
75
78
|
|
|
@@ -77,37 +80,77 @@ task :spec => :compile do
|
|
|
77
80
|
Rake::Task["rspec"].invoke
|
|
78
81
|
end
|
|
79
82
|
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
# overrides the default Bundler-provided `release` task, which also
|
|
84
|
+
# builds the gem. Our release process assumes the gem has already
|
|
85
|
+
# been built (and signed via GPG), so we just need `rake release` to
|
|
86
|
+
# push the gem to rubygems.
|
|
87
|
+
task :release do
|
|
88
|
+
if ENV['GITHUB_ACTION'].nil?
|
|
89
|
+
abort <<~WARNING
|
|
90
|
+
`rake release` must be invoked from the `BSON Release` GitHub action,
|
|
91
|
+
and must not be invoked locally. This ensures the gem is properly signed
|
|
92
|
+
and distributed by the appropriate user.
|
|
93
|
+
|
|
94
|
+
Note that it is the `rubygems/release-gem@v1` step in the `BSON Release`
|
|
95
|
+
action that invokes this task. Do not rename or remove this task, or the
|
|
96
|
+
release-gem step will fail. Reimplement this task with caution.
|
|
97
|
+
|
|
98
|
+
NO GEMS were pushed to RubyGems.
|
|
99
|
+
WARNING
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# confirm: there ought to be two gems, one for MRI, and one for Java. These
|
|
103
|
+
# will have been previously generated by the 'build' job.
|
|
104
|
+
gems = Dir['*.gem']
|
|
105
|
+
if gems.length != 2
|
|
106
|
+
abort "Expected two gem files to be ready to release; got #{gems.inspect}"
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
gems.each do |gem|
|
|
110
|
+
system 'gem', 'push', gem
|
|
95
111
|
end
|
|
96
112
|
end
|
|
97
113
|
|
|
98
114
|
namespace :benchmark do
|
|
99
115
|
|
|
100
|
-
task :
|
|
116
|
+
task :prep do
|
|
117
|
+
require_relative "perf/bench"
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
task ruby: [ :clean_all, 'benchmark:prep' ] do
|
|
101
121
|
puts "Benchmarking pure Ruby..."
|
|
102
|
-
require "bson"
|
|
103
122
|
benchmark!
|
|
104
123
|
end
|
|
105
124
|
|
|
106
|
-
task :
|
|
125
|
+
task native: [ :compile, 'benchmark:prep' ] do
|
|
107
126
|
puts "Benchmarking with native extensions..."
|
|
108
|
-
require "bson"
|
|
109
127
|
benchmark!
|
|
110
128
|
end
|
|
129
|
+
|
|
130
|
+
namespace :decimal128 do
|
|
131
|
+
task from_string: 'benchmark:prep' do
|
|
132
|
+
puts "Benchmarking creating Decimal128 objects from a string"
|
|
133
|
+
benchmark_decimal128_from_string!
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
task to_string: 'benchmark:prep' do
|
|
137
|
+
puts "Benchmarking getting a string representation of a Decimal128"
|
|
138
|
+
benchmark_decimal128_to_string!
|
|
139
|
+
end
|
|
140
|
+
end
|
|
111
141
|
end
|
|
112
142
|
|
|
113
143
|
task :default => [ :clean_all, :spec ]
|
|
144
|
+
|
|
145
|
+
desc "Generate all documentation"
|
|
146
|
+
task :docs => 'docs:yard'
|
|
147
|
+
|
|
148
|
+
namespace :docs do
|
|
149
|
+
desc "Generate yard documention"
|
|
150
|
+
task :yard do
|
|
151
|
+
require 'bson/version'
|
|
152
|
+
out = File.join('yard-docs', BSON::VERSION)
|
|
153
|
+
FileUtils.rm_rf(out)
|
|
154
|
+
system "yardoc -o #{out} --title bson-#{BSON::VERSION}"
|
|
155
|
+
end
|
|
156
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright 2015 MongoDB
|
|
2
|
+
* Copyright (C) 2015-2020 MongoDB Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -35,13 +35,14 @@
|
|
|
35
35
|
# endif
|
|
36
36
|
#endif
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#endif
|
|
38
|
+
/* See a similar check in ruby's sha2.h */
|
|
39
|
+
# ifndef BSON_BYTE_ORDER
|
|
40
|
+
# ifdef WORDS_BIGENDIAN
|
|
41
|
+
# define BSON_BYTE_ORDER BSON_BIG_ENDIAN
|
|
42
|
+
# else
|
|
43
|
+
# define BSON_BYTE_ORDER BSON_LITTLE_ENDIAN
|
|
44
|
+
# endif
|
|
45
|
+
# endif /* BSON_BYTE_ORDER */
|
|
45
46
|
|
|
46
47
|
#if defined(__sun)
|
|
47
48
|
# define BSON_UINT16_SWAP_LE_BE(v) __bson_uint16_swap_slow((uint16_t)v)
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
# define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64(v)
|
|
60
61
|
# endif
|
|
61
62
|
#elif defined(__GNUC__) && (__GNUC__ >= 4)
|
|
62
|
-
# if __GNUC__
|
|
63
|
+
# if __GNUC__ > 4 || (defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3)
|
|
63
64
|
# define BSON_UINT32_SWAP_LE_BE(v) __builtin_bswap32 ((uint32_t)v)
|
|
64
65
|
# define BSON_UINT64_SWAP_LE_BE(v) __builtin_bswap64 ((uint64_t)v)
|
|
65
66
|
# endif
|
|
@@ -105,101 +106,7 @@
|
|
|
105
106
|
# error "The endianness of target architecture is unknown."
|
|
106
107
|
#endif
|
|
107
108
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
* Fallback endianness conversion for 16-bit integers.
|
|
114
|
-
*
|
|
115
|
-
* Returns:
|
|
116
|
-
* The endian swapped version.
|
|
117
|
-
*
|
|
118
|
-
* Side effects:
|
|
119
|
-
* None.
|
|
120
|
-
*
|
|
121
|
-
*--------------------------------------------------------------------------
|
|
122
|
-
*/
|
|
123
|
-
static uint16_t __bson_uint16_swap_slow(uint16_t v)
|
|
124
|
-
{
|
|
125
|
-
return ((v & 0x00FF) << 8) |
|
|
126
|
-
((v & 0xFF00) >> 8);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/*
|
|
130
|
-
*--------------------------------------------------------------------------
|
|
131
|
-
*
|
|
132
|
-
* __bson_uint32_swap_slow --
|
|
133
|
-
*
|
|
134
|
-
* Fallback endianness conversion for 32-bit integers.
|
|
135
|
-
*
|
|
136
|
-
* Returns:
|
|
137
|
-
* The endian swapped version.
|
|
138
|
-
*
|
|
139
|
-
* Side effects:
|
|
140
|
-
* None.
|
|
141
|
-
*
|
|
142
|
-
*--------------------------------------------------------------------------
|
|
143
|
-
*/
|
|
144
|
-
static uint32_t __bson_uint32_swap_slow(uint32_t v)
|
|
145
|
-
{
|
|
146
|
-
return ((v & 0x000000FFU) << 24) |
|
|
147
|
-
((v & 0x0000FF00U) << 8) |
|
|
148
|
-
((v & 0x00FF0000U) >> 8) |
|
|
149
|
-
((v & 0xFF000000U) >> 24);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/*
|
|
154
|
-
*--------------------------------------------------------------------------
|
|
155
|
-
*
|
|
156
|
-
* __bson_uint64_swap_slow --
|
|
157
|
-
*
|
|
158
|
-
* Fallback endianness conversion for 64-bit integers.
|
|
159
|
-
*
|
|
160
|
-
* Returns:
|
|
161
|
-
* The endian swapped version.
|
|
162
|
-
*
|
|
163
|
-
* Side effects:
|
|
164
|
-
* None.
|
|
165
|
-
*
|
|
166
|
-
*--------------------------------------------------------------------------
|
|
167
|
-
*/
|
|
168
|
-
static uint64_t __bson_uint64_swap_slow(uint64_t v)
|
|
169
|
-
{
|
|
170
|
-
return ((v & 0x00000000000000FFULL) << 56) |
|
|
171
|
-
((v & 0x000000000000FF00ULL) << 40) |
|
|
172
|
-
((v & 0x0000000000FF0000ULL) << 24) |
|
|
173
|
-
((v & 0x00000000FF000000ULL) << 8) |
|
|
174
|
-
((v & 0x000000FF00000000ULL) >> 8) |
|
|
175
|
-
((v & 0x0000FF0000000000ULL) >> 24) |
|
|
176
|
-
((v & 0x00FF000000000000ULL) >> 40) |
|
|
177
|
-
((v & 0xFF00000000000000ULL) >> 56);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/*
|
|
181
|
-
*--------------------------------------------------------------------------
|
|
182
|
-
*
|
|
183
|
-
* __bson_double_swap_slow --
|
|
184
|
-
*
|
|
185
|
-
* Fallback endianness conversion for double floating point.
|
|
186
|
-
*
|
|
187
|
-
* Returns:
|
|
188
|
-
* The endian swapped version.
|
|
189
|
-
*
|
|
190
|
-
* Side effects:
|
|
191
|
-
* None.
|
|
192
|
-
*
|
|
193
|
-
*--------------------------------------------------------------------------
|
|
194
|
-
*/
|
|
195
|
-
static double __bson_double_swap_slow(double v)
|
|
196
|
-
{
|
|
197
|
-
uint64_t uv;
|
|
198
|
-
|
|
199
|
-
memcpy(&uv, &v, sizeof(v));
|
|
200
|
-
uv = BSON_UINT64_SWAP_LE_BE(uv);
|
|
201
|
-
memcpy(&v, &uv, sizeof(v));
|
|
202
|
-
|
|
203
|
-
return v;
|
|
204
|
-
}
|
|
205
|
-
|
|
109
|
+
uint16_t __bson_uint16_swap_slow(uint16_t v);
|
|
110
|
+
uint32_t __bson_uint32_swap_slow(uint32_t v);
|
|
111
|
+
uint64_t __bson_uint64_swap_slow(uint64_t v);
|
|
112
|
+
double __bson_double_swap_slow(double v);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2009-2020 MongoDB 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
|
+
#include <ruby.h>
|
|
18
|
+
#include <stdbool.h>
|
|
19
|
+
#include <stdint.h>
|
|
20
|
+
#include <stdlib.h>
|
|
21
|
+
#include <unistd.h>
|
|
22
|
+
#include <time.h>
|
|
23
|
+
#include "bson-endian.h"
|
|
24
|
+
|
|
25
|
+
void
|
|
26
|
+
rb_bson_utf8_validate (const char *utf8, /* IN */
|
|
27
|
+
size_t utf8_len, /* IN */
|
|
28
|
+
bool allow_null, /* IN */
|
|
29
|
+
const char *data_type); /* IN */
|
|
30
|
+
|
|
31
|
+
#define BSON_BYTE_BUFFER_SIZE 1024
|
|
32
|
+
|
|
33
|
+
#ifndef HOST_NAME_HASH_MAX
|
|
34
|
+
#define HOST_NAME_HASH_MAX 256
|
|
35
|
+
#endif
|
|
36
|
+
|
|
37
|
+
/* See the type list in http://bsonspec.org/spec.html. */
|
|
38
|
+
#define BSON_TYPE_DOUBLE 1
|
|
39
|
+
#define BSON_TYPE_STRING 2
|
|
40
|
+
#define BSON_TYPE_DOCUMENT 3
|
|
41
|
+
#define BSON_TYPE_ARRAY 4
|
|
42
|
+
#define BSON_TYPE_BOOLEAN 8
|
|
43
|
+
#define BSON_TYPE_SYMBOL 0x0E
|
|
44
|
+
#define BSON_TYPE_INT32 0x10
|
|
45
|
+
#define BSON_TYPE_INT64 0x12
|
|
46
|
+
|
|
47
|
+
typedef struct {
|
|
48
|
+
size_t size;
|
|
49
|
+
size_t write_position;
|
|
50
|
+
size_t read_position;
|
|
51
|
+
char buffer[BSON_BYTE_BUFFER_SIZE];
|
|
52
|
+
char *b_ptr;
|
|
53
|
+
} byte_buffer_t;
|
|
54
|
+
|
|
55
|
+
#define READ_PTR(byte_buffer_ptr) \
|
|
56
|
+
(byte_buffer_ptr->b_ptr + byte_buffer_ptr->read_position)
|
|
57
|
+
|
|
58
|
+
#define READ_SIZE(byte_buffer_ptr) \
|
|
59
|
+
(byte_buffer_ptr->write_position - byte_buffer_ptr->read_position)
|
|
60
|
+
|
|
61
|
+
#define WRITE_PTR(byte_buffer_ptr) \
|
|
62
|
+
(byte_buffer_ptr->b_ptr + byte_buffer_ptr->write_position)
|
|
63
|
+
|
|
64
|
+
#define ENSURE_BSON_WRITE(buffer_ptr, length) \
|
|
65
|
+
{ if (buffer_ptr->write_position + length > buffer_ptr->size) rb_bson_expand_buffer(buffer_ptr, length); }
|
|
66
|
+
|
|
67
|
+
#define ENSURE_BSON_READ(buffer_ptr, length) \
|
|
68
|
+
{ if (buffer_ptr->read_position + length > buffer_ptr->write_position) \
|
|
69
|
+
rb_raise(rb_eRangeError, "Attempted to read %zu bytes, but only %zu bytes remain", (size_t)length, READ_SIZE(buffer_ptr)); }
|
|
70
|
+
|
|
71
|
+
VALUE rb_bson_byte_buffer_allocate(VALUE klass);
|
|
72
|
+
VALUE rb_bson_byte_buffer_initialize(int argc, VALUE *argv, VALUE self);
|
|
73
|
+
VALUE rb_bson_byte_buffer_length(VALUE self);
|
|
74
|
+
VALUE rb_bson_byte_buffer_get_byte(VALUE self);
|
|
75
|
+
VALUE rb_bson_byte_buffer_get_bytes(VALUE self, VALUE i);
|
|
76
|
+
VALUE rb_bson_byte_buffer_get_cstring(VALUE self);
|
|
77
|
+
VALUE rb_bson_byte_buffer_get_decimal128_bytes(VALUE self);
|
|
78
|
+
VALUE rb_bson_byte_buffer_get_double(VALUE self);
|
|
79
|
+
VALUE rb_bson_byte_buffer_get_int32(VALUE self);
|
|
80
|
+
VALUE rb_bson_byte_buffer_get_uint32(VALUE self);
|
|
81
|
+
VALUE rb_bson_byte_buffer_get_int64(VALUE self);
|
|
82
|
+
VALUE rb_bson_byte_buffer_get_string(VALUE self);
|
|
83
|
+
VALUE rb_bson_byte_buffer_get_hash(int argc, VALUE *argv, VALUE self);
|
|
84
|
+
VALUE rb_bson_byte_buffer_get_array(int argc, VALUE *argv, VALUE self);
|
|
85
|
+
VALUE rb_bson_byte_buffer_put_byte(VALUE self, VALUE byte);
|
|
86
|
+
VALUE rb_bson_byte_buffer_put_bytes(VALUE self, VALUE bytes);
|
|
87
|
+
VALUE rb_bson_byte_buffer_put_cstring(VALUE self, VALUE string);
|
|
88
|
+
VALUE rb_bson_byte_buffer_put_decimal128(VALUE self, VALUE low, VALUE high);
|
|
89
|
+
VALUE rb_bson_byte_buffer_put_double(VALUE self, VALUE f);
|
|
90
|
+
VALUE rb_bson_byte_buffer_put_int32(VALUE self, VALUE i);
|
|
91
|
+
VALUE rb_bson_byte_buffer_put_uint32(VALUE self, VALUE i);
|
|
92
|
+
VALUE rb_bson_byte_buffer_put_int64(VALUE self, VALUE i);
|
|
93
|
+
VALUE rb_bson_byte_buffer_put_string(VALUE self, VALUE string);
|
|
94
|
+
VALUE rb_bson_byte_buffer_put_symbol(VALUE self, VALUE symbol);
|
|
95
|
+
VALUE rb_bson_byte_buffer_put_hash(VALUE self, VALUE hash);
|
|
96
|
+
VALUE rb_bson_byte_buffer_put_array(VALUE self, VALUE array);
|
|
97
|
+
VALUE rb_bson_byte_buffer_read_position(VALUE self);
|
|
98
|
+
VALUE rb_bson_byte_buffer_replace_int32(VALUE self, VALUE index, VALUE i);
|
|
99
|
+
VALUE rb_bson_byte_buffer_rewind(VALUE self);
|
|
100
|
+
VALUE rb_bson_byte_buffer_write_position(VALUE self);
|
|
101
|
+
VALUE rb_bson_byte_buffer_to_s(VALUE self);
|
|
102
|
+
|
|
103
|
+
VALUE rb_bson_object_id_generator_next(int argc, VALUE* args, VALUE self);
|
|
104
|
+
VALUE rb_bson_object_id_generator_reset_counter(int argc, VALUE* args, VALUE self);
|
|
105
|
+
|
|
106
|
+
size_t rb_bson_byte_buffer_memsize(const void *ptr);
|
|
107
|
+
void rb_bson_byte_buffer_free(void *ptr);
|
|
108
|
+
void rb_bson_expand_buffer(byte_buffer_t* buffer_ptr, size_t length);
|
|
109
|
+
void rb_bson_generate_machine_id(VALUE rb_md5_class, char *rb_bson_machine_id);
|
|
110
|
+
|
|
111
|
+
VALUE pvt_const_get_2(const char *c1, const char *c2);
|
|
112
|
+
VALUE pvt_const_get_3(const char *c1, const char *c2, const char *c3);
|
|
113
|
+
|
|
114
|
+
#define BSON_MODE_DEFAULT 0
|
|
115
|
+
#define BSON_MODE_BSON 1
|
|
116
|
+
|
|
117
|
+
int pvt_get_mode_option(int argc, VALUE *argv);
|
|
118
|
+
|
|
119
|
+
#define BSON_OBJECT_ID_RANDOM_VALUE_LENGTH ( 5 )
|
|
120
|
+
|
|
121
|
+
uint8_t* pvt_get_object_id_random_value();
|
|
122
|
+
void pvt_init_rand();
|
|
123
|
+
void pvt_rand_buf(uint8_t* bytes, int len, int pid);
|
|
124
|
+
int pvt_rand();
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The counter for incrementing object ids.
|
|
128
|
+
*/
|
|
129
|
+
extern uint32_t rb_bson_object_id_counter;
|
|
130
|
+
|
|
131
|
+
extern VALUE rb_bson_registry;
|
|
132
|
+
|
|
133
|
+
extern const rb_data_type_t rb_byte_buffer_data_type;
|
|
134
|
+
|
|
135
|
+
extern VALUE _ref_str, _id_str, _db_str;
|