mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-25 23:24:03 +00:00
This commit addresses two critical bugs identified in the comprehensive review:
1. Database Locking Bug (Rust):
- Problem: Multiple VectorDB instances couldn't share the same database file
- Root cause: redb::Database uses exclusive file locking
- Solution: Implemented global connection pool in storage.rs using
Lazy<Mutex<HashMap<PathBuf, Arc<Database>>>>
- Multiple VectorDB instances now share Arc<Database> for same path
- Location: crates/ruvector-core/src/storage.rs
2. Package Name Mismatch (NPM):
- Problem: ruvector-core was using non-existent scoped package names
- Fixed platformMap to use correct unscoped names:
* @ruvector/core-linux-x64 → ruvector-core-linux-x64-gnu
* @ruvector/core-linux-arm64 → ruvector-core-linux-arm64-gnu
* @ruvector/core-darwin-x64 → ruvector-core-darwin-x64
* @ruvector/core-darwin-arm64 → ruvector-core-darwin-arm64
* @ruvector/core-win32-x64 → ruvector-core-win32-x64-msvc
- Updated error messages to reference correct package names
- Location: npm/packages/core/index.js
Version Updates:
- ruvector-core: 0.1.1 → 0.1.2
- ruvector: 0.1.5 → 0.1.6
Published Packages:
- ruvector-core@0.1.2 (npm)
- ruvector@0.1.6 (npm)
Breaking Changes: None
Backwards Compatible: Yes
Test Coverage:
- Added test_multiple_instances_same_path() to verify connection pooling
- Library builds successfully with storage feature enabled
- CLI commands now work correctly with updated package resolution
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
const { platform, arch } = process;
|
|
|
|
// Platform mapping
|
|
const platformMap = {
|
|
'linux': {
|
|
'x64': 'ruvector-core-linux-x64-gnu',
|
|
'arm64': 'ruvector-core-linux-arm64-gnu'
|
|
},
|
|
'darwin': {
|
|
'x64': 'ruvector-core-darwin-x64',
|
|
'arm64': 'ruvector-core-darwin-arm64'
|
|
},
|
|
'win32': {
|
|
'x64': 'ruvector-core-win32-x64-msvc'
|
|
}
|
|
};
|
|
|
|
function loadNativeModule() {
|
|
const platformPackage = platformMap[platform]?.[arch];
|
|
|
|
if (!platformPackage) {
|
|
throw new Error(
|
|
`Unsupported platform: ${platform}-${arch}\n` +
|
|
`Ruvector native module is available for:\n` +
|
|
`- Linux (x64, ARM64)\n` +
|
|
`- macOS (x64, ARM64)\n` +
|
|
`- Windows (x64)`
|
|
);
|
|
}
|
|
|
|
try {
|
|
return require(platformPackage);
|
|
} catch (error) {
|
|
if (error.code === 'MODULE_NOT_FOUND') {
|
|
throw new Error(
|
|
`Native module not found for ${platform}-${arch}\n` +
|
|
`Please install: npm install ${platformPackage}\n` +
|
|
`Or reinstall ruvector-core to get optional dependencies`
|
|
);
|
|
}
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
module.exports = loadNativeModule();
|