Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include <mutex>
#include <string>
#include <vector>
 
#include "core/session/plugin_ep/ep_library.h"
#include "core/session/plugin_ep/ep_library_plugin_utils.h"
 
namespace onnxruntime {
/// <summary>
/// EpLibraryStaticPlugin supports a plugin execution provider that is statically linked into the ORT binary.
///
/// The provider implements the same CreateEpFactories and ReleaseEpFactory entry points that a dynamically loaded
/// plugin library exports, and uses the same public EP API, but the entry points are resolved at link time instead
/// of being looked up by name. There is no library to load or unload, so the provider's process-global state
/// outlives unregistration.
/// </summary>
class EpLibraryStaticPlugin : public EpLibrary {
 public:
  EpLibraryStaticPlugin(std::string registration_name,
                        CreateEpApiFactoriesFn create_fn,
                        ReleaseEpApiFactoryFn release_fn)
      : registration_name_{std::move(registration_name)},
        create_fn_{create_fn},
        release_fn_{release_fn} {
  }
 
  const char* RegistrationName() const override {
    return registration_name_.c_str();
  }
 
  // LibraryPath() intentionally uses the base class implementation, which returns nullptr. There is no library
  // file backing a statically linked provider.
 
  Status Load() override;
 
  Status Unload() override;
 
  ORT_DISALLOW_COPY_AND_ASSIGNMENT(EpLibraryStaticPlugin);
 
 private:
  size_t GetFactoryCount() const override {
    return factories_.size();
  }
 
  OrtEpFactory* GetFactory(size_t index) const override {
    return factories_[index].get();
  }
 
  std::mutex mutex_;
  const std::string registration_name_;
  const CreateEpApiFactoriesFn create_fn_;
  const ReleaseEpApiFactoryFn release_fn_;
  std::vector<ep_library_plugin_utils::OrtEpFactoryUniquePtr> factories_{};
};
}  // namespace onnxruntime