Skip to content

v6: Per-collection-handle consistency #440

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

Open
wants to merge 10 commits into
base: v6
Choose a base branch
from
Open

v6: Per-collection-handle consistency #440

wants to merge 10 commits into from

Conversation

bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Aug 18, 2025

This PR adds an option to set default consistency level on a CollectionHandle/-Async. If set, consistency level will be applied to all operations in query and data namespaces.

The API is simple and similar to that in the Python client:

// Derive a modified collection handle with a different ConsistencyLevel
var things = client.collections.use("Things");
var thingsQuorum = things.withConsistencyLevel(ConsistencyLevel.QUORUM);
var thingsAll = things.withConsistencyLevel(ConsistencyLevel.ALL);

// Or configure it immediately on creation
var thingsOne = client.collections.use("Things",
    with -> with.consistencyLevel(ConsistencyLevel.ONE));

CollectionHandle/-Async can be inspected:

things.consistencyLevel() // returns null
thingsAll.consistencyLevel() // returns ConsistencyLevel.ALL

Default ConsistencyLevel can be overridden for an individual query. For example, this search is done with ConsistencyLevel.ONE.

thingsAll.query.nearObject(
    "test-uuid",
     q -> q.consistencyLevel(ConsistencyLevel.ONE));

bevzzz added 2 commits August 18, 2025 12:34
E.g., when nearText is called with NearText.of() instead of
a 'String queryTerm', consistencyLevel must be added on the
RPC level.
Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz marked this pull request as ready for review August 20, 2025 13:22
@bevzzz bevzzz self-assigned this Aug 20, 2025
@bevzzz bevzzz requested a review from dirkkul August 20, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant