Skip to content

Commit

Permalink
YQL-18016 Introduce GenericProvider Lookup actor (ydb-platform#2820)
Browse files Browse the repository at this point in the history
  • Loading branch information
zverevgeny authored Mar 15, 2024
1 parent 7b11737 commit e1b557d
Show file tree
Hide file tree
Showing 5 changed files with 574 additions and 95 deletions.
1 change: 1 addition & 0 deletions ydb/library/yql/providers/generic/actors/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ LIBRARY()

SRCS(
yql_generic_read_actor.cpp
yql_generic_lookup_actor.cpp
yql_generic_source_factory.cpp
yql_generic_token_provider.cpp
)
Expand Down
95 changes: 95 additions & 0 deletions ydb/library/yql/providers/generic/actors/yql_generic_base_actor.h
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
Loading

0 comments on commit e1b557d

Please sign in to comment.