Skip to content

refactor: introduce Queryable trait to replace explicit dataset-mode checks in context.rs #1304

Open

Description

@bplatz

Context

Raised as a review comment on PR #1292 by @zonotope:

probably not for this pr, but explicit checks for dataset mode (or any other "queryable" type) suggests that we could benefit from a trait here.

File: fluree-db-query/src/context.rs around line 747

Problem

Methods like single_db_user_graph_id, single_db_user_graph_iris, and similar arms in QueryContext guard behavior with explicit self.dataset.is_some() checks. This is a structural code smell: the "queryable type" (single-ledger vs. dataset/multi-ledger) should be expressed as a trait, not as runtime conditionals on Option<Dataset>.

Proposed Direction

Introduce a Queryable (or similar) trait that abstracts over single-ledger and dataset query contexts. Methods that currently branch on dataset.is_some() would instead dispatch polymorphically.

Scope

Likely a moderate-to-large refactor touching fluree-db-query and potentially call sites in fluree-db-api. Should be done as a standalone PR after the LSM novelty work lands.

Activity

  1. added
    triage:needs-decision
    P3
    area:query
    on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:querytriage:needs-decision

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions