Closed coolreader18 closed 1 week ago
Some other nits:
Paths
should build the layout, names, etc.Question: Is for a later pr the changes to the scripts:
run_standalone_temp.sh
run_cluster_temp.sh
?
I think so - someone mentioned that they aren't really used anymore, anyway.
@coolreader18 Two things:
Can you update the PR description to have all the usual details?
Is it possible/reasonable to split this into one PR that does the internal refactor and switches everything to use strongly-typed paths, and a separate PR that changes the user-facing behavior and moves the files into the new paths? I'm having trouble figuring out what's happening where, and I'm worried I'll miss something.
Description of Changes
Implements the new directory structure proposal, using strongly-typed newtypes to represent paths. All places in the database/server/cli that previously would have been passing around
PathBuf
s and.join()
ing them now instead pass around these types, calling methods on them that internally call.join()
and return another strongly-typed child node in the directory hierarchy.Changes from the proposal implemented here:
replicas/$database_identity/$replica_id/database/...
, to justreplicas/$replica_id/...
SPACETIMEDB_DISABLE_DISK_LOGGING
,SPACETIMEDB_TRACY
,SPACETIMEDB_FLAMEGRAPH{,_PATH}
) that seem to be just for debugging purposes. I can turn them into command-line args if that's desired.~/.spacetime
directory across the xdg base directories on unix-likes (so~/.config/spacetime
,~/.local/share/spacetime
, etc). On windows it's moved to%LocalAppData%/SpacetimeDB
config.toml
intocli.toml
and data-dirconfig.toml
, and implementeddata-dir/metadata.toml
.data-dir/wasmtime_cache
->data-dir/cache/wasmtime
0.log
(though a proper logrolling mechanism hasn't been implemented - that likely needs further work), database logs are indata-dir/logs
instead of/var/logs/spacetime
.data-dir/spacetime.pid
lockfile, so multiple processes can't use the same data-dir at the same time.cli-{bin-file,bin-dir,config-dir}
,data-dir
) are now bundled in theSpacetimePaths
type. server processes like standalone only interact with the data-dir.spacetime --root-dir
andspacetime --config-path
, to set a custom root directory for the spacetime installation and to specify a customcli.toml
, respectively. this was not in the proposal itself but something like this had to be implemented for our tests to still work.Changes that are not directly related to that, but facilitate it:
spacetimedb::auth::JwtKeys
type, which deduplicates jwt-key-file code across our server implementations. This is something I have less good motivation for, and I could try and revert if desired.Host::try_init
now takes&HostController
, instead of like 5 different args that were just fields onHostController
passed individually. I was adding a 6th arg and clippy was getting mad at me for having too many parameters.Engine
andLinker
are now stored in aWasmtimeRuntime
struct. Since we have to giveEngine
the{data-dir}/cache/wasmtime
path, it made more sense for that to just get eagerly initialized byHostController
, who has access to the data-dir path, instead of threadingdata_dir
all the way through towasmtime::make_actor
.relational_db::test_utils::TempReplicaDir
, which merges aTempDir
andspacetimedb_paths::server::ReplicaDir
.spacetimedb::startup::TracingOptions
got added - this is so we wouldn't read environment variables incore
anymore.