-
Notifications
You must be signed in to change notification settings - Fork 0
[Phase 3] Implement StorageBackend interface/trait for pluggable backends #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #13
Implements issue #13 - StorageBackend interface/trait enabling pluggable storage backends JavaScript changes: - Add StorageBackend interface with lifecycle, CRUD, batch, and metadata operations - Add BackendCapabilities and BackendStats types for backend introspection - Add MemoryBackendAdapter wrapping MemoryLinkStore with StorageBackend interface - Add BackendRegistry for registering and creating backends by configuration - Add comprehensive tests for backend registry and adapter (30 tests) - Add changeset for minor version bump Rust changes: - Add StorageBackend trait with async lifecycle, CRUD, and batch operations - Add BackendCapabilities, BackendStats, and DurabilityLevel types - Add MemoryBackend implementing StorageBackend trait - Add StorageBackendDyn for object-safe trait objects - Add BackendRegistry for factory-based backend creation - Bump version to 0.2.0 for the new feature Both implementations: - Support connect/disconnect lifecycle management - Track operation statistics (reads, writes, deletes, queries) - Report backend capabilities and durability levels - Enable switching between backends via configuration - Maintain API parity between JS and Rust Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use .ts and .d.ts extensions instead of .js for type imports to resolve Deno type-checking errors. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ILink export was using `export type { Link as ILink } from './types.js'`
which caused Deno to fail with "Cannot find module types.js".
Changed to a simple type alias: `export type ILink = Link;`
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Changed JSDoc imports from '../types.js' to '../index.js' in registry.js - Updated registry.d.ts to import Link types from '../types.ts' to match the StorageBackend interface, fixing the type mismatch error - Fixed prettier formatting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove beforeEach from JS tests for Deno compatibility (Deno's node:test doesn't support beforeEach) - Use createConnectedBackend() helper and inline reset() calls instead - Fix Rust formatting with cargo fmt - Fix useless comparison warning (u64 >= 0) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit a820d2a.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Ensure all changes are correct, consistent and fully meet the requirements. |
|
🤖 AI Work Session Started Starting automated work session at 2026-01-17T09:44:47.038Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Resolves conflicts by keeping both backend exports (from this branch) and queue exports (from main). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 AI Work Session CompletedChanges in this session:
The PR is ready for review. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
Implements issue #13 - StorageBackend interface/trait that enables pluggable storage backends. This abstraction allows switching between memory, link-cli, and custom backends via configuration without code changes.
Fixes #13
JavaScript Changes
New Files
js/src/backends/types.ts- TypeScript type definitions for StorageBackend interfacejs/src/backends/registry.js- Backend registry and MemoryBackendAdapter implementationjs/src/backends/registry.d.ts- TypeScript declarations for registryjs/tests/backend-registry.test.js- Comprehensive test suite (30 tests)StorageBackend Interface
Usage Example (JavaScript)
Rust Changes
New Files
rust/src/backends/traits.rs- StorageBackend trait and typesrust/src/backends/memory_backend.rs- MemoryBackend implementationrust/src/backends/registry.rs- BackendRegistry and StorageBackendDyn traitStorageBackend Trait
Usage Example (Rust)
Features
Both Implementations
BackendCapabilities
supportsTransactions- Whether the backend supports atomic transactionssupportsBatchOperations- Whether batch operations are native (vs. simulated)durabilityLevel-'none'|'fsync'|'replicated'maxLinkSize- Maximum link size in bytes (0 for unlimited)supportsPatternQueries- Whether pattern queries are native (vs. scanning)BackendStats
totalLinks- Total number of links storedusedSpace- Approximate storage space usedoperations- Read/write/delete/query countersconnectedAt- Connection timestampuptimeMs- Uptime in millisecondsTest Plan
Version Changes
🤖 Generated with Claude Code