summaryrefslogtreecommitdiff
path: root/src/mongo/db/geo/hash.h
diff options
context:
space:
mode:
authorSvilen Mihaylov <svilen.mihaylov@mongodb.com>2020-05-05 10:18:39 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-18 15:38:37 +0000
commitcbd23d40077b148f94ba74fef49198b287e51747 (patch)
tree5f9c43938f58e5cebce0ba07fb405ec5dbdc7c96 /src/mongo/db/geo/hash.h
parentdf291c458193f3bf51c314fc9219efc36dfbd067 (diff)
downloadmongo-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.h14
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]