-
Notifications
You must be signed in to change notification settings - Fork 296
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
Add ostree_repo_hash() and use it to canonicalise sets of repos #1191
Comments
Add a hash function for OstreeRepo instances, which relies on the repo being open, and hence being able to hash the device and inode of its root directory. Add unit tests for this and ostree_repo_equal(). Signed-off-by: Philip Withnall <withnall@endlessm.com> ostreedev#1191
I’ve put a patch in PR #1205 which implements In the meantime, though, PR #1205 can be pushed independently of #1179. |
Add a hash function for OstreeRepo instances, which relies on the repo being open, and hence being able to hash the device and inode of its root directory. Add unit tests for this and ostree_repo_equal(). Signed-off-by: Philip Withnall <withnall@endlessm.com> #1191 Closes: #1205 Approved by: cgwalters
Hah, actually, the @cgwalters, could we do better with |
I’ve got a WIP branch here which plays around with using |
Yeah, messy. We could keep the repos (hence the fds) around rather than gathering a set of paths perhaps? |
You mean passing a set of We could extend |
As suggested in #1179 (comment), rather than using
realpath()
on the paths of a set of repositories to try and eliminate duplicates, it would be better to add anostree_repo_hash()
function which can be used withostree_repo_equal()
with aGHashTable
to eliminate duplicates.ostree_repo_hash()
could return its hash value asg_int_hash (repo->device) ^ g_int_hash (repo->inode)
, for example. If the repository is not yet open, we could either abort, or return a fixed hash value. If we do the latter, we’ll run into problems if a repo is added to a hash table, then opened. The former is a nuclear option for avoiding this.The text was updated successfully, but these errors were encountered: