forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run & stop workers (ydb-platform#2860)
- Loading branch information
Showing
23 changed files
with
744 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "worker_id.h" | ||
|
||
#include <ydb/core/protos/replication.pb.h> | ||
|
||
namespace NKikimr::NReplication { | ||
|
||
TWorkerId::TWorkerId(ui64 rid, ui64 tid, ui64 wid) | ||
: std::tuple<ui64, ui64, ui64>(rid, tid, wid) | ||
{ | ||
} | ||
|
||
ui64 TWorkerId::ReplicationId() const { | ||
return std::get<0>(*this); | ||
} | ||
|
||
ui64 TWorkerId::TargetId() const { | ||
return std::get<1>(*this); | ||
} | ||
|
||
ui64 TWorkerId::WorkerId() const { | ||
return std::get<2>(*this); | ||
} | ||
|
||
TWorkerId TWorkerId::Parse(const NKikimrReplication::TWorkerIdentity& proto) { | ||
return TWorkerId(proto.GetReplicationId(), proto.GetTargetId(), proto.GetWorkerId()); | ||
} | ||
|
||
void TWorkerId::Serialize(NKikimrReplication::TWorkerIdentity& proto) const { | ||
proto.SetReplicationId(ReplicationId()); | ||
proto.SetTargetId(TargetId()); | ||
proto.SetWorkerId(WorkerId()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <util/generic/hash.h> | ||
|
||
#include <tuple> | ||
|
||
namespace NKikimrReplication { | ||
class TWorkerIdentity; | ||
} | ||
|
||
namespace NKikimr::NReplication { | ||
|
||
struct TWorkerId: std::tuple<ui64, ui64, ui64> { | ||
explicit TWorkerId(ui64 rid, ui64 tid, ui64 wid); | ||
|
||
ui64 ReplicationId() const; | ||
ui64 TargetId() const; | ||
ui64 WorkerId() const; | ||
|
||
static TWorkerId Parse(const NKikimrReplication::TWorkerIdentity& proto); | ||
void Serialize(NKikimrReplication::TWorkerIdentity& proto) const; | ||
}; | ||
|
||
} | ||
|
||
template <> | ||
struct THash<NKikimr::NReplication::TWorkerId> : THash<std::tuple<ui64, ui64, ui64>> {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
LIBRARY() | ||
|
||
PEERDIR( | ||
ydb/core/protos | ||
) | ||
|
||
SRCS( | ||
worker_id.cpp | ||
) | ||
|
||
YQL_LAST_ABI_VERSION() | ||
|
||
END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.