Skip to content

Snapshots API differs from PartionHandle in Result Error type #156

@uniphil

Description

@uniphil

Not really a bug but a bit of a surprise/annoyance and not easily visible in the API docs.

I have a custom Error type with a From fjall::Error variant, which makes working with the PartitionHandle APIs pretty nice. For example, range maps lsm-tree errors into fjall::Errors so things Just Work for eg. .range(): https://docs.rs/fjall/2.8.0/src/fjall/partition/mod.rs.html#428-435

However, when I wanted to do multiple reads with Snapshot consistency, changing my code to call the APIs on Snapshot instead of PartitionHandle exposed it raw lsm-tree errors directly.

Looks like Snapshot uses Deref to cleverly expose the LSM tree APIs without explicitly re-wrapping them like PartionHandle does: https://docs.rs/fjall/2.8.0/src/fjall/tracked_snapshot.rs.html#13-18 which is cool but misses the fjall::Error wrapping.

It's fine, just surprising for the Error type to change. I can work around by having another variant on my own Error type for lsm-tree's Error.

But I'm submitting this for consideration: for a little more tedious boilerplate almost-duplicated code, it might be nice when APIs can break (v3?) to wrap the Snapshot calls instead of just Deref'ing to lsm-tree.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions