Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into jdetter/parallel-sm…
Browse files Browse the repository at this point in the history
…oketests
  • Loading branch information
Boppy committed Jul 10, 2023
2 parents d25e987 + 8386884 commit 8d5b3ef
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ Licensed Work: SpacetimeDB 0.5.0
The Licensed Work is
(c) 2023 Clockwork Laboratories, Inc.

Additional Use Grant: You may make use of the Licensed Work, provided that
you may not use the Licensed Work for a Database
Service.
Additional Use Grant: You may make use the Licensed Work provided your
application or service uses the Licensed Work with no
more than one server instance in production and
provided that you do not use the Licensed Work for a
Database Service.

A “Database Service” is a commercial offering that
allows third parties (other than your employees and
contractors) to access the functionality of the
Licensed Work by creating tables whose schemas are
controlled by such third parties.

Change Date: 2028-07-31
Change Date: 2028-08-03

Change License: Apache License, Version 2.0

For information about alternative licensing arrangements for the Software,
please visit: https://surrealdb.com
please visit: https://spacetimedb.com

Notice

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SpacetimeDB
Bringing smart-contracts and data-oriented design to relational database systems
Multiplayer at the speed of light.

<br>

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn get_command() -> Command {
│ 888 │
│ 888 │
│ 888 │
"Smart contracts without the blockchain"
"Multiplayer at the speed of light"
│ │
├───────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ SpacetimeDB Command Line Tool │
Expand Down
34 changes: 17 additions & 17 deletions crates/cli/src/subcommands/generate/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const ALLOW_UNUSED: &str = "#[allow(unused)]";

const SPACETIMEDB_IMPORTS: &[&str] = &[
ALLOW_UNUSED,
"use spacetimedb_client_sdk::{",
"use spacetimedb_sdk::{",
"\tglobal_connection::with_connection,",
"\tsats::{ser::Serialize, de::Deserialize},",
"\ttable::{TableType, TableIter, TableWithPrimaryKey},",
Expand Down Expand Up @@ -344,7 +344,7 @@ fn find_product_type(ctx: &GenCtx, ty: AlgebraicTypeRef) -> &ProductType {
}

/// Generate a file which defines a `struct` corresponding to the `table`'s `ProductType`,
/// and implements `spacetimedb_client_sdk::table::TableType` for it.
/// and implements `spacetimedb_sdk::table::TableType` for it.
pub fn autogen_rust_table(ctx: &GenCtx, table: &TableDef) -> String {
let mut output = CodeIndenter::new(String::new());
let out = &mut output;
Expand Down Expand Up @@ -536,7 +536,7 @@ fn print_table_filter_methods(
}

/// Generate a file which defines a struct corresponding to the `reducer`'s arguments,
/// implements `spacetimedb_client_sdk::table::Reducer` for it, and defines a helper
/// implements `spacetimedb_sdk::table::Reducer` for it, and defines a helper
/// function which invokes the reducer.
pub fn autogen_rust_reducer(ctx: &GenCtx, reducer: &ReducerDef) -> String {
let func_name = reducer.name.to_case(Case::Snake);
Expand Down Expand Up @@ -620,7 +620,7 @@ pub fn autogen_rust_reducer(ctx: &GenCtx, reducer: &ReducerDef) -> String {
///
/// 3. `fn handle_table_update`, which dispatches on table name to find the appropriate type
/// to parse the rows and insert or remove them into/from the
/// `spacetimedb_client_sdk::client_cache::ClientCache`. The other SDKs avoid needing
/// `spacetimedb_sdk::client_cache::ClientCache`. The other SDKs avoid needing
/// such a dispatch function by dynamically discovering the set of table types,
/// e.g. using C#'s `AppDomain`. Rust's type system prevents this.
///
Expand All @@ -635,7 +635,7 @@ pub fn autogen_rust_reducer(ctx: &GenCtx, reducer: &ReducerDef) -> String {
/// reducers.
///
/// 7. `fn connect`, which invokes
/// `spacetimedb_client_sdk::background_connection::BackgroundDbConnection::connect`
/// `spacetimedb_sdk::background_connection::BackgroundDbConnection::connect`
/// to connect to a remote database, and passes the `handle_row_update`
/// and `handle_event` functions so the `BackgroundDbConnection` can spawn workers
/// which use those functions to dispatch on the content of messages.
Expand Down Expand Up @@ -692,12 +692,12 @@ pub fn autogen_rust_globals(ctx: &GenCtx, items: &[GenItem]) -> Vec<(String, Str

/// Extra imports required by the `mod.rs` file, in addition to the [`SPACETIMEDB_IMPORTS`].
const DISPATCH_IMPORTS: &[&str] = &[
"use spacetimedb_client_sdk::client_api_messages::{TableUpdate, Event};",
"use spacetimedb_client_sdk::client_cache::{ClientCache, RowCallbackReminders};",
"use spacetimedb_client_sdk::background_connection::BackgroundDbConnection;",
"use spacetimedb_client_sdk::identity::Credentials;",
"use spacetimedb_client_sdk::callbacks::{DbCallbacks, ReducerCallbacks};",
"use spacetimedb_client_sdk::reducer::AnyReducerEvent;",
"use spacetimedb_sdk::client_api_messages::{TableUpdate, Event};",
"use spacetimedb_sdk::client_cache::{ClientCache, RowCallbackReminders};",
"use spacetimedb_sdk::background_connection::BackgroundDbConnection;",
"use spacetimedb_sdk::identity::Credentials;",
"use spacetimedb_sdk::callbacks::{DbCallbacks, ReducerCallbacks};",
"use spacetimedb_sdk::reducer::AnyReducerEvent;",
"use std::sync::Arc;",
];

Expand Down Expand Up @@ -772,7 +772,7 @@ fn print_handle_table_update_defn(ctx: &GenCtx, out: &mut Indenter, items: &[Gen
}
writeln!(
out,
"_ => spacetimedb_client_sdk::log::error!(\"TableRowOperation on unknown table {{:?}}\", table_name),",
"_ => spacetimedb_sdk::log::error!(\"TableRowOperation on unknown table {{:?}}\", table_name),",
).unwrap();
},
"}\n",
Expand Down Expand Up @@ -827,7 +827,7 @@ fn print_handle_resubscribe_defn(out: &mut Indenter, items: &[GenItem]) {
}
writeln!(
out,
"_ => spacetimedb_client_sdk::log::error!(\"TableRowOperation on unknown table {{:?}}\", table_name)," ,
"_ => spacetimedb_sdk::log::error!(\"TableRowOperation on unknown table {{:?}}\", table_name)," ,
).unwrap();
},
"}\n",
Expand All @@ -848,7 +848,7 @@ fn print_handle_event_defn(out: &mut Indenter, items: &[GenItem]) {
|out| {
out.delimited_block(
"let Some(function_call) = &event.function_call else {",
|out| writeln!(out, "spacetimedb_client_sdk::log::warn!(\"Received Event with None function_call\"); return None;")
|out| writeln!(out, "spacetimedb_sdk::log::warn!(\"Received Event with None function_call\"); return None;")
.unwrap(),
"};\n",
);
Expand All @@ -868,7 +868,7 @@ fn print_handle_event_defn(out: &mut Indenter, items: &[GenItem]) {
}
writeln!(
out,
"unknown => {{ spacetimedb_client_sdk::log::error!(\"Event on an unknown reducer: {{:?}}\", unknown); None }}",
"unknown => {{ spacetimedb_sdk::log::error!(\"Event on an unknown reducer: {{:?}}\", unknown); None }}",
).unwrap();
},
"}\n",
Expand Down Expand Up @@ -897,8 +897,8 @@ fn print_connect_defn(out: &mut Indenter) {
out.delimited_block(
"pub fn connect<Host>(host: Host, db_name: &str, credentials: Option<Credentials>) -> Result<()>
where
\tHost: TryInto<spacetimedb_client_sdk::http::Uri>,
\t<Host as TryInto<spacetimedb_client_sdk::http::Uri>>::Error: std::error::Error + Send + Sync + 'static,
\tHost: TryInto<spacetimedb_sdk::http::Uri>,
\t<Host as TryInto<spacetimedb_sdk::http::Uri>>::Error: std::error::Error + Send + Sync + 'static,
{",
|out| out.delimited_block(
"with_connection(|connection| {",
Expand Down
3 changes: 0 additions & 3 deletions crates/core/src/db/commit_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ impl CommitLog {

const COMMIT_SIZE: usize = 1;

let tx = datastore.begin_mut_tx();
if unwritten_commit.transactions.len() >= COMMIT_SIZE {
{
let mut guard = self.odb.lock().unwrap();
Expand All @@ -98,8 +97,6 @@ impl CommitLog {
unwritten_commit.min_tx_offset += unwritten_commit.transactions.len() as u64;
unwritten_commit.transactions.clear();

datastore.rollback_mut_tx(tx);

Some(bytes)
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spacetimedb-vm"
version = "0.1.0"
version = "0.5.0"
edition = "2021"
license-file = "LICENSE"
description = "A VM for SpacetimeDB"
Expand Down

0 comments on commit 8d5b3ef

Please sign in to comment.