blob: 0c0f8c006f6b425e97f63d575863385c6c450287 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "pack_jobstate.h"
#include <library/cpp/string_utils/base64/base64.h>
#include <util/stream/str.h>
#include <util/stream/zlib.h>
namespace NYT::NDetail {
////////////////////////////////////////////////////////////////////////////////
TString PackJobState(TStringBuf jobstate)
{
TStringStream packed;
TZLibCompress packer(&packed);
packer << jobstate;
packer.Finish();
return Base64Encode(packed.Str());
}
TString UnpackJobState(TStringBuf packedJobState)
{
TStringStream packed;
packed << Base64Decode(packedJobState);
TBufferedZLibDecompress unpacker(&packed);
return unpacker.ReadAll();
}
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NDetail
|