Restructured high-level commit logic (across rbyds/btrees/mdirs)
This flattens a number of low-level APIs, mainly the rbyd-attr-list
APIs, into higher-level logic in an effort to remove special flags,
awkward hacks, etc. This comes at a cost, should probably be cleaned
up/deduplicated a bit more, but creates a level of code transparency
that hopefully helps reveal where some logic can be simplified.
One change is the addition of incremental compaction APIs:
- lfsr_rbyd_appendcompactattr
- lfsr_rbyd_compact
These allow upper-layers to build rbyd compactions incrementally, as
long as they ensure attrs are written in order. This makes the btree
merge no longer a special case and even allows us to write the split
name into the rbyd during compaction.
Another big change is the inversion of the mdir commit/compaction logic.
Previously, lfsr_mdir_compact_ was the ground-level mdir operation, but
since lfsr_mdir_compact_ still needs to write out the attrs after
compaction, this led to a lot of mdir logic leaking into the rbyd
functions.
Now, there is a mid-level lfsr_mdir_commit_ that handles both normal
commits and compactions, with a low-level lfsr_mdir_commit__ that
handles only the writing of mdir attributes.
This also leads to a bit better code reuse, as upper-layer mdir logic
often needs to do a low-level commit with the expectation of no
compaction. No more special mdir compaction "reason" enum.
Before:
lfsr_mdir_commit
'-> lfsr_mdir_commit_
|-> lfsr_rbyd_commit
'-> lfsr_mdir_compact_
'-> lfsr_rbyd_compact
After:
lfsr_mdir_commit
'-> lfsr_mdir_commit_
|-> lfsr_mdir_commit__
| '-> lfsr_rbyd_commit
'-> lfsr_rbyd_compact
Also, thanks to inlining the compaction logic, our mroot extension can
now copy the config attrs directly from the previousl mrootanchor,
instead of the previous roundabout method of committing the explicit
config attributes we want to keep.
code stack
before: 20826 1744
after: 21434 (+2.8%) 1768 (+1.4%)
This commit is contained in: