Commit Graph

3186 Commits

Author SHA1 Message Date
John Detter 5a3501acd4 Print logs to stdout instead of stderr (#701)
Co-authored-by: John Detter <no-reply@boppygames.gg>
2024-01-08 22:21:50 +00:00
Ingvar Stepanyan b8e9b2dec9 Create output directory in generate if it doesn't exist (#705)
* Generate directory in `generate`

* Lint fixup
2024-01-08 18:57:54 +00:00
Ingvar Stepanyan 91d2619cec Inline typerefs (#696)
* Inline typerefs in the typespace early

* Inline type refs in columns

* Lint fix

* Add a comment
2024-01-08 18:17:50 +00:00
John Detter 3eb51f6f3f spacetime local clear subcommand (#702)
* spacetime local clear subcommand for deleting local database

* Addressing some feedback from pervious PR

* Addressing Zeke's feedback

* One more refactor based on Zeke's feedback

---------

Co-authored-by: John Detter <no-reply@boppygames.gg>
2024-01-05 22:53:17 +00:00
Noa 4aa7f35161 Update to axum 0.7 (#697) 2024-01-04 20:58:23 +00:00
Phoebe Goldman e26b141fa3 MutTxDatastore::table_name_from_id_mut_tx: return Cow<str> (#700)
* `MutTxDatastore::table_name_from_id_mut_tx`: return `Cow<str>`

This commit changes the `MutTxDatastore` trait's method `table_name_from_id_mut_tx` method
to return a `Cow<str>` rather than an `&str`,
abstracting away whether the underlying datastore stores a contiguous `str` table name.

As with PR #691, our current datastore has a `String` to which it can return an `&str`,
but the mem-arch-prototype stores a new representation
where strings are not necessarily contiguous,
so it must extract the table name and return an owned `String` rather than an `&str`.

* Rewrite a horrible memoizing branch into the entry API
2024-01-04 16:59:57 +00:00
John Detter e72ffcd28d Delete Files Flag for Generate Command (#693)
* Generate now has a clear flag which will clear the output directory
before generating files

* Some change - will explain in PR description.

* Only delete files which were generated by SpacetimeDB

* Slightly better pattern matching to reduce false negatives or positives

* Added force command for CI

* Fix for help section

* Update crates/cli/src/subcommands/generate/mod.rs

Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>

* Update crates/cli/src/subcommands/generate/mod.rs

Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>

---------

Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: John Detter <no-reply@boppygames.gg>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
2023-12-22 17:19:34 +00:00
Phoebe Goldman 63cbdb03e3 Datastore: Cow<'tx, ProductValue> rather than &'tx ProductValue. (#691)
Our current datastore stores `ProductValue`s,
and thus can return references to them,
but the prototype new mem-arch stores a new flattened representation,
and so cannot return `&'tx ProductValue`.

In preparation for the new storage format,
this commit changes the datastore traits to return `Cow<'tx, ProductValue>`,
so that the new implementation will be able to perform conversion
and return `Cow::Owned(ProductValue::from(internal_repr))`.
2023-12-21 15:27:22 +00:00
John Detter d54c31a47c Upgraded version to 0.8.0 (#66)
Co-authored-by: John Detter <no-reply@boppygames.gg>
2023-12-21 09:17:38 -06:00
John Detter f3159602b2 Workflow for Publishing Nuget Package (#64)
* Committing script for building nuget package

* Script replaced with github action workflow

* On pull requests as well

* Bump version

* Updated build config

* Ready to test

---------

Co-authored-by: John Detter <no-reply@boppygames.gg>
2023-12-21 09:16:32 -06:00
John Detter 9c744a3d26 v0.7.2-beta Changes (#62)
* Changes merged in from v0.7.1-beta

* Small bug fix from stream

* Updated logo file

* Small bug fix related to OnBeforeDelete callback

* Upgraded version to 0.7.2

---------

Co-authored-by: John Detter <no-reply@boppygames.gg>
2023-12-21 06:08:41 -06:00
John Detter a9527c95cc Added testnet to list of default configs (#690)
Co-authored-by: John Detter <no-reply@boppygames.gg>
2023-12-21 11:33:01 +00:00
John Detter cdde960b86 Print Remote Server During Publish (#689)
* Print the server that we're uploading to when we're publishing

* Minor text tweak

---------

Co-authored-by: John Detter <no-reply@boppygames.gg>
2023-12-21 11:24:14 +00:00
Kim Altintop 9bb2b21507 core: Remove index update when updating a database (#686)
The `TableDef` type is nominally the same for the database schema and
the schema description from a module, but only the former contains
information about indexes and sequences. This would cause all indexes to
be dropped when updating a database, because none of the existing
indexes would ever be present in the module's schema definition.

It is unclear if the functionality could be recovered, but it does not
seem to be robust without a dedicated schema manipulation language
either way.

We still want to allow module updates which do not change the schema at
all, or only introduce new tables, as otherwise users may be forced to
re-run expensive initialisation steps even though they only introduced
debugging code or somesuch.

To make this work, a somewhat dubious equivalence comparison is made,
comparing the constraint definitions in a way deemed correct in post-hoc
analysis.
2023-12-21 08:13:02 +00:00
Kim Altintop 0023ddd75f core: Initialize the database context only once (#664)
Access to the DatabaseInstanceContextController is racy, as another
`get` may occur while a new DatabaseInstanceContext is initializing.
Because the database acquires filesystem locks, this will lead to
errors.

To fix this, the context value is wrapped in a OnceCell.
2023-12-20 18:37:08 +00:00
Mazdak Farrokhzad aa4b7e56cf move build_error_unique to locking_tx_datastore/mod.rs (#687) 2023-12-19 18:49:07 +00:00
Piotr Sarnacki 8ef99bf8a0 Typescript SDK 0.8 changes (#21)
* Empty push to trigger a webhook

* Update TypeScript docs to 0.8
2023-12-18 20:07:19 +01:00
Tyler Cloutier e5b129eec1 Revert "Revert "Reorganized the doc paths to match slugs and removed _category.json files"" (#23)
This reverts commit 9f9bf57947.
2023-12-15 23:19:22 -08:00
Shubham Mishra 9a4ff2ca13 Use associate type for tx (#678)
* made MutTxId -> MutTx

* adopt using ass. type for tx

* fmt
2023-12-16 06:01:45 +00:00
Tyler Cloutier afd8fc216f Merge pull request #13 from clockworklabs/ingvar/net-8
Ask users to install .NET 8
2023-12-15 20:56:46 -08:00
Tyler Cloutier f3df3a4259 Update index.md 2023-12-15 16:24:16 -08:00
Tyler Cloutier 120a48bd1d Merge pull request #22 from clockworklabs/cloutiertyler-patch-3
Update index.md
2023-12-15 16:22:51 -08:00
Tyler Cloutier 95a2224d2d Update index.md 2023-12-15 16:22:38 -08:00
Piotr Sarnacki bd32a4ee37 Bump version to 0.8.1 2023-12-15 18:49:47 +01:00
Piotr Sarnacki 0297abe3ae Fix type returned by DatabaseTable.with method (#30) 2023-12-15 18:42:14 +01:00
joshua-spacetime 69f819ad4c perf(623): Use row counts in query optimization (#677)
Closes #623.

Before this patch query optimization was entirely syntax driven.
Now that we keep table size metrics we can be somewhat data driven.

This patch improves index joins,
by using row counts to determine the index side and the probe side.
2023-12-15 16:45:00 +00:00
joshua-spacetime 5895388a37 test(compiler): From index to inner join (#676)
This patch removes the invalid translation from IndexJoin to JoinExpr,
since there is no way to capture the implicit projection of IndexJoin.
Instead we translate from IndexJoin directly to QueryExpr.
2023-12-15 15:32:58 +00:00
joshua-spacetime acedf52cfe test(compiler): Optimizing index join with virtual probe table is no-op (#675)
If an index join has a delta table on its probe side,
the plan is already optimal,
so do not reorder the index and probe sides of the join.
2023-12-15 15:32:14 +00:00
joshua-spacetime d30bec1616 refactor(compiler): Swap the index and probe sides of an index join (#674)
Before this change we would swap the index and probe sides if

(1) the index side was replaced with a delta table,
(2) the probe side had an index defined on the join field, and
(3) the index side was the return side.

After this change we swap if

(1) the index side has been replaced with a delta table, and
(2) the probe side has an index defined on the join field.

We no longer place restrictions on the rows that are returned.
2023-12-14 18:00:37 +00:00
Kim Altintop 31b20c16eb test: Build modules in release mode (#672)
Debug now creates wasm artifacts which are bigger than what we can
support currently.
2023-12-14 11:13:03 +00:00
joshua-spacetime 501b6e29ab refactor(subscriptions): Support returning either side of a join (#639)
* refactor(subscriptions): Support returning either side of a join

Before this patch we made reference to the "lhs" and the "rhs" of an index join,
in the context of incremental evaluation.
This patch further generalizes the incremental evaluation of index joins,
by replacing such references with either the probe side or the index side.
This is in preparation for adding more types of incremental evaluation plans.

* test: Move incremental eval compilation tests to subscription module
2023-12-13 19:28:33 +00:00
Tyler Cloutier 365b4b355e Fix typo in license
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2023-12-12 14:30:40 -08:00
Noa 98e995304e Fix master commit benchmarks run (#658) 2023-12-12 18:54:14 +00:00
Kim Altintop cb0d2c8274 core: Remove unwraps from DatabaseInstanceContext (#663)
Instantiation of a database is inherently fallible, so should take down
the whole process.
2023-12-12 17:16:37 +00:00
Ingvar Stepanyan 7143f25163 Fixes for SpacetimeDB.Runtime package (#654)
As usual, NuGet / MSBuild behaving differently for local projects vs published ones causes build issues that are not revealed by testing...

This is published to NuGet now and verified to work on an empty project.

Also changed the way `SpacetimeDB.Runtime.{props,targets}` are referenced locally by test projects by moving them to `Directory.Build.{props,targets}` at the top level of `modules/` directory. This should simulate behaviour of published NuGet packages a bit more closely - in particular, I verified that it can reproduce the bug in question before the fix, while the previous `<Import />` approach succeeded regardless - and also makes it easier to share the same configs between multiple projects.
2023-12-12 14:42:06 +00:00
joshua-spacetime 31cf742530 chore: Temporarily disable failing smoke tests (#656) 2023-12-11 22:27:46 +00:00
Noa 3052f3f406 Try fix mergegroup ci 2023-12-11 16:27:20 -06:00
Noa 00f42e9ecb Try fix mergegroup ci 2023-12-11 16:12:47 -06:00
Noa 534f89c8c2 Enable CI on merge group (#655) 2023-12-11 21:56:57 +00:00
Piotr Sarnacki 329174ac5b Add changelog 2023-12-11 12:16:55 +01:00
Piotr Sarnacki 16f4d9c9bf Bump version to 0.8.0 2023-12-11 11:48:14 +01:00
Piotr Sarnacki 8f83692fe5 Changes required for SpacetimeDB 0.8 + improvements (#29) 2023-12-11 11:44:09 +01:00
Piotr Sarnacki 3061cee0af Improve TypeScript generated code (fixes and improvements) (#603)
* Export enum options as objects/functions

Thanks to that devs could now use it more intuitively, similarly to
Rust, for example:

    let role = Role.Admin; // it returns { tag: "Admin", value: undefined };
    let role1 = Role.Custom("Foo") // returns { tag: "Custom", value: "Foo" };

* 64 bit ints need to be represented as BigInt, not number

In JS all numbers are 64bit floats, but that means integers are only up
to 53 bits. Thus any 64+ bits integers need to be handled as BigInts

* Use camel case for product names

* Don't automatically register reducers and components

* Improve reducers and components

* Use this.db for tables

* Fix u64 and i64 to be a BigInt

* Table proxy changes

* Clippy

* Remove some of the reducer/table methods from autogen

Some of the methods were moved to the parent classes

* Remove _tableProxy import

* Remove count() and all() from typescript generation

---------

Signed-off-by: Piotr Sarnacki <drogus@gmail.com>
v0.8.0-beta
2023-12-08 21:15:29 -06:00
Piotr Sarnacki 45ce5b4353 Merge docker images from multiple platforms (#640)
Because we build our docker images in more than one job, they are also
pushed as separate images. This commit adds a script that will merge the
images into a multiplatform manifest
2023-12-08 21:06:35 -06:00
Tyler Cloutier 0cd632b830 cargo fmt 2023-12-08 19:02:36 -08:00
Tyler Cloutier f3ed8bf3f5 Removed errant print 2023-12-08 18:57:39 -08:00
Tyler Cloutier a98c989cf8 This fixes an issue where we were using __ to validate index names erroneously 2023-12-08 18:52:56 -08:00
Noa f8296c0281 Add timestamp to module logs (#641)
* Add timestamp to module logs

* Update tests
2023-12-09 00:01:55 +00:00
Mario Montoya 6d7c513ef0 Fixes for performance drop related to missing index selection (#647)
* Fix test bootstrap

Merge

Merge

* Fix test & refactor FieldDef

* Added test to check schema validations
2023-12-08 23:49:43 +00:00
Mario Montoya 683a8030e7 Cache the 'row_type' on TableSchema so is not re-build in each access (#638) 2023-12-08 15:06:30 -08:00