Repository navigation
feat(libobs): port buffered-file-serializer to Rust - #76
Merged
zackees merged 2 commits intoOct 10, 2026
Merged
Conversation
6 tasks done
zackees
force-pushed
the
rust/buffered-file-serializer-port
branch
from
October 10, 2026 16:46
215b8e7 to
f7b48fd
Compare
Member
|
Rebased onto master (now includes file-serializer #66/#71, vec3, obs-nal). CI fixes:
|
zackees
force-pushed
the
rust/buffered-file-serializer-port
branch
4 times, most recently
from
October 10, 2026 18:28
32ac7a8 to
4c41b37
Compare
The Tier 1 tests mirror the cmocka buffered cases. create() panics. Refs obs-rust#44
The writer thread queues a seek offset and a length ahead of each piece, then flushes in chunk_size pieces. Chunks under 64 KiB stay off disk until free, a discontinuous seek, or a full chunk. SERIALIZE_SEEK_END subtracts from the virtual write position. A flushed chunk uses File::write, so those bytes can show up before close. C's fwrite can keep them in the stdio buffer until fclose. Debug and error blog lines are not emitted. A null serializer pointer to free returns. Tier 1 mirrors the cmocka buffered cases. Tier 3 compares the C ABI with the original C file. Mutating SEEK_END to add failed test_buffered_seek_overwrite (26 vs 16). Reverted. Refs obs-rust#44 Local-Gate: v1 tree=f18161255304bc9860f6266304613861f5226078 secs=159 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791662609,"gate":"rust/all/fmt","host":"linux-x86_64","key":"6531101e87d706de0266006e35454043f0b58f05584d8a4c049bb9e0482f35ef","lane":"lint","parents":["8540716bb2a98272ac434199e9d7cabbd32b3b0a"],"secs":50,"stamp":"84994a845977cab8e9688f8fd89f5e3c","tree":"f18161255304bc9860f6266304613861f5226078","v":1,"via":"run"} Ci-Attestation: {"at":1791662609,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"6531101e87d706de0266006e35454043f0b58f05584d8a4c049bb9e0482f35ef","lane":"lint","parents":["8540716bb2a98272ac434199e9d7cabbd32b3b0a"],"secs":50,"stamp":"13157f954682b667c41f1c6eb6002eb4","tree":"f18161255304bc9860f6266304613861f5226078","v":1,"via":"run"} Ci-Attestation: {"at":1791662609,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"9fd9d85849d4e91afee790e4e78644a0db02013dca4a8a14731f15ff023dd9d8","lane":"rust-test","parents":["8540716bb2a98272ac434199e9d7cabbd32b3b0a"],"secs":29,"stamp":"9a8f67e52645ce025d5d7c2745fafab5","tree":"f18161255304bc9860f6266304613861f5226078","v":1,"via":"run"} Ci-Attestation: {"at":1791662609,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"8d2e21f6ea634d9c1cbdc6901bb752d3b273022f090bee25e5fee91575715143","lane":"tier2-linux","parents":["8540716bb2a98272ac434199e9d7cabbd32b3b0a"],"secs":81,"stamp":"a1fcce354aae6a44391289d37463694d","tree":"f18161255304bc9860f6266304613861f5226078","v":1,"via":"run"}
Member
|
Rebased onto master (after #59, #78 and #106), keeping both sides in the oracle build.rs and lib.rs and in validate.sh's must-not-compile list, plus rustfmt of the module lists. RED→GREEN, checked with soldr's cache disabled: buffered_file_serializer fails 6/6 at the RED commit and the full suite passes at head. The local gate passes and is stamped. |
zackees
force-pushed
the
rust/buffered-file-serializer-port
branch
from
October 10, 2026 20:03
4c41b37 to
df2b309
Compare
Closed
2 tasks
This was referenced Oct 10, 2026
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.
Description
Ports
libobs/util/buffered-file-serializer.cto Rust. A background thread queues a seek offset and a length ahead of each piece, then writes the file inchunk_sizechunks. Chunks under 64 KiB stay off disk until free, a discontinuous seek, or the next piece would passchunk_size.SERIALIZE_SEEK_ENDsubtracts from the virtual write position. A flushed chunk usesFile::write, so those bytes can show up before close. C'sfwritecan keep them in the stdio buffer untilfclose. Close flushes. This does notfsync.file-serializer.cstays C.test/cmocka/test_file_serializer.cis unchanged. WithENABLE_RUST_LIBOBS=ONthe buffered cases run against the Rust shim.Unknown seek codes leave the position alone. The C switch has no default.
A null path returns false and leaves the serializer untouched, matching C. A null serializer pointer to
buffered_file_serializer_freereturns. C would crash. A null data pointer with a non-zero size returns 0. Debug and errorbloglines are not emitted. The C oracle still printsFinal buffer capacityfrom its writer thread during Tier 3. libtest does not capture that thread, so those lines show up in the test log.Motivation and Context
Issue #44 still has the buffered file serializer open. This is that file only. The three functions in
buffered-file-serializer.hare unchanged. It does not close #44.file-serializer.cis PR #66, and config-file, platform, threading, pipe, task, and profiler are still open.Refs #44
How Has This Been Tested?
macOS 27.0.1 (26A434), Apple Silicon (arm64), rustc 1.97.1 (8bab26f4f 2026-07-14).
./lint: clang-format, gersemi, rustfmt, clippy-D warnings. Pass.soldr cargo test -p obs-util --test buffered_file_serializer -- --test-threads=1: 6 passed. These mirror the cmocka buffered cases on the safe core.soldr cargo test -p obs-util --test buffered_file_serializer_parity -- --test-threads=1: 13 passed, including proptest against the original C file compiled as an oracle.SERIALIZE_SEEK_ENDwas changed to add.test_buffered_seek_overwritefailed (left: 26,right: 16, from 21+5 against 21-5). Reverted, and that test passed again.ubuntu:26.04arm64: 29/29 cmocka tests passed withENABLE_RUST_LIBOBSOFF and ON, includingtest_file_serializer. libobs exports were identical (1752 symbols).buffered-file-serializer.c.ois not in the ON build graph.Windows was not run here.
Types of changes
Checklist: