Исходный код СУБД 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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
#pragma once
 
#include <filesystem>
#include <mutex>
 
#include "core/session/plugin_ep/ep_library.h"
#include "core/session/plugin_ep/ep_library_plugin_utils.h"
 
namespace onnxruntime {
/// <summary>
/// EpLibraryPlugin supports a dynamically loaded execution provider library that provides OrtEpFactory instances.
///
/// It handles load/unload of the library, and calls CreateEpFactories and ReleaseEpFactory in the library.
/// </summary>
class EpLibraryPlugin : public EpLibrary {
 public:
  EpLibraryPlugin(const std::string& registration_name, std::filesystem::path library_path)
      : registration_name_{registration_name},
        library_path_{std::move(library_path)} {
  }
 
  const char* RegistrationName() const override {
    return registration_name_.c_str();
  }
 
  const std::filesystem::path* LibraryPath() const override {
    return &library_path_;
  }
 
  Status Load() override;
 
  Status Unload() override;
 
  ORT_DISALLOW_COPY_AND_ASSIGNMENT(EpLibraryPlugin);
 
 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 std::filesystem::path library_path_;
  void* handle_{};
  std::vector<ep_library_plugin_utils::OrtEpFactoryUniquePtr> factories_{};
  CreateEpApiFactoriesFn create_fn_{nullptr};
  ReleaseEpApiFactoryFn release_fn_{nullptr};
};
}  // namespace onnxruntime