aboutsummaryrefslogtreecommitdiffstats
path: root/util/ysaveload.cpp
diff options
context:
space:
mode:
authorDevtools Arcadia <arcadia-devtools@yandex-team.ru>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /util/ysaveload.cpp
downloadydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'util/ysaveload.cpp')
-rw-r--r--util/ysaveload.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/util/ysaveload.cpp b/util/ysaveload.cpp
new file mode 100644
index 0000000000..1ae3acb01e
--- /dev/null
+++ b/util/ysaveload.cpp
@@ -0,0 +1,22 @@
+#include "ysaveload.h"
+
+#include <util/generic/buffer.h>
+
+void TSerializer<TBuffer>::Save(IOutputStream* rh, const TBuffer& buf) {
+ ::SaveSize(rh, buf.Size());
+ ::SavePodArray(rh, buf.Data(), buf.Size());
+}
+
+void TSerializer<TBuffer>::Load(IInputStream* rh, TBuffer& buf) {
+ const size_t s = ::LoadSize(rh);
+ buf.Resize(s);
+ ::LoadPodArray(rh, buf.Data(), buf.Size());
+}
+
+[[noreturn]] void NPrivate::ThrowLoadEOFException(size_t typeSize, size_t realSize, TStringBuf structName) {
+ ythrow TLoadEOF() << "can not load " << structName << "(" << typeSize << ", " << realSize << " bytes)";
+}
+
+[[noreturn]] void NPrivate::ThrowUnexpectedVariantTagException(ui8 tagIndex) {
+ ythrow TLoadEOF() << "Unexpected tag value " << tagIndex << " while loading TVariant";
+}