Import under a destination lock
A synchronous configuration importer decodes leased working text and stores parsed fields in destination caches.
What needs to change
Repair importInto so the import uses and releases exactly the resources it acquired, in the required lifetime order.
Reproduce
- Use `clang++ -std=c++2c -Wall -Wextra -pedantic main.cpp -o main && ./main` with the supplied file. Run the destination sample and compare the store/error and release lines in order.
Acceptance criteria
Your review marks · Saved in this browser. Test acceptance is tracked separately.
Notes
The file supplies the map-backed pool, BufferLease and CacheLock owners and exception-reporting operations. Change only importInto.
Each input source is one nonempty token. A valid assignment has exactly one = and nonempty key and value; the decoder stores the parsed fields and returns a cache readback.
Input uses LF/CRLF records with ordinary ASCII spaces/tabs between fields and ASCII space/tab/CR framing. Other valid UTF-8 characters, including BOM and NEL, remain part of a token.
At most 50 records and 4096 bytes per physical line keep the supplied scanner and lease serial within their supported capacity. Assignment keys and values are opaque strings: leading zeros and plus-like text keep their spelling.
Input: assignment followed by destination. Destination tokens exclude U+0000. local and shared are writable; another destination is unavailable. The destination guard gives this synchronous importer single-owner access; concurrent synchronization is outside this lesson.