diff options
author | Eric Cox <eric.cox@mongodb.com> | 2021-11-23 03:31:42 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-23 04:10:06 +0000 |
commit | 5d801b0774abeb9297673e2c28a2493ec4b117a9 (patch) | |
tree | 6350c24f701f6c72f71243cfd36133da0c75d5ca /src/mongo/db/storage/key_string.cpp | |
parent | 5268175398a5b5122abc8c3047dce642fa59922e (diff) | |
download | mongo-5d801b0774abeb9297673e2c28a2493ec4b117a9.tar.gz |
SERVER-61362 Serialize SBE Values to KeyString
Diffstat (limited to 'src/mongo/db/storage/key_string.cpp')
-rw-r--r-- | src/mongo/db/storage/key_string.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/mongo/db/storage/key_string.cpp b/src/mongo/db/storage/key_string.cpp index 9d1d88121b2..2bd3934bb03 100644 --- a/src/mongo/db/storage/key_string.cpp +++ b/src/mongo/db/storage/key_string.cpp @@ -359,6 +359,13 @@ void BuilderBase<BufferT>::appendBSONElement(const BSONElement& elem, const Stri } template <class BufferT> +void BuilderBase<BufferT>::appendBool(bool val) { + _verifyAppendingState(); + _appendBool(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> void BuilderBase<BufferT>::appendString(StringData val) { _verifyAppendingState(); _appendString(val, _shouldInvertOnAppend(), nullptr); @@ -366,6 +373,20 @@ void BuilderBase<BufferT>::appendString(StringData val) { } template <class BufferT> +void BuilderBase<BufferT>::appendSymbol(StringData val) { + _verifyAppendingState(); + _appendSymbol(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> +void BuilderBase<BufferT>::appendCode(StringData val) { + _verifyAppendingState(); + _appendCode(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> void BuilderBase<BufferT>::appendNumberDouble(double num) { _verifyAppendingState(); _appendNumberDouble(num, _shouldInvertOnAppend()); @@ -380,6 +401,20 @@ void BuilderBase<BufferT>::appendNumberLong(long long num) { } template <class BufferT> +void BuilderBase<BufferT>::appendNumberInt(int num) { + _verifyAppendingState(); + _appendNumberInt(num, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> +void BuilderBase<BufferT>::appendNumberDecimal(Decimal128 num) { + _verifyAppendingState(); + _appendNumberDecimal(num, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> void BuilderBase<BufferT>::appendNull() { _verifyAppendingState(); _append(CType::kNullish, _shouldInvertOnAppend()); @@ -394,6 +429,13 @@ void BuilderBase<BufferT>::appendUndefined() { } template <class BufferT> +void BuilderBase<BufferT>::appendCodeWString(const BSONCodeWScope& val) { + _verifyAppendingState(); + _appendCodeWString(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> void BuilderBase<BufferT>::appendBinData(const BSONBinData& data) { _verifyAppendingState(); _appendBinData(data, _shouldInvertOnAppend()); @@ -401,6 +443,13 @@ void BuilderBase<BufferT>::appendBinData(const BSONBinData& data) { } template <class BufferT> +void BuilderBase<BufferT>::appendRegex(const BSONRegEx& val) { + _verifyAppendingState(); + _appendRegex(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> void BuilderBase<BufferT>::appendSetAsArray(const BSONElementSet& set, const StringTransformFn& f) { _verifyAppendingState(); _appendSetAsArray(set, _shouldInvertOnAppend(), nullptr); @@ -422,6 +471,41 @@ void BuilderBase<BufferT>::appendDate(Date_t date) { } template <class BufferT> +void BuilderBase<BufferT>::appendTimestamp(Timestamp val) { + _verifyAppendingState(); + _appendTimestamp(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> +void BuilderBase<BufferT>::appendBytes(const void* source, size_t bytes) { + _verifyAppendingState(); + _appendBytes(source, bytes, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> +void BuilderBase<BufferT>::appendDBRef(const BSONDBRef& val) { + _verifyAppendingState(); + _appendDBRef(val, _shouldInvertOnAppend()); + _elemCount++; +} + +template <class BufferT> +void BuilderBase<BufferT>::appendObject(const BSONObj& val, const StringTransformFn& f) { + _verifyAppendingState(); + _appendObject(val, _shouldInvertOnAppend(), f); + _elemCount++; +} + +template <class BufferT> +void BuilderBase<BufferT>::appendArray(const BSONArray& val, const StringTransformFn& f) { + _verifyAppendingState(); + _appendArray(val, _shouldInvertOnAppend(), f); + _elemCount++; +} + +template <class BufferT> void BuilderBase<BufferT>::appendDiscriminator(const Discriminator discriminator) { // The discriminator forces this KeyString to compare Less/Greater than any KeyString with // the same prefix of keys. As an example, this can be used to land on the first key in the |