Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: Remove slot mutex and simplfy per blob state#104

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
rklaehn wants to merge13 commits intoslim-down-state
base:slim-down-state
Choose a base branch
Loading
fromremove-slot-mutex

Conversation

rklaehn
Copy link
Collaborator

@rklaehnrklaehn commentedJul 10, 2025
edited
Loading

Description

Before, the state we kept per hash was a bit convoluted. The entry point was a Slot, which contained a tokio mutex to cover the async loading of an entry state from the metadata db. Then inside that, there was the actual entry state, wrapped in an option to cover the case that we don't have anything about the hash.

This was working, but it was an arc in an arc in an arc, and also led to bugs in the case of trying to export a blob that doesn't exist.

Now all these states are flattened into a single enum, and we can easily define what should happen when we e.g. do an export of an entry that does not exist - return an appropriate io error.

Breaking Changes

None

Notes & open questions

Note: you could remove the Initial and Loading state by using a tokio::sync::OnceCell. But that is a true sync primitive, and we want to use an AtomicRefCell, and also using a OnceLock would come with its own sync primitive (a semaphore) just for init, and then we have our own one for the non-load state changes. I don't think it is that bad...

Change checklist

  • Self-review.
  • Documentation updates following thestyle guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

@github-actionsGitHub Actions
Copy link

github-actionsbot commentedJul 10, 2025
edited
Loading

Documentation for this PR has been generated and is available at:https://n0-computer.github.io/iroh-blobs/pr/104/docs/iroh_blobs/

Last updated: 2025-07-11T11:58:22Z

///
/// You are not allowed to clone the state out of a task, even though that
/// is possible.
fn ref_count(&self) -> usize;
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

This isn't really needed - just a safeguard to alert people if they clone the state out of a task.

Not sure if I should keep it.

@rklaehnrklaehn changed the titleRemove slot mutexrefactor: Remove slot mutex and simplfy per blob stateJul 10, 2025
@n0botn0botbot added this toirohJul 10, 2025
@github-project-automationgithub-project-automationbot moved this to🏗 In progress inirohJul 10, 2025
@@ -213,6 +219,8 @@ mod entity_actor {
)
.await
.ok();
println!("Calling on_shutdown {}", self.state.state.ref_count());
Copy link
Collaborator

Choose a reason for hiding this comment

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

stray println

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dignifiedquiredignifiedquiredignifiedquire left review comments

Assignees
No one assigned
Labels
None yet
Projects
Status: 🏗 In progress
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@rklaehn@dignifiedquire

[8]ページ先頭

©2009-2025 Movatter.jp