Skip to content

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
@bevzzz
Copy link
Collaborator Author

bevzzz commented Aug 21, 2025

Closed in favor of #445

@bevzzz bevzzz closed this Aug 21, 2025
@bevzzz bevzzz deleted the v6-consistency branch August 27, 2025 11:21
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