aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/core/base/user_registry.h
blob: d7d9113a600f04ade04b4c59a4ee0e5046b8fbc1 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include <library/cpp/actors/core/events.h> 
#include <ydb/core/tx/defs.h>

namespace NKikimr {
    struct TEvUserRegistry {
        enum EEv {
            EvGetUserById = EventSpaceBegin(TKikimrEvents::ES_USER_REGISTRY),
            EvGetUserByIdResult,
            EvEnd
        };

        static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_USER_REGISTRY),
                      "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_USER_REGISTRY)");

        struct TEvGetUserById : TEventLocal<TEvGetUserById, EvGetUserById> {
            const ui64 UID;
            const TString UserNameHint;

            TEvGetUserById(const ui64 uid, const TString& userNameHint = "")
                : UID(uid)
                , UserNameHint(userNameHint)
            {}
        };

        struct TEvGetUserByIdResult : TEventLocal<TEvGetUserByIdResult, EvGetUserByIdResult> {
            const ui64 UID;
            const TString UserNameHint;
            const TString User;
            const TString Error;

            TEvGetUserByIdResult(const ui64 uid, const TString& userNameHint, const TString& user = "", const TString& error = "")
                : UID(uid)
                , UserNameHint(userNameHint)
                , User(user)
                , Error(error)
            {}
        };
    };

    inline NActors::TActorId MakeUserRegistryID() {
        const char name[12] = "userregistr";
        return NActors::TActorId(0, TStringBuf(name, 12));
    }

    IActor* CreateUserRegistry(const TString& query);
}