diff options
author | Svilen Mihaylov <svilen.mihaylov@mongodb.com> | 2020-05-05 10:18:39 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-18 15:38:37 +0000 |
commit | cbd23d40077b148f94ba74fef49198b287e51747 (patch) | |
tree | 5f9c43938f58e5cebce0ba07fb405ec5dbdc7c96 /src/mongo/db/geo/hash.h | |
parent | df291c458193f3bf51c314fc9219efc36dfbd067 (diff) | |
download | mongo-cbd23d40077b148f94ba74fef49198b287e51747.tar.gz |
SERVER-47994 Fix for numerical overflow in GeoHash (part 2)
Diffstat (limited to 'src/mongo/db/geo/hash.h')
-rw-r--r-- | src/mongo/db/geo/hash.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mongo/db/geo/hash.h b/src/mongo/db/geo/hash.h index bfdca2cdffd..6b59034accc 100644 --- a/src/mongo/db/geo/hash.h +++ b/src/mongo/db/geo/hash.h @@ -179,14 +179,18 @@ public: double scaling; }; - GeoHashConverter(const Parameters& params); + /** + * Factory method to return a new instance with status. Uses hashing parameters parsed from a + * BSONObj. + */ + static StatusWith<std::unique_ptr<GeoHashConverter>> createFromDoc(const BSONObj& paramDoc); /** - * Returns hashing parameters parsed from a BSONObj + * Factory method to return a new instance with status. */ - static Status parseParameters(const BSONObj& paramDoc, Parameters* params); + static StatusWith<std::unique_ptr<GeoHashConverter>> createFromParams(const Parameters& params); - static double calcUnhashToBoxError(const GeoHashConverter::Parameters& params); + static double calcUnhashToBoxError(const Parameters& params); /** * Return converter parameterss which can be used to @@ -257,6 +261,8 @@ public: double convertToDoubleHashScale(double in) const; private: + GeoHashConverter(const Parameters& params); + void init(); // Convert from an unsigned in [0, (max-min)*scaling] to [min, max] |