many-level is a JavaScript library designed to share an abstract-level compatible database over network streams, acting as the spiritual successor to `multileveldown`. Currently at version 2.0.0, it allows a 'host' to expose a LevelDB-like database over any binary stream (e.g., TCP), while 'guests' can connect and interact with it as if it were a local `abstract-level` database instance. It leverages compact Protocol Buffers for efficient message encoding. The project follows a steady release cadence with significant updates marked by major version bumps addressing underlying stream mechanisms and protocol versions. A key differentiator is its optional seamless retry mechanism for guests, which helps maintain connectivity and resume operations, though it comes with a trade-off regarding snapshot guarantees. It ships with TypeScript types, providing a robust development experience.
npm install many-levelVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates setting up a `ManyLevelHost` server and connecting a `ManyLevelGuest` client, performing basic put/get/del operations, and ensuring proper shutdown.
Review custom stream pipelines and ensure compatibility with `readable-stream` v4 if directly interacting with `many-level`'s internal streams beyond `createRpcStream()`.
Consult the `UPGRADING.md` guide in the `many-level` repository for a detailed migration path from `multileveldown`.
Understand the trade-off between seamless retry and snapshot consistency. If snapshot guarantees are critical for your application, avoid `retry: true` and implement manual reconnection logic or handle potential iterator failures.
Ensure all `many-level` instances (host and guest) are on compatible versions to avoid protocol mismatch issues. Upgrade clients and servers in tandem.
Ensure the key exists before attempting to retrieve it, or implement error handling for `NotFound` errors. Verify network connectivity between guest and host.
Ensure you are calling `createRpcStream()` on an instance created with `new ManyLevelHost(db)` or `new ManyLevelGuest()`. Double-check import paths and object instantiation.
Implement robust error handling for stream pipelines, ensuring that operations are only attempted on active connections. The quickstart example demonstrates basic pipeline error handling.