@delali/narsil-react-native 0.0.0-stage → 0.3.1-next.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NarsilReactNative.podspec +57 -0
- package/README.md +46 -2
- package/android/CMakeLists.txt +48 -0
- package/android/build.gradle +151 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/AndroidEnvironment.cpp +44 -0
- package/android/src/main/cpp/AndroidEnvironment.hpp +11 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/narsil/NarsilAndroidEnvironment.kt +29 -0
- package/android/src/main/java/com/margelo/nitro/narsil/NarsilReactNativePackage.kt +22 -0
- package/app.plugin.js +25 -0
- package/cpp/AttachedField.cpp +234 -0
- package/cpp/AttachedField.hpp +61 -0
- package/cpp/Compression.cpp +113 -0
- package/cpp/Compression.hpp +16 -0
- package/cpp/GraphHeldAlone.cpp +29 -0
- package/cpp/GraphHeldAlone.hpp +25 -0
- package/cpp/HostMemory.cpp +123 -0
- package/cpp/HostMemory.hpp +53 -0
- package/cpp/HybridNarsilCoreImpl.cpp +390 -0
- package/cpp/HybridNarsilCoreImpl.hpp +68 -0
- package/cpp/HybridNarsilFilesImpl.cpp +245 -0
- package/cpp/HybridNarsilFilesImpl.hpp +34 -0
- package/cpp/HybridNarsilHostImpl.cpp +126 -0
- package/cpp/HybridNarsilHostImpl.hpp +42 -0
- package/cpp/NativeAtomics.cpp +110 -0
- package/cpp/NativeAtomics.hpp +11 -0
- package/cpp/ProcessInfo.cpp +83 -0
- package/cpp/ProcessInfo.hpp +11 -0
- package/cpp/ThreadPriority.cpp +77 -0
- package/cpp/ThreadPriority.hpp +8 -0
- package/cpp/WorkletRuntimeDispatcher.cpp +61 -0
- package/cpp/WorkletRuntimeDispatcher.hpp +9 -0
- package/cpp/core/include/narsil_core.h +208 -0
- package/cpp/core/src/connect.c +213 -0
- package/cpp/core/src/distance.c +103 -0
- package/cpp/core/src/files.c +99 -0
- package/cpp/core/src/heap.c +84 -0
- package/cpp/core/src/internal.h +284 -0
- package/cpp/core/src/kernels_code.c +209 -0
- package/cpp/core/src/kernels_float.c +197 -0
- package/cpp/core/src/kernels_pair.c +133 -0
- package/cpp/core/src/last_links.c +145 -0
- package/cpp/core/src/links.c +195 -0
- package/cpp/core/src/locks.c +168 -0
- package/cpp/core/src/nearest_links.c +147 -0
- package/cpp/core/src/place.c +215 -0
- package/cpp/core/src/quantize.c +226 -0
- package/cpp/core/src/records.c +97 -0
- package/cpp/core/src/remove.c +205 -0
- package/cpp/core/src/vectors.c +139 -0
- package/cpp/core/src/walk.c +231 -0
- package/cpp/core/src/workspace.c +167 -0
- package/ios/PrivacyInfo.xcprivacy +23 -0
- package/lib/client.d.ts +19 -0
- package/lib/client.js +41 -0
- package/lib/constants.d.ts +9 -0
- package/lib/constants.js +9 -0
- package/lib/engine/byte-files.d.ts +5 -0
- package/lib/engine/byte-files.js +97 -0
- package/lib/engine/core.d.ts +3 -0
- package/lib/engine/core.js +113 -0
- package/lib/engine/files.d.ts +3 -0
- package/lib/engine/files.js +188 -0
- package/lib/engine/host.d.ts +13 -0
- package/lib/engine/host.js +102 -0
- package/lib/engine/install.d.ts +4 -0
- package/lib/engine/install.js +29 -0
- package/lib/engine/native-error.d.ts +1 -0
- package/lib/engine/native-error.js +12 -0
- package/lib/engine/stand-ins/atomics.d.ts +5 -0
- package/lib/engine/stand-ins/atomics.js +236 -0
- package/lib/engine/stand-ins/crypto.d.ts +2 -0
- package/lib/engine/stand-ins/crypto.js +65 -0
- package/lib/engine/stand-ins/process.d.ts +2 -0
- package/lib/engine/stand-ins/process.js +22 -0
- package/lib/engine/stand-ins/streams.d.ts +1 -0
- package/lib/engine/stand-ins/streams.js +31 -0
- package/lib/engine/stand-ins/structured-clone.d.ts +1 -0
- package/lib/engine/stand-ins/structured-clone.js +121 -0
- package/lib/engine/streamed.d.ts +6 -0
- package/lib/engine/streamed.js +29 -0
- package/lib/engine/transfer.d.ts +3 -0
- package/lib/engine/transfer.js +77 -0
- package/lib/errors.d.ts +25 -0
- package/lib/errors.js +59 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +2 -0
- package/lib/methods.d.ts +5 -0
- package/lib/methods.js +47 -0
- package/lib/native-objects.d.ts +2 -0
- package/lib/native-objects.js +24 -0
- package/lib/specs/core.nitro.d.ts +79 -0
- package/lib/specs/core.nitro.js +1 -0
- package/lib/specs/files.nitro.d.ts +36 -0
- package/lib/specs/files.nitro.js +1 -0
- package/lib/specs/host.nitro.d.ts +24 -0
- package/lib/specs/host.nitro.js +1 -0
- package/lib/transferred.d.ts +15 -0
- package/lib/transferred.js +6 -0
- package/lib/types.d.ts +136 -0
- package/lib/types.js +1 -0
- package/lib/worklets/app-turns.d.ts +1 -0
- package/lib/worklets/app-turns.js +44 -0
- package/lib/worklets/client.d.ts +30 -0
- package/lib/worklets/client.js +144 -0
- package/lib/worklets/index.d.ts +4 -0
- package/lib/worklets/index.js +2 -0
- package/lib/worklets/instances.d.ts +15 -0
- package/lib/worklets/instances.js +194 -0
- package/lib/worklets/json-part.d.ts +1 -0
- package/lib/worklets/json-part.js +42 -0
- package/lib/worklets/runtime.d.ts +25 -0
- package/lib/worklets/runtime.js +80 -0
- package/lib/worklets/transfer-queue.d.ts +7 -0
- package/lib/worklets/transfer-queue.js +79 -0
- package/lib/worklets/types.d.ts +26 -0
- package/lib/worklets/types.js +1 -0
- package/nitro.json +32 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NarsilReactNative+autolinking.cmake +85 -0
- package/nitrogen/generated/android/NarsilReactNative+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NarsilReactNativeOnLoad.cpp +69 -0
- package/nitrogen/generated/android/NarsilReactNativeOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/narsil/NarsilReactNativeOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NarsilReactNative+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NarsilReactNative-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NarsilReactNative-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NarsilReactNative-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NarsilReactNativeAutolinking.mm +55 -0
- package/nitrogen/generated/ios/NarsilReactNativeAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/DirectoryEntry.hpp +91 -0
- package/nitrogen/generated/shared/c++/FileStatus.hpp +103 -0
- package/nitrogen/generated/shared/c++/GraphMemory.hpp +120 -0
- package/nitrogen/generated/shared/c++/HybridNarsilAttachedGraphSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNarsilAttachedGraphSpec.hpp +62 -0
- package/nitrogen/generated/shared/c++/HybridNarsilAttachedStoreSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNarsilAttachedStoreSpec.hpp +62 -0
- package/nitrogen/generated/shared/c++/HybridNarsilCoreSpec.cpp +35 -0
- package/nitrogen/generated/shared/c++/HybridNarsilCoreSpec.hpp +100 -0
- package/nitrogen/generated/shared/c++/HybridNarsilFilesSpec.cpp +37 -0
- package/nitrogen/generated/shared/c++/HybridNarsilFilesSpec.hpp +86 -0
- package/nitrogen/generated/shared/c++/HybridNarsilHostSpec.cpp +34 -0
- package/nitrogen/generated/shared/c++/HybridNarsilHostSpec.hpp +78 -0
- package/nitrogen/generated/shared/c++/MemoryView.hpp +91 -0
- package/nitrogen/generated/shared/c++/NativeConnectOutcome.hpp +87 -0
- package/nitrogen/generated/shared/c++/NativeScores.hpp +87 -0
- package/nitrogen/generated/shared/c++/NativeSearchHits.hpp +91 -0
- package/nitrogen/generated/shared/c++/ProcessMemory.hpp +87 -0
- package/nitrogen/generated/shared/c++/StoreMemory.hpp +142 -0
- package/package.json +87 -3
- package/react-native.config.js +8 -0
- package/src/client.ts +44 -0
- package/src/constants.ts +9 -0
- package/src/engine/byte-files.ts +99 -0
- package/src/engine/core.ts +162 -0
- package/src/engine/files.ts +186 -0
- package/src/engine/host.ts +111 -0
- package/src/engine/install.ts +31 -0
- package/src/engine/native-error.ts +10 -0
- package/src/engine/stand-ins/atomics.ts +288 -0
- package/src/engine/stand-ins/crypto.ts +81 -0
- package/src/engine/stand-ins/process.ts +30 -0
- package/src/engine/stand-ins/streams.ts +45 -0
- package/src/engine/stand-ins/structured-clone.ts +118 -0
- package/src/engine/streamed.ts +40 -0
- package/src/engine/transfer.ts +72 -0
- package/src/errors.ts +73 -0
- package/src/index.ts +3 -0
- package/src/methods.ts +52 -0
- package/src/native-objects.ts +30 -0
- package/src/specs/core.nitro.ts +140 -0
- package/src/specs/files.nitro.ts +42 -0
- package/src/specs/host.nitro.ts +30 -0
- package/src/transferred.ts +18 -0
- package/src/types.ts +164 -0
- package/src/worklets/app-turns.ts +48 -0
- package/src/worklets/client.ts +165 -0
- package/src/worklets/index.ts +4 -0
- package/src/worklets/instances.ts +231 -0
- package/src/worklets/json-part.ts +38 -0
- package/src/worklets/runtime.ts +190 -0
- package/src/worklets/transfer-queue.ts +98 -0
- package/src/worklets/types.ts +37 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GraphMemory.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `MemoryView` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::narsil { struct MemoryView; }
|
|
33
|
+
|
|
34
|
+
#include "MemoryView.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::narsil {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (GraphMemory).
|
|
40
|
+
*/
|
|
41
|
+
struct GraphMemory final {
|
|
42
|
+
public:
|
|
43
|
+
MemoryView graphHeader SWIFT_PRIVATE;
|
|
44
|
+
MemoryView nodeLevels SWIFT_PRIVATE;
|
|
45
|
+
MemoryView level0 SWIFT_PRIVATE;
|
|
46
|
+
MemoryView upperBase SWIFT_PRIVATE;
|
|
47
|
+
MemoryView upper SWIFT_PRIVATE;
|
|
48
|
+
MemoryView locks SWIFT_PRIVATE;
|
|
49
|
+
MemoryView tombstones SWIFT_PRIVATE;
|
|
50
|
+
MemoryView incoming SWIFT_PRIVATE;
|
|
51
|
+
MemoryView nearestLinkDue SWIFT_PRIVATE;
|
|
52
|
+
MemoryView heldLocks SWIFT_PRIVATE;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
GraphMemory() = default;
|
|
56
|
+
explicit GraphMemory(MemoryView graphHeader, MemoryView nodeLevels, MemoryView level0, MemoryView upperBase, MemoryView upper, MemoryView locks, MemoryView tombstones, MemoryView incoming, MemoryView nearestLinkDue, MemoryView heldLocks): graphHeader(graphHeader), nodeLevels(nodeLevels), level0(level0), upperBase(upperBase), upper(upper), locks(locks), tombstones(tombstones), incoming(incoming), nearestLinkDue(nearestLinkDue), heldLocks(heldLocks) {}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
friend bool operator==(const GraphMemory& lhs, const GraphMemory& rhs) = default;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::narsil
|
|
63
|
+
|
|
64
|
+
namespace margelo::nitro {
|
|
65
|
+
|
|
66
|
+
// C++ GraphMemory <> JS GraphMemory (object)
|
|
67
|
+
template <>
|
|
68
|
+
struct JSIConverter<margelo::nitro::narsil::GraphMemory> final {
|
|
69
|
+
static inline margelo::nitro::narsil::GraphMemory fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
70
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
71
|
+
return margelo::nitro::narsil::GraphMemory(
|
|
72
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "graphHeader"))),
|
|
73
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nodeLevels"))),
|
|
74
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "level0"))),
|
|
75
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "upperBase"))),
|
|
76
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "upper"))),
|
|
77
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locks"))),
|
|
78
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tombstones"))),
|
|
79
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "incoming"))),
|
|
80
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nearestLinkDue"))),
|
|
81
|
+
JSIConverter<margelo::nitro::narsil::MemoryView>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "heldLocks")))
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::narsil::GraphMemory& arg) {
|
|
85
|
+
jsi::Object obj(runtime);
|
|
86
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "graphHeader"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.graphHeader));
|
|
87
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "nodeLevels"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.nodeLevels));
|
|
88
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "level0"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.level0));
|
|
89
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "upperBase"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.upperBase));
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "upper"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.upper));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "locks"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.locks));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "tombstones"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.tombstones));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "incoming"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.incoming));
|
|
94
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "nearestLinkDue"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.nearestLinkDue));
|
|
95
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "heldLocks"), JSIConverter<margelo::nitro::narsil::MemoryView>::toJSI(runtime, arg.heldLocks));
|
|
96
|
+
return obj;
|
|
97
|
+
}
|
|
98
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
99
|
+
if (!value.isObject()) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
jsi::Object obj = value.getObject(runtime);
|
|
103
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "graphHeader")))) return false;
|
|
107
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nodeLevels")))) return false;
|
|
108
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "level0")))) return false;
|
|
109
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "upperBase")))) return false;
|
|
110
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "upper")))) return false;
|
|
111
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "locks")))) return false;
|
|
112
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tombstones")))) return false;
|
|
113
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "incoming")))) return false;
|
|
114
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "nearestLinkDue")))) return false;
|
|
115
|
+
if (!JSIConverter<margelo::nitro::narsil::MemoryView>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "heldLocks")))) return false;
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilAttachedGraphSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNarsilAttachedGraphSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::narsil {
|
|
11
|
+
|
|
12
|
+
void HybridNarsilAttachedGraphSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilAttachedGraphSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::narsil {
|
|
21
|
+
|
|
22
|
+
using namespace margelo::nitro;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An abstract base class for `NarsilAttachedGraph`
|
|
26
|
+
* Inherit this class to create instances of `HybridNarsilAttachedGraphSpec` in C++.
|
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
28
|
+
* @example
|
|
29
|
+
* ```cpp
|
|
30
|
+
* class HybridNarsilAttachedGraph: public HybridNarsilAttachedGraphSpec {
|
|
31
|
+
* public:
|
|
32
|
+
* HybridNarsilAttachedGraph(...): HybridObject(TAG) { ... }
|
|
33
|
+
* // ...
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class HybridNarsilAttachedGraphSpec: public virtual HybridObject {
|
|
38
|
+
public:
|
|
39
|
+
// Constructor
|
|
40
|
+
explicit HybridNarsilAttachedGraphSpec(): HybridObject(TAG) { }
|
|
41
|
+
|
|
42
|
+
// Destructor
|
|
43
|
+
~HybridNarsilAttachedGraphSpec() override = default;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Methods
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
protected:
|
|
54
|
+
// Hybrid Setup
|
|
55
|
+
void loadHybridMethods() override;
|
|
56
|
+
|
|
57
|
+
protected:
|
|
58
|
+
// Tag for logging
|
|
59
|
+
static constexpr auto TAG = "NarsilAttachedGraph";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilAttachedStoreSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNarsilAttachedStoreSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::narsil {
|
|
11
|
+
|
|
12
|
+
void HybridNarsilAttachedStoreSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("detach", &HybridNarsilAttachedStoreSpec::detach);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilAttachedStoreSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::narsil {
|
|
21
|
+
|
|
22
|
+
using namespace margelo::nitro;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An abstract base class for `NarsilAttachedStore`
|
|
26
|
+
* Inherit this class to create instances of `HybridNarsilAttachedStoreSpec` in C++.
|
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
28
|
+
* @example
|
|
29
|
+
* ```cpp
|
|
30
|
+
* class HybridNarsilAttachedStore: public HybridNarsilAttachedStoreSpec {
|
|
31
|
+
* public:
|
|
32
|
+
* HybridNarsilAttachedStore(...): HybridObject(TAG) { ... }
|
|
33
|
+
* // ...
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class HybridNarsilAttachedStoreSpec: public virtual HybridObject {
|
|
38
|
+
public:
|
|
39
|
+
// Constructor
|
|
40
|
+
explicit HybridNarsilAttachedStoreSpec(): HybridObject(TAG) { }
|
|
41
|
+
|
|
42
|
+
// Destructor
|
|
43
|
+
~HybridNarsilAttachedStoreSpec() override = default;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Methods
|
|
51
|
+
virtual double detach() = 0;
|
|
52
|
+
|
|
53
|
+
protected:
|
|
54
|
+
// Hybrid Setup
|
|
55
|
+
void loadHybridMethods() override;
|
|
56
|
+
|
|
57
|
+
protected:
|
|
58
|
+
// Tag for logging
|
|
59
|
+
static constexpr auto TAG = "NarsilAttachedStore";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilCoreSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNarsilCoreSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::narsil {
|
|
11
|
+
|
|
12
|
+
void HybridNarsilCoreSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("abiVersion", &HybridNarsilCoreSpec::abiVersion);
|
|
18
|
+
prototype.registerHybridMethod("workspaceBytes", &HybridNarsilCoreSpec::workspaceBytes);
|
|
19
|
+
prototype.registerHybridMethod("attachGraph", &HybridNarsilCoreSpec::attachGraph);
|
|
20
|
+
prototype.registerHybridMethod("attachStore", &HybridNarsilCoreSpec::attachStore);
|
|
21
|
+
prototype.registerHybridMethod("search", &HybridNarsilCoreSpec::search);
|
|
22
|
+
prototype.registerHybridMethod("searchAsync", &HybridNarsilCoreSpec::searchAsync);
|
|
23
|
+
prototype.registerHybridMethod("scoreAsync", &HybridNarsilCoreSpec::scoreAsync);
|
|
24
|
+
prototype.registerHybridMethod("score", &HybridNarsilCoreSpec::score);
|
|
25
|
+
prototype.registerHybridMethod("place", &HybridNarsilCoreSpec::place);
|
|
26
|
+
prototype.registerHybridMethod("remove", &HybridNarsilCoreSpec::remove);
|
|
27
|
+
prototype.registerHybridMethod("compact", &HybridNarsilCoreSpec::compact);
|
|
28
|
+
prototype.registerHybridMethod("connectUnreached", &HybridNarsilCoreSpec::connectUnreached);
|
|
29
|
+
prototype.registerHybridMethod("connectUnreachedAsync", &HybridNarsilCoreSpec::connectUnreachedAsync);
|
|
30
|
+
prototype.registerHybridMethod("measure", &HybridNarsilCoreSpec::measure);
|
|
31
|
+
prototype.registerHybridMethod("quantise", &HybridNarsilCoreSpec::quantise);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilCoreSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridNarsilAttachedGraphSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::narsil { class HybridNarsilAttachedGraphSpec; }
|
|
18
|
+
// Forward declaration of `GraphMemory` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::narsil { struct GraphMemory; }
|
|
20
|
+
// Forward declaration of `HybridNarsilAttachedStoreSpec` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::narsil { class HybridNarsilAttachedStoreSpec; }
|
|
22
|
+
// Forward declaration of `StoreMemory` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::narsil { struct StoreMemory; }
|
|
24
|
+
// Forward declaration of `MemoryView` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::narsil { struct MemoryView; }
|
|
26
|
+
// Forward declaration of `NativeSearchHits` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::narsil { struct NativeSearchHits; }
|
|
28
|
+
// Forward declaration of `NativeScores` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::narsil { struct NativeScores; }
|
|
30
|
+
// Forward declaration of `NativeConnectOutcome` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::narsil { struct NativeConnectOutcome; }
|
|
32
|
+
|
|
33
|
+
#include <memory>
|
|
34
|
+
#include "HybridNarsilAttachedGraphSpec.hpp"
|
|
35
|
+
#include "GraphMemory.hpp"
|
|
36
|
+
#include "HybridNarsilAttachedStoreSpec.hpp"
|
|
37
|
+
#include "StoreMemory.hpp"
|
|
38
|
+
#include "MemoryView.hpp"
|
|
39
|
+
#include "NativeSearchHits.hpp"
|
|
40
|
+
#include <NitroModules/Promise.hpp>
|
|
41
|
+
#include "NativeScores.hpp"
|
|
42
|
+
#include "NativeConnectOutcome.hpp"
|
|
43
|
+
|
|
44
|
+
namespace margelo::nitro::narsil {
|
|
45
|
+
|
|
46
|
+
using namespace margelo::nitro;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An abstract base class for `NarsilCore`
|
|
50
|
+
* Inherit this class to create instances of `HybridNarsilCoreSpec` in C++.
|
|
51
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
52
|
+
* @example
|
|
53
|
+
* ```cpp
|
|
54
|
+
* class HybridNarsilCore: public HybridNarsilCoreSpec {
|
|
55
|
+
* public:
|
|
56
|
+
* HybridNarsilCore(...): HybridObject(TAG) { ... }
|
|
57
|
+
* // ...
|
|
58
|
+
* };
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
class HybridNarsilCoreSpec: public virtual HybridObject {
|
|
62
|
+
public:
|
|
63
|
+
// Constructor
|
|
64
|
+
explicit HybridNarsilCoreSpec(): HybridObject(TAG) { }
|
|
65
|
+
|
|
66
|
+
// Destructor
|
|
67
|
+
~HybridNarsilCoreSpec() override = default;
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
// Properties
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
// Methods
|
|
75
|
+
virtual double abiVersion() = 0;
|
|
76
|
+
virtual double workspaceBytes() = 0;
|
|
77
|
+
virtual std::shared_ptr<HybridNarsilAttachedGraphSpec> attachGraph(const GraphMemory& memory) = 0;
|
|
78
|
+
virtual std::shared_ptr<HybridNarsilAttachedStoreSpec> attachStore(const StoreMemory& memory) = 0;
|
|
79
|
+
virtual double search(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, const MemoryView& query, double metric, double candidateCount, double threadSlot, const MemoryView& ordinals, const MemoryView& distances, const MemoryView& accepted, bool filtered) = 0;
|
|
80
|
+
virtual std::shared_ptr<Promise<NativeSearchHits>> searchAsync(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, const MemoryView& query, double metric, double candidateCount, double threadSlot, const MemoryView& accepted, bool filtered) = 0;
|
|
81
|
+
virtual std::shared_ptr<Promise<NativeScores>> scoreAsync(const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, const MemoryView& query, double metric, const MemoryView& ordinals, double count, double threadSlot) = 0;
|
|
82
|
+
virtual double score(const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, const MemoryView& query, double metric, const MemoryView& ordinals, double count, const MemoryView& distances) = 0;
|
|
83
|
+
virtual double place(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, double metric, double ordinal, double topLayer, double graphHeldAlone, double threadSlot, const MemoryView& wakes) = 0;
|
|
84
|
+
virtual double remove(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, double ordinal, double threadSlot, const MemoryView& wakes) = 0;
|
|
85
|
+
virtual double compact(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, double metric, double threadSlot, const MemoryView& wakes) = 0;
|
|
86
|
+
virtual double connectUnreached(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, double metric, const MemoryView& nearby, double threadSlot, const MemoryView& wakes) = 0;
|
|
87
|
+
virtual std::shared_ptr<Promise<NativeConnectOutcome>> connectUnreachedAsync(const std::shared_ptr<HybridNarsilAttachedGraphSpec>& graph, const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, double metric, const MemoryView& nearby, double threadSlot) = 0;
|
|
88
|
+
virtual double measure(const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, double metric, const MemoryView& ordinals, double count, const MemoryView& totals) = 0;
|
|
89
|
+
virtual double quantise(const std::shared_ptr<HybridNarsilAttachedStoreSpec>& store, double metric, const MemoryView& ordinals, double count) = 0;
|
|
90
|
+
|
|
91
|
+
protected:
|
|
92
|
+
// Hybrid Setup
|
|
93
|
+
void loadHybridMethods() override;
|
|
94
|
+
|
|
95
|
+
protected:
|
|
96
|
+
// Tag for logging
|
|
97
|
+
static constexpr auto TAG = "NarsilCore";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilFilesSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNarsilFilesSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::narsil {
|
|
11
|
+
|
|
12
|
+
void HybridNarsilFilesSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("open", &HybridNarsilFilesSpec::open);
|
|
18
|
+
prototype.registerHybridMethod("close", &HybridNarsilFilesSpec::close);
|
|
19
|
+
prototype.registerHybridMethod("read", &HybridNarsilFilesSpec::read);
|
|
20
|
+
prototype.registerHybridMethod("write", &HybridNarsilFilesSpec::write);
|
|
21
|
+
prototype.registerHybridMethod("sync", &HybridNarsilFilesSpec::sync);
|
|
22
|
+
prototype.registerHybridMethod("readAsync", &HybridNarsilFilesSpec::readAsync);
|
|
23
|
+
prototype.registerHybridMethod("writeAsync", &HybridNarsilFilesSpec::writeAsync);
|
|
24
|
+
prototype.registerHybridMethod("syncAsync", &HybridNarsilFilesSpec::syncAsync);
|
|
25
|
+
prototype.registerHybridMethod("truncate", &HybridNarsilFilesSpec::truncate);
|
|
26
|
+
prototype.registerHybridMethod("descriptorStatus", &HybridNarsilFilesSpec::descriptorStatus);
|
|
27
|
+
prototype.registerHybridMethod("pathStatus", &HybridNarsilFilesSpec::pathStatus);
|
|
28
|
+
prototype.registerHybridMethod("makeDirectory", &HybridNarsilFilesSpec::makeDirectory);
|
|
29
|
+
prototype.registerHybridMethod("readDirectory", &HybridNarsilFilesSpec::readDirectory);
|
|
30
|
+
prototype.registerHybridMethod("rename", &HybridNarsilFilesSpec::rename);
|
|
31
|
+
prototype.registerHybridMethod("unlink", &HybridNarsilFilesSpec::unlink);
|
|
32
|
+
prototype.registerHybridMethod("removeDirectory", &HybridNarsilFilesSpec::removeDirectory);
|
|
33
|
+
prototype.registerHybridMethod("link", &HybridNarsilFilesSpec::link);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilFilesSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `FileStatus` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::narsil { struct FileStatus; }
|
|
18
|
+
// Forward declaration of `DirectoryEntry` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::narsil { struct DirectoryEntry; }
|
|
20
|
+
|
|
21
|
+
#include <string>
|
|
22
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
23
|
+
#include <NitroModules/Promise.hpp>
|
|
24
|
+
#include "FileStatus.hpp"
|
|
25
|
+
#include "DirectoryEntry.hpp"
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::narsil {
|
|
29
|
+
|
|
30
|
+
using namespace margelo::nitro;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* An abstract base class for `NarsilFiles`
|
|
34
|
+
* Inherit this class to create instances of `HybridNarsilFilesSpec` in C++.
|
|
35
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
36
|
+
* @example
|
|
37
|
+
* ```cpp
|
|
38
|
+
* class HybridNarsilFiles: public HybridNarsilFilesSpec {
|
|
39
|
+
* public:
|
|
40
|
+
* HybridNarsilFiles(...): HybridObject(TAG) { ... }
|
|
41
|
+
* // ...
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
class HybridNarsilFilesSpec: public virtual HybridObject {
|
|
46
|
+
public:
|
|
47
|
+
// Constructor
|
|
48
|
+
explicit HybridNarsilFilesSpec(): HybridObject(TAG) { }
|
|
49
|
+
|
|
50
|
+
// Destructor
|
|
51
|
+
~HybridNarsilFilesSpec() override = default;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
// Properties
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
// Methods
|
|
59
|
+
virtual double open(const std::string& path, const std::string& flags) = 0;
|
|
60
|
+
virtual void close(double descriptor) = 0;
|
|
61
|
+
virtual double read(double descriptor, const std::shared_ptr<ArrayBuffer>& target, double byteOffset, double byteLength, double position) = 0;
|
|
62
|
+
virtual double write(double descriptor, const std::shared_ptr<ArrayBuffer>& source, double byteOffset, double byteLength, double position) = 0;
|
|
63
|
+
virtual void sync(double descriptor) = 0;
|
|
64
|
+
virtual std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> readAsync(double descriptor, double byteLength, double position) = 0;
|
|
65
|
+
virtual std::shared_ptr<Promise<double>> writeAsync(double descriptor, const std::shared_ptr<ArrayBuffer>& source, double byteOffset, double byteLength, double position) = 0;
|
|
66
|
+
virtual std::shared_ptr<Promise<void>> syncAsync(double descriptor) = 0;
|
|
67
|
+
virtual void truncate(double descriptor, double byteLength) = 0;
|
|
68
|
+
virtual FileStatus descriptorStatus(double descriptor) = 0;
|
|
69
|
+
virtual FileStatus pathStatus(const std::string& path) = 0;
|
|
70
|
+
virtual void makeDirectory(const std::string& path) = 0;
|
|
71
|
+
virtual std::vector<DirectoryEntry> readDirectory(const std::string& path) = 0;
|
|
72
|
+
virtual void rename(const std::string& from, const std::string& to) = 0;
|
|
73
|
+
virtual void unlink(const std::string& path) = 0;
|
|
74
|
+
virtual void removeDirectory(const std::string& path) = 0;
|
|
75
|
+
virtual void link(const std::string& existingPath, const std::string& newPath) = 0;
|
|
76
|
+
|
|
77
|
+
protected:
|
|
78
|
+
// Hybrid Setup
|
|
79
|
+
void loadHybridMethods() override;
|
|
80
|
+
|
|
81
|
+
protected:
|
|
82
|
+
// Tag for logging
|
|
83
|
+
static constexpr auto TAG = "NarsilFiles";
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilHostSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridNarsilHostSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::narsil {
|
|
11
|
+
|
|
12
|
+
void HybridNarsilHostSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("reserveMemory", &HybridNarsilHostSpec::reserveMemory);
|
|
18
|
+
prototype.registerHybridMethod("allocateMemory", &HybridNarsilHostSpec::allocateMemory);
|
|
19
|
+
prototype.registerHybridMethod("ownsMemory", &HybridNarsilHostSpec::ownsMemory);
|
|
20
|
+
prototype.registerHybridMethod("atomic", &HybridNarsilHostSpec::atomic);
|
|
21
|
+
prototype.registerHybridMethod("fillRandom", &HybridNarsilHostSpec::fillRandom);
|
|
22
|
+
prototype.registerHybridMethod("processId", &HybridNarsilHostSpec::processId);
|
|
23
|
+
prototype.registerHybridMethod("processStartedAtMs", &HybridNarsilHostSpec::processStartedAtMs);
|
|
24
|
+
prototype.registerHybridMethod("processIsAlive", &HybridNarsilHostSpec::processIsAlive);
|
|
25
|
+
prototype.registerHybridMethod("processMemory", &HybridNarsilHostSpec::processMemory);
|
|
26
|
+
prototype.registerHybridMethod("appStorageDirectory", &HybridNarsilHostSpec::appStorageDirectory);
|
|
27
|
+
prototype.registerHybridMethod("deflateRaw", &HybridNarsilHostSpec::deflateRaw);
|
|
28
|
+
prototype.registerHybridMethod("inflateRaw", &HybridNarsilHostSpec::inflateRaw);
|
|
29
|
+
prototype.registerHybridMethod("gzip", &HybridNarsilHostSpec::gzip);
|
|
30
|
+
prototype.registerHybridMethod("gunzip", &HybridNarsilHostSpec::gunzip);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::narsil
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNarsilHostSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `ProcessMemory` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::narsil { struct ProcessMemory; }
|
|
18
|
+
|
|
19
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
20
|
+
#include "ProcessMemory.hpp"
|
|
21
|
+
#include <string>
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::narsil {
|
|
24
|
+
|
|
25
|
+
using namespace margelo::nitro;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An abstract base class for `NarsilHost`
|
|
29
|
+
* Inherit this class to create instances of `HybridNarsilHostSpec` in C++.
|
|
30
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
31
|
+
* @example
|
|
32
|
+
* ```cpp
|
|
33
|
+
* class HybridNarsilHost: public HybridNarsilHostSpec {
|
|
34
|
+
* public:
|
|
35
|
+
* HybridNarsilHost(...): HybridObject(TAG) { ... }
|
|
36
|
+
* // ...
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
class HybridNarsilHostSpec: public virtual HybridObject {
|
|
41
|
+
public:
|
|
42
|
+
// Constructor
|
|
43
|
+
explicit HybridNarsilHostSpec(): HybridObject(TAG) { }
|
|
44
|
+
|
|
45
|
+
// Destructor
|
|
46
|
+
~HybridNarsilHostSpec() override = default;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
// Properties
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Methods
|
|
54
|
+
virtual std::shared_ptr<ArrayBuffer> reserveMemory(double bytes) = 0;
|
|
55
|
+
virtual std::shared_ptr<ArrayBuffer> allocateMemory(double bytes) = 0;
|
|
56
|
+
virtual bool ownsMemory(const std::shared_ptr<ArrayBuffer>& buffer) = 0;
|
|
57
|
+
virtual double atomic(double operation, double elementKind, const std::shared_ptr<ArrayBuffer>& buffer, double byteIndex, double value, double replacement) = 0;
|
|
58
|
+
virtual void fillRandom(const std::shared_ptr<ArrayBuffer>& target, double byteOffset, double byteLength) = 0;
|
|
59
|
+
virtual double processId() = 0;
|
|
60
|
+
virtual double processStartedAtMs() = 0;
|
|
61
|
+
virtual bool processIsAlive(double processId) = 0;
|
|
62
|
+
virtual ProcessMemory processMemory() = 0;
|
|
63
|
+
virtual std::string appStorageDirectory() = 0;
|
|
64
|
+
virtual std::shared_ptr<ArrayBuffer> deflateRaw(const std::shared_ptr<ArrayBuffer>& source, double byteOffset, double byteLength) = 0;
|
|
65
|
+
virtual std::shared_ptr<ArrayBuffer> inflateRaw(const std::shared_ptr<ArrayBuffer>& source, double byteOffset, double byteLength, double rawByteLength) = 0;
|
|
66
|
+
virtual std::shared_ptr<ArrayBuffer> gzip(const std::shared_ptr<ArrayBuffer>& source, double byteOffset, double byteLength) = 0;
|
|
67
|
+
virtual std::shared_ptr<ArrayBuffer> gunzip(const std::shared_ptr<ArrayBuffer>& source, double byteOffset, double byteLength, double maxByteLength) = 0;
|
|
68
|
+
|
|
69
|
+
protected:
|
|
70
|
+
// Hybrid Setup
|
|
71
|
+
void loadHybridMethods() override;
|
|
72
|
+
|
|
73
|
+
protected:
|
|
74
|
+
// Tag for logging
|
|
75
|
+
static constexpr auto TAG = "NarsilHost";
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::narsil
|