@graphscope-neug/osx-arm64 0.2.0 → 0.2.1

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/CMakeLists.txt CHANGED
@@ -62,13 +62,34 @@ add_dependencies(neug_node_bind neug_proto)
62
62
  set(NEUG_LIBRARIES neug)
63
63
 
64
64
  find_package(OpenSSL REQUIRED)
65
- target_link_libraries(neug_node_bind PRIVATE
66
- ${NEUG_LIBRARIES}
67
- ${GLOG_LIBRARIES}
68
- ${Protobuf_LIBRARIES}
69
- OpenSSL::SSL
70
- OpenSSL::Crypto
71
- )
65
+ if (WIN32)
66
+ set(NODE_IMPORT_LIB "" CACHE FILEPATH
67
+ "Path to the Node.js import library (node.lib)")
68
+ if (NOT NODE_IMPORT_LIB OR NOT EXISTS "${NODE_IMPORT_LIB}")
69
+ message(FATAL_ERROR
70
+ "Cannot find the Node.js import library. Set NODE_IMPORT_LIB to node.lib.")
71
+ endif()
72
+
73
+ # Protobuf namespace-scope default instances are not exported from neug.dll.
74
+ # Link the generated objects into the addon, matching the Windows Python binding.
75
+ target_link_libraries(neug_node_bind PRIVATE
76
+ ${NEUG_LIBRARIES}
77
+ ${GLOG_LIBRARIES}
78
+ ${Protobuf_LIBRARIES}
79
+ $<TARGET_OBJECTS:neug_proto>
80
+ OpenSSL::SSL
81
+ OpenSSL::Crypto
82
+ "${NODE_IMPORT_LIB}"
83
+ )
84
+ else()
85
+ target_link_libraries(neug_node_bind PRIVATE
86
+ ${NEUG_LIBRARIES}
87
+ ${GLOG_LIBRARIES}
88
+ ${Protobuf_LIBRARIES}
89
+ OpenSSL::SSL
90
+ OpenSSL::Crypto
91
+ )
92
+ endif()
72
93
 
73
94
  target_compile_definitions(neug_node_bind PRIVATE
74
95
  NAPI_VERSION=8
@@ -99,13 +120,20 @@ endif()
99
120
  # into the package and replaces non-portable RPATHs before npm pack runs.
100
121
  if(APPLE)
101
122
  set(_neug_node_rpath "@loader_path")
102
- else()
123
+ elseif(NOT WIN32)
103
124
  set(_neug_node_rpath "$ORIGIN")
104
125
  endif()
105
126
 
106
- set_target_properties(neug_node_bind PROPERTIES
107
- BUILD_RPATH "${_neug_node_rpath}"
108
- INSTALL_RPATH "${_neug_node_rpath}"
109
- BUILD_WITH_INSTALL_RPATH FALSE
110
- )
111
- set_property(TARGET neug APPEND PROPERTY BUILD_RPATH "${_neug_node_rpath}")
127
+ if(NOT WIN32)
128
+ set_target_properties(neug_node_bind PROPERTIES
129
+ BUILD_RPATH "${_neug_node_rpath}"
130
+ INSTALL_RPATH "${_neug_node_rpath}"
131
+ BUILD_WITH_INSTALL_RPATH FALSE
132
+ )
133
+ set_property(TARGET neug APPEND PROPERTY BUILD_RPATH "${_neug_node_rpath}")
134
+ else()
135
+ # Windows has no RPATH. Keep neug.dll beside the addon so the loader can find it.
136
+ add_custom_command(TARGET neug_node_bind POST_BUILD
137
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
138
+ $<TARGET_FILE:neug> $<TARGET_FILE_DIR:neug_node_bind>)
139
+ endif()
package/README.md CHANGED
@@ -86,7 +86,7 @@ For local source builds, use `NEUG_NATIVE_ARCH=ON make dev`.
86
86
  The resulting tarball can be installed without a C++ build environment:
87
87
 
88
88
  ```bash
89
- npm install ./neug-0.2.0.tgz
89
+ npm install ./neug-0.2.1.tgz
90
90
  ```
91
91
 
92
92
 
@@ -142,8 +142,8 @@ db.close();
142
142
  ## Explicit Transactions
143
143
 
144
144
  Since v0.2, the embedded Node.js `Connection` API supports explicit AP
145
- transactions. Auto-commit remains the default; begin a transaction only when
146
- multiple ordinary queries must share one private view and one final commit.
145
+ transactions. Auto-commit remains the default; begin a transaction when
146
+ multiple queries must share one private view and one final commit.
147
147
 
148
148
  ```js
149
149
  const conn = db.connect();
@@ -163,5 +163,9 @@ conn.rollback();
163
163
  `hasActiveTransaction` remains true after a failed statement because the
164
164
  connection is rollback-only. Call `rollback()` before issuing another query.
165
165
  Nested transactions, read-to-write upgrades, Cypher `BEGIN`/`COMMIT`/`ROLLBACK`,
166
- and explicit-transaction COPY, batch, index, checkpoint, procedure, and
167
- temporary-schema operations are not supported.
166
+ checkpoint/maintenance, and mutating procedure calls are not supported. Since
167
+ v0.2.1, embedded read-write transactions may group persistent `COPY FROM`
168
+ statements with ordinary DML and DDL into one checkpoint at `commit()`;
169
+ graph-read-only `LOAD FROM`/`COPY TO` and `COPY TEMP` may run in either
170
+ transaction mode, and `COPY TEMP` may be mixed with durable writes (only
171
+ persistent changes reach disk).
package/lib/binding.js CHANGED
@@ -16,14 +16,15 @@
16
16
  'use strict';
17
17
 
18
18
  // Native artifacts live in build/<Release|Debug>/<platform>/.
19
- // Platform tags: linux_x86_64, linux_arm64, osx_x86_64, osx_arm64
19
+ // Platform tags: linux_x86_64, linux_arm64, osx_x86_64, osx_arm64,
20
+ // windows_x86_64
20
21
  // Prefer Debug if present (dev intent); otherwise Release (the only
21
22
  // flavor shipped in npm tarballs).
22
23
 
23
24
  const path = require('path');
24
25
  const fs = require('fs');
25
26
 
26
- const OS_MAP = { linux: 'linux', darwin: 'osx' };
27
+ const OS_MAP = { linux: 'linux', darwin: 'osx', win32: 'windows' };
27
28
  const ARCH_MAP = { x64: 'x86_64', arm64: 'arm64' };
28
29
 
29
30
  const os = OS_MAP[process.platform];
package/lib/connection.js CHANGED
@@ -77,6 +77,8 @@ class Connection {
77
77
  * @param {{readOnly?: boolean}} [options={}] Transaction options.
78
78
  * @param {boolean} [options.readOnly=false] Pin one read view and reject
79
79
  * writes. By default, the transaction uses a private COW write view.
80
+ * Since v0.2.1, persistent COPY FROM statements may be grouped with
81
+ * ordinary DML/DDL into one checkpoint at commit.
80
82
  * @throws {Error} If the connection is closed or already has an active
81
83
  * transaction.
82
84
  */
@@ -102,6 +104,8 @@ class Connection {
102
104
  /**
103
105
  * Commit the active explicit transaction.
104
106
  *
107
+ * Persistent COPY FROM statements are published through one checkpoint;
108
+ * other writes use the ordinary logical-WAL commit path.
105
109
  * A rollback-only transaction must be rolled back instead.
106
110
  */
107
111
  commit() {
package/lib/database.js CHANGED
@@ -28,7 +28,11 @@ const {
28
28
  // Load the native binding (unified loader handles prebuilds/ and build/)
29
29
  const nativeBinding = require('./binding');
30
30
 
31
- const ILLEGAL_CHARS = ['?', '*', '"', '<', '>', '|', ':', '\\'];
31
+ // On Windows, ':' (drive letter) and '\' (path separator) are valid, matching
32
+ // the Python binding's platform-aware validation.
33
+ const ILLEGAL_CHARS = process.platform === 'win32'
34
+ ? ['?', '*', '"', '<', '>', '|']
35
+ : ['?', '*', '"', '<', '>', '|', ':', '\\'];
32
36
  const PURE_MEMORY_PATHS = [':memory', ':memory:'];
33
37
  const VALID_MODES = [
34
38
  'r', 'read', 'w', 'rw', 'write',
@@ -58,9 +62,12 @@ const VALID_MODES = [
58
62
  */
59
63
  class Database {
60
64
  /**
61
- * Return the number of online CPUs, using the same system call as
62
- * Python's os.cpu_count() (sysconf(_SC_NPROCESSORS_ONLN)).
63
- * This is more reliable than os.cpus().length on arm64 Linux.
65
+ * Return the number of CPUs usable by the process, via the portable
66
+ * std::thread::hardware_concurrency() in the native binding
67
+ * (sysconf(_SC_NPROCESSORS_ONLN) on POSIX, GetSystemInfo on Windows).
68
+ * Typically matches Python's os.cpu_count() on mainstream platforms;
69
+ * returns 1 when the count is not detectable. This is more reliable
70
+ * than os.cpus().length on arm64 Linux.
64
71
  * @returns {number}
65
72
  */
66
73
  static cpuCount() {
@@ -121,8 +128,9 @@ class Database {
121
128
  );
122
129
  }
123
130
 
124
- // Use sysconf(_SC_NPROCESSORS_ONLN) via native binding to match
125
- // Python's os.cpu_count() behaviour (especially on arm64 Linux).
131
+ // Use std::thread::hardware_concurrency() via native binding (with a
132
+ // minimum of 1) to match Python's os.cpu_count() behaviour on
133
+ // mainstream platforms (especially on arm64 Linux).
126
134
  const cpuCount = Database.cpuCount();
127
135
  if (maxThreadNum > cpuCount) {
128
136
  throw new Error(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphscope-neug/osx-arm64",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "NeuG Graph Database Node.js bindings - high performance embedded graph database with Cypher query support",
5
5
  "main": "lib/index.js",
6
6
  "exports": "./lib/index.js",
@@ -15,7 +15,7 @@
15
15
 
16
16
  #include "node_database.h"
17
17
 
18
- #include <unistd.h>
18
+ #include <thread>
19
19
 
20
20
  #include <string>
21
21
 
@@ -156,7 +156,7 @@ Napi::Value NodeDatabase::Close(const Napi::CallbackInfo& info) {
156
156
  }
157
157
 
158
158
  Napi::Value NodeDatabase::GetCpuCount(const Napi::CallbackInfo& info) {
159
- long n = sysconf(_SC_NPROCESSORS_ONLN);
159
+ unsigned int n = std::thread::hardware_concurrency();
160
160
  if (n < 1) {
161
161
  n = 1;
162
162
  }