New week, new Rust! What are you folks up to?
Graceful shutdown, figuring out how to make sure pending updates are written to the filesystem before program terminates ( under Linux / systemd ).
Otherwise a user who thinks he has saved something ( got a response from webserver ) might discover later it hasn't actually been saved because the systemd process was restarted or the server was rebooted at the critical moment.
I have a process that performs the database updates ( a kind-of buffering scheme ). Which works fine, but on shutdown it ought to finish or "promised" commits may be lost (the database would still be ok, but not as updated as it ought to be ). The number of outstanding writes is limited, so the program should still terminate pretty quickly ( say in less than a second ). I don't know yet how long the process is allowed by systemd / the operating system before it gets a "stronger" kill signal. I think it is quite a while.
Edit: a quick google brings up this: " By default, a SIGTERM is sent, followed by 90 seconds of waiting followed by a SIGKILL ."
Hacking some new behaviors onto some scientific Rust code I wrote a couple of years ago. Despite minimal documentation/comments and a few cringeworthy architectural choices, the compiler and Rust's design have made for smooth sailing thus far.
Bitmap font and text rendering support for retrofire!
Using codepage 437, of course (this particular font is still a bit WIP):
I wrote a guide on choosing common strategies for ownership and borrowing: Rust Patterns for Lifetime Management
Making "LargeBitFlag" object/library. A normal Bit Flag is based on the Arch size: 32, 64, etc... and I wanted more than that. So a struct that is just a single variable of 'vec'. Now I have 'usize' number of 'usize' bits: 'usize_max * arch_bits' bits.
3 different "new" functions to create the "LargeBitFlag":
- Allow the user to just pass in a number and the function will set the correct bit in the correct index.
- Allow the user to pass in the array index and the bit (take only 1-arch_bits)
- Allow the user to pass in an array slice.
And I'll overload the &, &=, |, |=, and = operators.
Have you considered using bitvec
for your large bit flags? Just putting this here in case you weren't aware of the library.
Thanks, I'll check it out.
Continuing the work on proxy, added hot reload for proxy routing configuration and figured out how to add SNI with rustls.
Now would be bit of refactoring of the code from main.rs file into logical files and add caching configuration, probably will use Redis (unless someone has something else to recommend ) as central cache store.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.