* Implement direct write
* Support direct_write changes at runtime
* Check sparse support when download_dir changes
* Fixes to reverting to append mode and add tests
* Single write path, remove truncate, improve tests, add test for append mode with out of order direct writes
* assert expected nzf.assembler_next_index
* bytes_written_sequentially assertions
* Slim tests and mock load_article as a dictionary
* More robust bytes_written_sequentially
* Worked but guard Python -1 semantics
* os.path.getsize silly
* Add test with force followed by append to gaps
* Split flush_cache into its own function so the loop does not need to clear the article variable
* Fewer private functions
* Extract article cache limit for waiting constant
* Move option back to specials
* Use Status.DELETED for clarity
* Use nzo.lock in articlecache
* Document why assembler_next_index increments
* Remove duplicated code from write
* load_data formatting
* Create files with the same permissions as with open(...)
* Options are callable
* Fix crash if direct writing from cache but has been deleted
* Fix crash in next_index check via article cache
* Fix assembler waiting for register_article and cache waiting for assembler to write
* Simplify flush_cache loop and only log once per second
* Document why we would leave the assembler when forced at the first not tried article
* When skippedwe can't increment the next_index
* Rename bytes_written_sequentially to sequential_offset improve comments and logic
* Don't need to check when the config changes, due to the runtime changes any failure during assembly will disable it
* Remove unused constant
* Improve append triggering based on contiguous bytes ready to write to file and add a trigger to direct write
* Throttle downloader threads when direct writing out of order
* Clear ready_bytes when removed from queue
* Rework check_assembler_levels sleeping to have a deadline, be based on if the assembler actual pending bytes, and if delaying could have any impact
* Always write first articles if filenames are checked
* Rename force to allow_non_contiguous so it is clearer what it means
* Article is required
* Tweak delay triggers
* Fix for possible dictionary changed size during iteration
* postproc only gets the nzo
* Rename constants and remove redundant calculation
* For safety just key by nzf_id
* Not redundant because capped at 500M
* Tweak a little more
* Only delay if assembler is busy
* Remove unused constant and rename the remaining one
* Calculate if direct write is allowed when cache limit changes
* Allow direct writes to bypass trigger
* Avoid race to requeue
* Breakup the queuing logic so its understandable