This is...a large churn refactoring, but very long overdue.
The goal with this change is to bring our HTTP API service (aka "SDF") in line with the structure of our other service components. The impetus for this work was after a production incident where our new "graceful shutdown" logic was being short circuited when SDF was running in the migrateAndQuit mode (written literally years ago).
The following are notable changes:
Internalize all sdf_server::Server setup into a from_config and from_services constructor.
Remove all former shutdown logic and replace it with CancellationTokens and TaskTrackers.
Centralize axum app creation for use between the library and integration test code.
Fix web socket shutdown logic, in the "updates" and "crdt" sessions. Now on graceful shutdown, SDF will issue a close frame with an AWAY code and all active web socket sessions will close.
Centralize server initialization code for use in the "just migrate and don't run the server" scenario.
Create a Migrator type which can either be created via a from_config constructor or returned from an sdf_server::Server via a migrator() method. This type is used to run all database/builtin/data migrations.
Move all modules under sdf_server::server into the root module directly. Frankly, this was my doing way back when there was a client module under a lib/sdf crate. There is no need for the additional nesting and makes it appear as though those modules are somehow more special or internal than similar code in our other server crates.
This is...a large churn refactoring, but very long overdue.
The goal with this change is to bring our HTTP API service (aka "SDF") in line with the structure of our other service components. The impetus for this work was after a production incident where our new "graceful shutdown" logic was being short circuited when SDF was running in the
migrateAndQuit
mode (written literally years ago).The following are notable changes:
sdf_server::Server
setup into afrom_config
andfrom_services
constructor.CancellationToken
s andTaskTracker
s.AWAY
code and all active web socket sessions will close.Migrator
type which can either be created via afrom_config
constructor or returned from ansdf_server::Server
via amigrator()
method. This type is used to run all database/builtin/data migrations.sdf_server::server
into the root module directly. Frankly, this was my doing way back when there was aclient
module under alib/sdf
crate. There is no need for the additional nesting and makes it appear as though those modules are somehow more special or internal than similar code in our other server crates.