Skip to content

feat: expose stored_at from PUT queries#91

Open
afterburn wants to merge 1 commit intov7from
feat/expose-stored-at-v2
Open

feat: expose stored_at from PUT queries#91
afterburn wants to merge 1 commit intov7from
feat/expose-stored-at-v2

Conversation

@afterburn
Copy link
Contributor

Adds PutResult with a stored_at: u8 field that reports how many DHT nodes acknowledged storing a value after a PUT. The existing put and put_mutable methods are unchanged. New put_with_info and put_mutable_with_info variants return PutResult instead of just the target Id, this means this is a non breaking, backward compatible change.

@afterburn afterburn requested a review from 86667 March 6, 2026 16:26
@afterburn afterburn marked this pull request as ready for review March 6, 2026 16:26
Copy link

@86667 86667 left a comment

Choose a reason for hiding this comment

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

I dont like this API at all.

We have 3 PUT methods exposed: put(), put_immutable() and put_mutable(). Plus I guess announce_peer() is a PUT also?

Here we add two new function put_with_info() and put_mutable_with_info(), what about the others?

This adds 2 (or 4) functions which are behaviourally identical to the existing functions apart from their return type - they even use the same internal put_inner(). The _with_info() suffix is not useful and i dont understand why we are avoiding changing the return types of the existing functions if this is being merged into a breaking change branch anyway? Appologies if im missing something obvious, this is my immediate impression

.map(|r| r.target)
}

/// Same as put, but returns a [PutResult] instead of just the target Id.
Copy link

Choose a reason for hiding this comment

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

These docs could be much better.

What is PutResult? Why use this instead of put? what is stored_at?

We know because we understand the code and wrote these new functions, but a consumer using the lib doesnt have that context. API function docs should explain why the fn exists, what its used for, etc. AI is good at writing these

let (sender, _) = flume::bounded::<Result<Id, PutError>>(1);
let (sender, _) = flume::bounded::<Result<PutResult, PutError>>(1);
let request =
PutRequestSpecific::PutMutable(PutMutableRequestArguments::from(item, None));
Copy link

Choose a reason for hiding this comment

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

No basic tests for the sync methods?

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.

2 participants