Skip to content

Commit 70f661e

Browse files
author
galtsev
committed
YT-21993: Remove Phoenix v1
commit_hash:e4285d508e98757c71cb20a91f3cd1f3a56a3c73
1 parent 4b74ecb commit 70f661e

18 files changed

+100
-1556
lines changed

yt/yt/client/table_client/table_upload_options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ui64 TEpochSchema::Set(const TTableSchemaPtr& schema)
6161
return ++Revision_;
6262
}
6363

64-
void TEpochSchema::Persist(const NPhoenix::TPersistenceContext& context)
64+
void TEpochSchema::Persist(const NPhoenix2::TPersistenceContext& context)
6565
{
6666
using NYT::Persist;
6767

@@ -91,7 +91,7 @@ TTableSchemaPtr TTableUploadOptions::GetUploadSchema() const
9191
}
9292
}
9393

94-
void TTableUploadOptions::Persist(const NPhoenix::TPersistenceContext& context)
94+
void TTableUploadOptions::Persist(const NPhoenix2::TPersistenceContext& context)
9595
{
9696
using NYT::Persist;
9797

yt/yt/client/table_client/table_upload_options.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <yt/yt/core/compression/public.h>
1515

16-
#include <yt/yt/core/misc/phoenix.h>
16+
#include <yt/yt/core/phoenix/context.h>
1717

1818
namespace NYT::NTableClient {
1919

@@ -39,7 +39,7 @@ class TEpochSchema
3939

4040
ui64 Set(const TTableSchemaPtr& schema);
4141

42-
void Persist(const NPhoenix::TPersistenceContext& context);
42+
void Persist(const NPhoenix2::TPersistenceContext& context);
4343

4444
ui64 Reset();
4545

@@ -67,7 +67,7 @@ struct TTableUploadOptions
6767

6868
TTableSchemaPtr GetUploadSchema() const;
6969

70-
void Persist(const NPhoenix::TPersistenceContext& context);
70+
void Persist(const NPhoenix2::TPersistenceContext& context);
7171
};
7272

7373
const std::vector<TString>& GetTableUploadOptionsAttributeKeys();

yt/yt/core/misc/arithmetic_formula.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "arithmetic_formula.h"
2-
#include "phoenix.h"
32

43
#include <yt/yt/core/misc/error.h>
54

yt/yt/core/misc/digest.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
#include "digest.h"
22
#include "config.h"
33

4-
#include <yt/yt/core/misc/phoenix.h>
4+
#include <yt/yt/core/phoenix/type_def.h>
55

66
namespace NYT {
77

8-
using namespace NPhoenix;
8+
using namespace NPhoenix2;
9+
10+
////////////////////////////////////////////////////////////////////////////////
11+
12+
void IPersistentDigest::RegisterMetadata(auto&& /*registrar*/)
13+
{ }
14+
15+
PHOENIX_DEFINE_TYPE(IPersistentDigest);
916

1017
////////////////////////////////////////////////////////////////////////////////
1118

1219
class TLogDigest
1320
: public IPersistentDigest
14-
, public NPhoenix::TFactoryTag<NPhoenix::TSimpleFactory>
1521
{
1622
public:
1723
TLogDigest(TLogDigestConfigPtr config)
@@ -60,21 +66,6 @@ class TLogDigest
6066
std::fill(Buckets_.begin(), Buckets_.end(), 0);
6167
}
6268

63-
void Persist(const TPersistenceContext& context) override
64-
{
65-
using NYT::Persist;
66-
Persist(context, Step_);
67-
Persist(context, LogStep_);
68-
Persist(context, LowerBound_);
69-
Persist(context, UpperBound_);
70-
Persist(context, DefaultValue_);
71-
Persist(context, BucketCount_);
72-
Persist(context, SampleCount_);
73-
Persist(context, Buckets_);
74-
}
75-
76-
DECLARE_DYNAMIC_PHOENIX_TYPE(TLogDigest, 0x42424243);
77-
7869
private:
7970
double Step_;
8071
double LogStep_;
@@ -88,9 +79,23 @@ class TLogDigest
8879
i64 SampleCount_ = 0;
8980

9081
std::vector<i64> Buckets_;
82+
83+
PHOENIX_DECLARE_POLYMORPHIC_TYPE(TLogDigest, 0x42424243);
9184
};
9285

93-
DEFINE_DYNAMIC_PHOENIX_TYPE(TLogDigest);
86+
void TLogDigest::RegisterMetadata(auto&& registrar)
87+
{
88+
PHOENIX_REGISTER_FIELD(1, Step_)();
89+
PHOENIX_REGISTER_FIELD(2, LogStep_)();
90+
PHOENIX_REGISTER_FIELD(3, LowerBound_)();
91+
PHOENIX_REGISTER_FIELD(4, UpperBound_)();
92+
PHOENIX_REGISTER_FIELD(5, DefaultValue_)();
93+
PHOENIX_REGISTER_FIELD(6, BucketCount_)();
94+
PHOENIX_REGISTER_FIELD(7, SampleCount_)();
95+
PHOENIX_REGISTER_FIELD(8, Buckets_)();
96+
}
97+
98+
PHOENIX_DEFINE_TYPE(TLogDigest);
9499

95100
////////////////////////////////////////////////////////////////////////////////
96101

yt/yt/core/misc/digest.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
#include "public.h"
44

5-
#include <yt/yt/core/misc/phoenix.h>
5+
#include <yt/yt/core/phoenix/context.h>
6+
#include <yt/yt/core/phoenix/type_decl.h>
67

78
namespace NYT {
89

@@ -31,9 +32,12 @@ DEFINE_REFCOUNTED_TYPE(IDigest)
3132

3233
struct IPersistentDigest
3334
: public IDigest
34-
, public NPhoenix::IPersistent
35+
, public NPhoenix2::IPersistent
3536
{
36-
void Persist(const NPhoenix::TPersistenceContext& context) override = 0;
37+
using TLoadContext = NPhoenix2::TLoadContext;
38+
using TSaveContext = NPhoenix2::TSaveContext;
39+
40+
PHOENIX_DECLARE_POLYMORPHIC_TYPE(IPersistentDigest, 0x1ed99609);
3741
};
3842

3943
DEFINE_REFCOUNTED_TYPE(IPersistentDigest)

yt/yt/core/misc/histogram.cpp

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "histogram.h"
22

3+
#include <yt/yt/core/phoenix/type_decl.h>
4+
#include <yt/yt/core/phoenix/type_def.h>
5+
36
#include <yt/yt/core/yson/public.h>
47

58
#include <yt/yt/core/ytree/fluent.h>
@@ -8,13 +11,12 @@ namespace NYT {
811

912
using namespace NYTree;
1013
using namespace NYson;
11-
using namespace NPhoenix;
14+
using namespace NPhoenix2;
1215

1316
////////////////////////////////////////////////////////////////////////////////
1417

1518
class THistogram
1619
: public IHistogram
17-
, public NPhoenix::TFactoryTag<NPhoenix::TSimpleFactory>
1820
{
1921
public:
2022
THistogram() = default;
@@ -74,31 +76,15 @@ class THistogram
7476
return result;
7577
}
7678

77-
void Persist(const TPersistenceContext& context) override
78-
{
79-
using NYT::Persist;
80-
Persist(context, MaxBuckets_);
81-
Persist(context, ValueMin_);
82-
Persist(context, ValueMax_);
83-
Persist(context, Items_);
84-
}
85-
8679
private:
8780
struct TItem
8881
{
8982
i64 Value;
9083
i64 Count;
9184

92-
void Persist(const TPersistenceContext& context)
93-
{
94-
using NYT::Persist;
95-
Persist(context, Value);
96-
Persist(context, Count);
97-
}
85+
PHOENIX_DECLARE_TYPE(TItem, 0x9860143c);
9886
};
9987

100-
DECLARE_DYNAMIC_PHOENIX_TYPE(THistogram, 0x636d76d7);
101-
10288
static const i64 HistogramViewReserveFactor = 2;
10389

10490
i64 MaxBuckets_ = 0;
@@ -140,9 +126,30 @@ class THistogram
140126
View_.Count[GetBucketIndex(item.Value)] += item.Count;
141127
}
142128
}
129+
130+
PHOENIX_DECLARE_FRIEND();
131+
PHOENIX_DECLARE_POLYMORPHIC_TYPE(THistogram, 0x636d76d7);
143132
};
144133

145-
DEFINE_DYNAMIC_PHOENIX_TYPE(THistogram);
134+
void THistogram::RegisterMetadata(auto&& registrar)
135+
{
136+
PHOENIX_REGISTER_FIELD(1, MaxBuckets_)();
137+
PHOENIX_REGISTER_FIELD(2, ValueMin_)();
138+
PHOENIX_REGISTER_FIELD(3, ValueMax_)();
139+
PHOENIX_REGISTER_FIELD(4, Items_)();
140+
}
141+
142+
PHOENIX_DEFINE_TYPE(THistogram);
143+
144+
////////////////////////////////////////////////////////////////////////////////
145+
146+
void THistogram::TItem::RegisterMetadata(auto&& registrar)
147+
{
148+
PHOENIX_REGISTER_FIELD(1, Value)();
149+
PHOENIX_REGISTER_FIELD(2, Count)();
150+
}
151+
152+
PHOENIX_DEFINE_TYPE(THistogram::TItem);
146153

147154
////////////////////////////////////////////////////////////////////////////////
148155

yt/yt/core/misc/histogram.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "public.h"
44
#include "serialize.h"
55

6-
#include <yt/yt/core/misc/phoenix.h>
6+
#include <yt/yt/core/phoenix/context.h>
77

88
namespace NYT {
99

@@ -21,7 +21,7 @@ struct THistogramView
2121
};
2222

2323
struct IHistogram
24-
: public virtual NPhoenix::IPersistent
24+
: public virtual NPhoenix2::IPersistent
2525
{
2626
virtual void AddValue(i64 value, i64 count = 1) = 0;
2727
virtual void RemoveValue(i64 value, i64 count = 1) = 0;

yt/yt/core/misc/phoenix-inl.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

yt/yt/core/misc/phoenix.cpp

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)