aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/core/yql_udf_index_package_set.h
blob: 4d399047959434f936bb7e2f76afe6d897411846 (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
#pragma once

#include "yql_udf_index.h"

namespace NYql {

class TUdfIndexPackageSet : public TThrRefBase {
public:
    typedef TIntrusivePtr<TUdfIndexPackageSet> TPtr;

private:
    TUdfIndexPackageSet(const TSet<TString>& knownPackages, const THashMap<TString, ui32>& packageDefaultVersions, const TMap<std::pair<TString, ui32>, TResourceInfo::TPtr>& resources);

public:
    TUdfIndexPackageSet();
    void RegisterPackage(const TString& package);
    bool SetPackageDefaultVersion(const TString& package, ui32 version);
    void RegisterResource(const TString& package, ui32 version, const TResourceInfo::TPtr& resource);
    bool AddResourceTo(const TString& package, ui32 version, const TUdfIndex::TPtr& target) const;
    void AddResourcesTo(const TUdfIndex::TPtr& target) const;
    TPtr Clone() const;

private:
    TSet<TString> KnownPackages_;
    THashMap<TString, ui32> PackageDefaultVersions_;
    TMap<std::pair<TString, ui32>, TResourceInfo::TPtr> Resources_;
};

}