This allows to make and test ABI-breaking changes much more easily than before.
For now moved them under crates/bindings-csharp - on one hand, it's not a crate, but on another it's the most logical place within our current project structure if we think of `crates` folder as general `projects` folder.
* Initial draft for multi-column indexes
* Fix index seek for multi-columns
* Restore use of ColId
* Fix compilation
* Merge
* Addressing some PR comments
* Clippy
* Clarify usage of AlgebraicValue for indexes
* .
Prior to this commit, accesses to the global most-recent client cache state in the Rust SDK
acquired the global mutex on CONNECTION.
This lead to a deadlock during bootstrapping in cloud-next.
With this commit, it is now possible to access the global most-recent client cache state
without acquiring the CONNECTION mutex.
We've had recurring issues with `println` calls sneaking in
where `log` crate macros would be more appropriate.
This commit adds a Clippy warning for uses of the global I/O macros,
i.e. `print`, `println`, `eprint`, `eprintln` and `dbg`.
The lint is disabled by a more-specific `clippy.toml` in the `cli` and `sqltest` crates,
as well as using `allow` attributes in `standalone`'s `subscommands` module.
Additionally, this commit converts a handful of prints in `core/utils` to `log::info`.
* Client API changes to accomodate new cloud architecture
The exact trait interfaces for `client-api` is TBD
* Ensure we're not blocking when accessing the filesystem
* Derive Clone for SendGridController
* Add YOLO error variant to InsertDomainResult
* Rebase
* fixup! Rebase
* Fix SpacetimeType for Address
* Temporarily disable message / frame size limits for SDK WS
* Remove get_database_instance_state from API trait
It's an internal (worker db) thing, which does not need to be satisfied
by impls.
* Update indexes when updating a database
It turns out that the order of the index definitions in the proposed
schema may differ from those returned from the catalog, causing valid
(i.e. no-op) updates to be rejected. While at it, allow updating table
indexes so as long as the (column) schema remains unchanged.
* Update indexes when updating a database
It turns out that the order of the index definitions in the proposed
schema may differ from those returned from the catalog, causing valid
(i.e. no-op) updates to be rejected. While at it, allow updating table
indexes so as long as the (column) schema remains unchanged.
* Fix -S instead of -s for update-module smoke test
-s now means "server", -S "skip clippy", changed in:
a1e9984 (Multiple server configurations for CLI (#214), 2023-09-01)
* Invalidate schema cache when committing a tx
* Use long options in update-module.sh, fix unused warning
* Add test asserting schema_for_table reflects index updates
This switches tests from invoking a spacetimedb CLI found on PATH to always using up-to-date version by depending on the CLI crate as a library.
---------
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
* Update indexes when updating a database
It turns out that the order of the index definitions in the proposed
schema may differ from those returned from the catalog, causing valid
(i.e. no-op) updates to be rejected. While at it, allow updating table
indexes so as long as the (column) schema remains unchanged.
* Invalidate schema cache when committing a tx
* Use long options in update-module.sh, fix unused warning
* Add test asserting schema_for_table reflects index updates
Fixes#259
(1) Updates MemTable to use RelValue instead of ProductValue
(2) Adds a DataKey member to DataRef and RelValue
(3) Subscriptions compute DataKey only when not present on row
* Make database init / update transactional
That is, run both schema modifications as well as init/update reducers
in the same transaction.
* Add commentary
* Simple SDK test harness; SDK test module
Yet to come: actual SDK tests.
* Quiet clippy lint about "too many arguments"
* Lints are named with underscores, not dashes...
* Will this make clippy shut up?
* Go nuclear on disabling `too_many_attributes` lint. Sigh.
* WIP SDK test client, and fix bugs in Rust codegen
Compiling the module_bindings for the sdk-test module revealed two bugs:
- Enums holding structs generated incorrectly,
unpacking the struct into the enum's payload.
- Recursive types would cause the codegen to attempt to recursively import
the current module into itself.
* One (1) actual runnable test in the sdk crate
* Exclude test-client from CI
The sdk tests already build this crate (though they don't clippy or fmt it).
Attempting to build, test, fmt or clippy it as-is will fail
because the module_bindings are not committed.
This is intentional, as the SDK test suite wants to generate the module_bindings
during its run.
* Rustfmt ignore generated module_bindings
It turns out `cargo fmt` doesn't actually support the `--exclude` option
the way `cargo clippy` does.
Instead, just `#[rustfmt::skip]` the `mod module_bindings;` decl.
* Actually commit test file...
God, I'm so bad at remembering to commit new files.
Anyway, add a test for deleting rows with primitive unique fields.
* Make CLI tool available in tests workflow
The SDK tests need to run `spacetime start`, `spacetime generate` and `spacetime publish`.
* Test update events with primitive pk types; split test-client into files
* Tests with `Identity` fields in tables
* Tests for reducer callbacks, both successful and failing
* Tests with vecs of stuff, with structs, with enums
* Test that should fail, test that uses a large table with many columns
* Test for resubscribe functionality
* Test of reauth; fix major bug in `TestCounter`
I misread `Condvar::wait_timeout_while` as `Condvar::wait_timeout_until`,
and flipped my predicate.
This led to false negatives (i.e. tests that passed that shouldn't have).
* A fistful of doc comments
* Avoid race condition running multiple tests with same client project
This commit fixes a race condition which sometimes caused the SDK tests to fail
because multiple `spacetime generate` processes running concurrently
would clobber each others' output,
potentially deleting it while a `cargo build` or `cargo run` process was running.
Now, the test harness will only run `spacetime generate` at most once
for any given directory.
* Add env_logger to SDK test client
* RUST_LOG=trace when running test clients
* quieter logs in test client: only warn-level and higher
Fixes#259
(1) Updates MemTable to use RelValue instead of ProductValue
(2) Adds a DataKey member to DataRef and RelValue
(3) Subscriptions compute DataKey only when not present on row
* Remove unused datastore traits
We previously anticipated factoring the database in such a way that
the typed vs untyped distinctions, and the transactional vs not,
semantics would be more visible. We have not used these distinctions
and no longer need to expose these traits.
* Fix recovery of sequences after restart
---------
Co-authored-by: George Kulakowski <george@clockworklabs.io>
Alters the CLI's configuration format to support storing multiple server configurations,
and having each server configuration store an (optional) default identity.
Many CLI commands take an additional -s argument, the server on which to operate,
which defaults to the configured default_server.
Using -s consistently requires renaming the publish skip-clippy short flag to -S.
Per discussion with @jdetter , this PR does not directly associate identities with servers.
Instead, each server configuration stores the server's "fingerprint" (i.e. PEM-formatted ECDSA public key),
and the CLI uses that public key to decode tokens to determine if they apply to a given server.
This architecture allows the CLI to behave reasonably
when multiple server configurations use the same set of tokens,
e.g. if multiple distinct URLs resolve to the same SpacetimeDB instance.
For example, one could imagine a configuration with server configurations for both http://127.0.0.1:3000
and http://localhost:3000, which should use the same set of identities.
This commit adds a new endpoint to the `/identity` block,
which returns the public key STDB uses to decode JWTs.
This will allow clients, incl. the CLI and SDKs,
to verify multiple identity/token pairs without spamming STDB with requests.
The public key can also be used as a "fingerprint", to identify the server.
This will allow clients to determine:
- When multiple URIs or addresses refer to the same STDB instance.
- When a STDB instance has rotated its keys, so past identities become invalid.
* we need wasmer 4.1.1 or newer
* Add a newly required dependency on wasmer-types
* from_trap -> from::<Trap>
* Finish upgrading to wasmer 4
* Bump to Rust 1.72.0
---------
Co-authored-by: Noa <coolreader18@gmail.com>
As we're adding more variants, it's getting harder to keep track of the "A implies B" relationships between enum variants and to correctly do checks like "is this column autoinc" in different places.
Using bitflags makes expressing those relationships more natural and checking simpler - e.g. you can just do `contains(AUTO_INC)` as a single bit operation instead of having to remember and list all possible variants that imply autoinc, especially if we're going to add more flags in the future.
Initially I was going to make this change just in C# module generator and convert between ABI enum and bitflags over there, but it seems better to do this at ABI level so it simplifies Rust handling as well.
This commit adds the usual 3 callback-ey functions for on-disconnect events,
which fire when a connection closes.
These fire either when the connection is closed by the client,
or by the server.
- `on_disconnect` to register.
- `once_on_disconnect` to register one-shots.
- `remove_on_disconnect` to un-register.
Prior to this commit, the `logs` subcommand would print an unhelpfully generic HTTP error
on failure. Notably, this error did not include the actual response body.
With this commit, the error includes the HTTP response body.
For example, trying to print logs for a server you don't own shows:
Error: Identity does not own database, expected: 69c07c49846bcf11d7b7cb411018ded585a5a6d9045f8a1a39fa638e9db48436 got: 915cff645f94f52467c43734d54a26d565abb69c7506e30127dd616ca4790414