Repository navigation
feat: object deletion support — Delete(), GroupWriter.DeleteAttribute(), allocator Free() (Issue #51) - #57
Merged
Merged
Conversation
…ocator Free() Implement full object deletion for the HDF5 library (Issue #51, ADR-002): - GroupWriter.DeleteAttribute(): delegates to existing deleteAttribute() - Allocator.Free(): best-fit reuse, adjacent coalescing, EOF shrink - unlinkFromParent(): reverse of linkToParent, B-tree/SNOD rebuild - FileWriter.Delete(path): public API with reference counting and cascade delete (contiguous data, chunked B-tree walk, group structures) Error cases: empty/invalid path, root group, non-existent path, non-empty groups. 22 new tests covering all paths.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements full object deletion support per ADR-002, following the HDF5 C reference implementation.
Closes #51
New public API
What's implemented
GroupWriter.DeleteAttribute()deleteAttribute()— compact + dense storageAllocator.Free(offset, size)unlinkFromParent()linkToParent()— removes SNOD entry, rewrites B-tree v1fw.Delete(path)C reference functions implemented
H5Ldelete→fw.Delete()(unlink from parent)H5O_link(adjust=-1)→ refcount decrementH5O_delete→ cascade delete when nlink=0H5O__layout_delete→ free contiguous data / walk chunked indexH5MF_xfree→Allocator.Free()with FSM-style reuseChanges
delete_write.go— new file,fw.Delete()public API (+397)delete_write_test.go— 12 test functions (+480)group_write.go—GroupWriter.DeleteAttribute()+unlinkFromParent()(+182)internal/writer/allocator.go—Free(), coalescing, best-fit reuse (+190)internal/writer/allocator_free_test.go— 10 tests + benchmark (+256)group.go— minor lint fix (+1/-1)Total: +1486/-20
Test plan
go test ./...— 100% passgolangci-lint run ./...— 0 issuesgo fmtclean