From 206af35e2b9474611f41fc25f3af447864688c49 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 1 Nov 2018 05:55:42 -0400 Subject: [PATCH 1/2] release 0.8.0 - major refactoring to the database APIs for safer parallel processing (#78, #82): - To set an input, you now write `db.query_mut(Query).set(...)`, and you must declare your database as `mut`. - To fork a thread, you now write `db.snapshot()`, which acquires a read-lock that is only released when the snapshot is dropped (note that this read-lock blocks `set` from occuring on the main thread). - Therefore, there can only be one mutable handle to the database; all other handles are snapshots. This eliminates a variety of complex and error-prone usage patterns. - introduced the `salsa_event` callback that can be used for logging and introspection (#63) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9ecfa41e..fc13d454 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "salsa" -version = "0.7.0" +version = "0.8.0" authors = ["Niko Matsakis "] edition = "2018" license = "Apache-2.0 OR MIT" From 4a8b9123e6440d37a1d3ea1526b1e7429088cf34 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 1 Nov 2018 05:59:33 -0400 Subject: [PATCH 2/2] update hello-world --- examples/hello_world/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/hello_world/README.md b/examples/hello_world/README.md index 506182cf..5c07a29a 100644 --- a/examples/hello_world/README.md +++ b/examples/hello_world/README.md @@ -163,11 +163,11 @@ start using it: ```rust fn main() { - let db = DatabaseStruct::default(); + let mut db = DatabaseStruct::default(); println!("Initially, the length is {}.", db.length().get(())); - db.query(InputString) + db.query_mut(InputString) .set((), Arc::new(format!("Hello, world"))); println!("Now, the length is {}.", db.length().get(())); @@ -177,16 +177,16 @@ fn main() { One thing to notice here is how we set the value for an input query: ```rust - db.query(InputString) + db.query_mut(InputString) .set((), Arc::new(format!("Hello, world"))); ``` -The `db.query(Foo)` method takes as argument the query type that -characterizes your query. It gives back a "query table" type, which -offers you more advanced methods beyond simply executing the query -(for example, for input queries, you can invoke `set`). In fact, the -standard call `db.query_name(key)` to access a query is just a -shorthand for `db.query(QueryType).get(key)`. +The `db.query_mut(Foo)` method takes as argument the query type that +characterizes your query. It gives back a "mutable query table" type, +which lets you invoke `set` to set the value of an input query. There +is also a `query` method that gives access to other advanced methods +in fact, the standard call `db.query_name(key)` to access a query is +just a shorthand for `db.query(QueryType).get(key)`. Finally, if we run this code: