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.
YQL-18016 Introduce GenericProvider Lookup actor (ydb-platform#2820)
- Loading branch information
1 parent
7b11737
commit e1b557d
Showing
5 changed files
with
574 additions
and
95 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
95 changes: 95 additions & 0 deletions
95
ydb/library/yql/providers/generic/actors/yql_generic_base_actor.h
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,95 @@ | ||
#pragma once | ||
#include <ydb/library/actors/core/events.h> | ||
#include <ydb/library/actors/core/event_local.h> | ||
#include <ydb/library/yql/providers/generic/connector/libcpp/client.h> | ||
#include <ydb/library/yql/minikql/mkql_alloc.h> | ||
#include <ydb/library/yql/minikql/computation/mkql_computation_node_holders.h> | ||
#include <ydb/library/actors/core/actor_bootstrapped.h> | ||
|
||
namespace NYql::NDq { | ||
|
||
template <typename TDerived> | ||
class TGenericBaseActor: public NActors::TActorBootstrapped<TDerived> { | ||
protected: //Events | ||
// Event ids | ||
enum EEventIds: ui32 { | ||
EvBegin = EventSpaceBegin(NActors::TEvents::ES_PRIVATE), | ||
EvListSplitsIterator = EvBegin, | ||
EvListSplitsPart, | ||
EvListSplitsFinished, | ||
EvReadSplitsIterator, | ||
EvReadSplitsPart, | ||
EvReadSplitsFinished, | ||
EvError, | ||
EvEnd | ||
}; | ||
|
||
static_assert(EEventIds::EvEnd < EventSpaceEnd(NActors::TEvents::ES_PRIVATE), "expect EvEnd < EventSpaceEnd(TEvents::ES_PRIVATE)"); | ||
|
||
struct TEvListSplitsIterator: NActors::TEventLocal<TEvListSplitsIterator, EvListSplitsIterator> { | ||
explicit TEvListSplitsIterator(NConnector::IListSplitsStreamIterator::TPtr&& iterator) | ||
: Iterator(std::move(iterator)) | ||
{ | ||
} | ||
|
||
NConnector::IListSplitsStreamIterator::TPtr Iterator; | ||
}; | ||
|
||
struct TEvListSplitsPart: NActors::TEventLocal<TEvListSplitsPart, EvListSplitsPart> { | ||
explicit TEvListSplitsPart(NConnector::NApi::TListSplitsResponse&& response) | ||
: Response(std::move(response)) | ||
{ | ||
} | ||
|
||
NConnector::NApi::TListSplitsResponse Response; | ||
}; | ||
|
||
struct TEvListSplitsFinished: NActors::TEventLocal<TEvListSplitsFinished, EvListSplitsFinished> { | ||
explicit TEvListSplitsFinished(NYdbGrpc::TGrpcStatus&& status) | ||
: Status(std::move(status)) | ||
{ | ||
} | ||
|
||
NYdbGrpc::TGrpcStatus Status; | ||
}; | ||
|
||
struct TEvReadSplitsIterator: NActors::TEventLocal<TEvReadSplitsIterator, EvReadSplitsIterator> { | ||
explicit TEvReadSplitsIterator(NConnector::IReadSplitsStreamIterator::TPtr&& iterator) | ||
: Iterator(std::move(iterator)) | ||
{ | ||
} | ||
|
||
NConnector::IReadSplitsStreamIterator::TPtr Iterator; | ||
}; | ||
|
||
struct TEvReadSplitsPart: NActors::TEventLocal<TEvReadSplitsPart, EvReadSplitsPart> { | ||
explicit TEvReadSplitsPart(NConnector::NApi::TReadSplitsResponse&& response) | ||
: Response(std::move(response)) | ||
{ | ||
} | ||
|
||
NConnector::NApi::TReadSplitsResponse Response; | ||
}; | ||
|
||
struct TEvReadSplitsFinished: NActors::TEventLocal<TEvReadSplitsFinished, EvReadSplitsFinished> { | ||
explicit TEvReadSplitsFinished(NYdbGrpc::TGrpcStatus&& status) | ||
: Status(std::move(status)) | ||
{ | ||
} | ||
|
||
NYdbGrpc::TGrpcStatus Status; | ||
}; | ||
|
||
struct TEvError: NActors::TEventLocal<TEvError, EvError> { | ||
explicit TEvError(const NConnector::NApi::TError& error) | ||
: Error(error) | ||
{ | ||
} | ||
|
||
NConnector::NApi::TError Error; | ||
}; | ||
|
||
protected: //TODO move common logic here | ||
}; | ||
|
||
} // namespace NYql::NDq |
Oops, something went wrong.