Add basic POSIX mirror tree support#1017
Open
AlCutter wants to merge 1 commit into
Open
Conversation
49e43f1 to
692034b
Compare
692034b to
c21f4be
Compare
roger2hk
reviewed
Jun 24, 2026
| if err := unlock(); err != nil { | ||
| panic(err) | ||
| } | ||
| m.s.mu.Unlock() |
Contributor
There was a problem hiding this comment.
Same comment as the previous pull request. Immediately defer the mutex unlock after it is locked.
|
|
||
| lh := make([][]byte, 0, maxBundles) | ||
| n := 0 | ||
| for ri := range layout.Range(from, to, sourceSize) { |
Contributor
There was a problem hiding this comment.
Suggested change
| for ri := range layout.Range(from, to, sourceSize) { | |
| for ri := range layout.Range(from, to - from, sourceSize) { |
Lines 45 to 49 in 20980b0
| return 0, nil, errors.New("unimplemented") | ||
| targetSize := bundleIdx * layout.EntryBundleWidth | ||
| for b := range bundles { | ||
| p := len(b.Entries) |
Contributor
There was a problem hiding this comment.
If the number of entries is 0, it will be treated as a full tile writing empty bundle data to the full tile file.
| // marshalTlogEntryBundle returns a tlog-tiles compatible serialization of the provided entrybundle. | ||
| func marshalTlogEntryBundle(b api.EntryBundle) ([]byte, error) { | ||
| // Max size we could possibly write out. | ||
| data := make([]byte, 0, len(b.Entries)*(2+1<<16)) |
Contributor
There was a problem hiding this comment.
Note that this preallocation would consume around 16 MiB for a full bundle.
| func (m *MirrorWriter) fetchLeafHashes(ctx context.Context, from, to, sourceSize uint64) ([][]byte, error) { | ||
| const maxBundles = 300 | ||
|
|
||
| lh := make([][]byte, 0, maxBundles) |
Contributor
There was a problem hiding this comment.
There are 256 hashes in one bundle. Should this be maxBundles * layout.EntryBundleWidth instead of maxBundles?
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.
This PR adds a first cut at fleshing out the POSIX storage support for MTC mirrors.
Towards #945