Skip to content

Conversation

@jrray
Copy link
Collaborator

@jrray jrray commented Oct 24, 2025

To address the problem demonstrated in #1282, clean needs to delete things in a top-level order, and skip cleaning children of anything deemed uncleanable.

The plan is to make iter_objects (now iter_items) return more detailed information including what the item's parent(s) are, so that the consumer of the stream can build up a graph of items. Since iter_items can be called over RPC and used as a stream, it isn't practical to compute the entire graph and return it in a single response. But the stream items can be used to build up the graph incrementally.

It's working as a proof of concept (as in all tests pass) but I didn't update the rpc repo type for these changes and handling payloads is unfinished. I'm surprised it even compiles with the server feature enabled, as I was avoiding turning that feature on until I got the basics working.

Edit: I see, object iteration over rpc isn't supported.

async fn iter_objects(
&self,
_request: Request<proto::IterObjectsRequest>,
) -> Result<Response<Self::IterObjectsStream>, Status> {
Err(Status::unimplemented(
"object iteration is no yet supported directly over gRPC",
))
}

@jrray jrray self-assigned this Oct 24, 2025
@jrray jrray force-pushed the clean-in-topological-order branch from b313368 to 74f07c7 Compare October 24, 2025 21:08
@jrray jrray changed the title WIP: Rework clean and iter_objects for topological traversal Rework clean and iter_objects for topological traversal Oct 24, 2025
@jrray jrray added bug Something isn't working pr-chain This PR doesn't target the main branch, don't merge! labels Oct 24, 2025
@jrray jrray force-pushed the clean-in-topological-order branch from 25d9c79 to 50b5ce6 Compare October 24, 2025 21:20
@jrray jrray marked this pull request as draft October 24, 2025 21:20
@jrray jrray force-pushed the clean-in-topological-order branch from 50b5ce6 to b405511 Compare October 24, 2025 22:22
@jrray jrray marked this pull request as ready for review October 24, 2025 22:35
@jrray jrray requested a review from rydrman October 24, 2025 22:55
@jrray jrray force-pushed the clean-in-topological-order branch from b405511 to ba586aa Compare October 24, 2025 23:12
@jrray jrray force-pushed the push-volovwxpnxry branch 2 times, most recently from 2640233 to 9ef4438 Compare October 25, 2025 18:19
@jrray jrray force-pushed the clean-in-topological-order branch from ba586aa to 9aae863 Compare October 25, 2025 18:19
jrray added 2 commits October 25, 2025 11:29
To address the problem demonstrated in #1282, clean needs to delete
things in a top-level order, and skip cleaning children of anything
deemed uncleanable.

The plan is to make iter_objects (now iter_items) return more detailed
information including what the item's parent(s) are, so that the
consumer of the stream can build up a graph of items. Since iter_items
can be called over RPC and used as a stream, it isn't practical to
compute the entire graph and return it in a single response. But the
stream items can be used to build up the graph incrementally.

Signed-off-by: J Robert Ray <jrray@jrray.org>
This is only true when there are no concurrent writers!

This is the test from #1282 but passes as of the changes in this PR.

Signed-off-by: J Robert Ray <jrray@jrray.org>
@jrray jrray force-pushed the push-volovwxpnxry branch from 9ef4438 to 1c49e90 Compare October 25, 2025 18:31
@jrray jrray force-pushed the clean-in-topological-order branch from 9aae863 to 8fecf80 Compare October 25, 2025 18:31
Comment on lines +669 to +673
let mut dfs = Dfs::new(&g, node_idx);
while let Some(n) = dfs.next(&g) {
let node = idx_to_node.get(&n).unwrap();
attached_nodes.insert(node.digest());
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note to self, this should also mark these objects as attached in self.attached.

Comment on lines +717 to 721
let mut dfs = Dfs::new(&g, node_idx);
while let Some(n) = dfs.next(&g) {
let node = idx_to_node.get(&n).unwrap();
attached_nodes.insert(node.digest());
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note to self, this should also mark these objects as attached in self.attached.

Copy link
Collaborator

@rydrman rydrman left a comment

Choose a reason for hiding this comment

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

Just reminding that you have a couple of notes to self on this one, in case you intend to resolve those still

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

Labels

bug Something isn't working pr-chain This PR doesn't target the main branch, don't merge!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants