Skip to content

Commit 9489764

Browse files
authored
chore: Remove jar mentions from book (#775)
* Remove references to jar terminology * Update or remove invalid code links in book
1 parent 2d4321e commit 9489764

File tree

13 files changed

+10
-336
lines changed

13 files changed

+10
-336
lines changed

book/src/SUMMARY.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- [Overview](./overview.md)
88
- [Tutorial: calc language](./tutorial.md)
99
- [Basic structure](./tutorial/structure.md)
10-
- [Jars and databases](./tutorial/jar.md)
1110
- [Defining the database struct](./tutorial/db.md)
1211
- [Defining the IR: the various "salsa structs"](./tutorial/ir.md)
1312
- [Defining the parser: memoized functions and inputs](./tutorial/parser.md)
@@ -28,7 +27,6 @@
2827
- [How Salsa works](./how_salsa_works.md)
2928
- [Videos](./videos.md)
3029
- [Plumbing](./plumbing.md)
31-
- [Jars and ingredients](./plumbing/jars_and_ingredients.md)
3230
- [Databases and runtime](./plumbing/database_and_runtime.md)
3331
- [The db lifetime on tracked/interned structs](./plumbing/db_lifetime.md)
3432
- [Tracked structures](./plumbing/tracked_structs.md)

book/src/plumbing.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ We refer to this as the "plumbing".
77

88
The plumbing section is broken up into chapters:
99

10-
- The [jars and ingredients](./plumbing/jars_and_ingredients.md) covers how each salsa item (like a tracked function) specifies what data it needs and runtime, and how links between items work.
1110
- The [database and runtime](./plumbing/database_and_runtime.md) covers the data structures that are used at runtime to coordinate workers, trigger cancellation, track which functions are active and what dependencies they have accrued, and so forth.
1211
- The [query operations](./plumbing/query_ops.md) chapter describes how the major operations on function ingredients work. This text was written for an older version of salsa but the logic is the same:
1312
- The [maybe changed after](./plumbing/maybe_changed_after.md) operation determines when a memoized value for a tracked function is out of date.

book/src/plumbing/database_and_runtime.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A salsa database struct is declared by the user with the `#[salsa::db]` annotati
44
It contains all the data that the program needs to execute:
55

66
```rust,ignore
7-
#[salsa::db(jar0...jarn)]
7+
#[salsa::db]
88
struct MyDatabase {
99
storage: Storage<Self>,
1010
maybe_other_fields: u32,
@@ -28,12 +28,12 @@ The `Snapshot` method returns a `Snapshot<DB>` type, which prevents these clones
2828
The salsa `Storage` struct contains all the data that salsa itself will use and work with.
2929
There are three key bits of data:
3030

31-
- The `Shared` struct, which contains the data stored across all snapshots. This is primarily the ingredients described in the [jars and ingredients chapter](./jars_and_ingredients.md), but it also contains some synchronization information (a cond var). This is used for cancellation, as described below.
31+
- The `Shared` struct, which contains the data stored across all snapshots, such as synchronization information (a cond var). This is used for cancellation, as described below.
3232
- The data in the `Shared` struct is only shared across threads when other threads are active. Some operations, like mutating an input, require an `&mut` handle to the `Shared` struct. This is obtained by using the `Arc::get_mut` methods; obviously this is only possible when all snapshots and threads have ceased executing, since there must be a single handle to the `Arc`.
33-
- The `Routes` struct, which contains the information to find any particular ingredient -- this is also shared across all handles, and its construction is also described in the [jars and ingredients chapter](./jars_and_ingredients.md). The routes are separated out from the `Shared` struct because they are truly immutable at all times, and we want to be able to hold a handle to them while getting `&mut` access to the `Shared` struct.
33+
- The `Routes` struct, which contains the information to find any particular ingredient -- this is also shared across all handles. The routes are separated out from the `Shared` struct because they are truly immutable at all times, and we want to be able to hold a handle to them while getting `&mut` access to the `Shared` struct.
3434
- The `Runtime` struct, which is specific to a particular database instance. It contains the data for a single active thread, along with some links to shared data of its own.
3535

36-
## Incrementing the revision counter and getting mutable access to the jars
36+
## Incrementing the revision counter
3737

3838
Salsa's general model is that there is a single "master" copy of the database and, potentially, multiple snapshots.
3939
The snapshots are not directly owned, they are instead enclosed in a `Snapshot<DB>` type that permits only `&`-deref,
@@ -47,12 +47,6 @@ This allows us to get `&mut` access without any unsafe code and
4747
guarantees that we have successfully managed to cancel the other worker threads
4848
(or gotten ourselves into a deadlock).
4949

50-
The code to acquire `&mut` access to the database is the `jars_mut` method:
51-
52-
```rust
53-
{{#include ../../../src/storage.rs:jars_mut}}
54-
```
55-
5650
The key initial point is that it invokes `cancel_other_workers` before proceeding:
5751

5852
```rust

book/src/plumbing/fetch.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Fetch
22

3-
```rust,no_run,noplayground
4-
{{#include ../../../src/plumbing.rs:fetch}}
5-
```
6-
73
The `fetch` operation computes the value of a query. It prefers to reuse memoized values when it can.
84

95
## Input queries

book/src/plumbing/jars_and_ingredients.md

Lines changed: 0 additions & 208 deletions
This file was deleted.

book/src/plumbing/maybe_changed_after.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Maybe changed after
22

3-
```rust,no_run,noplayground
4-
{{#include ../../../src/plumbing.rs:maybe_changed_after}}
5-
```
6-
73
The `maybe_changed_after` operation computes whether a query's value *may have changed* **after** the given revision. In other words, `Q.maybe_change_since(R)` is true if the value of the query `Q` may have changed in the revisions `(R+1)..R_now`, where `R_now` is the current revision. Note that it doesn't make sense to ask `maybe_changed_after(R_now)`.
84

95
## Input queries

book/src/plumbing/query_ops.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# Query operations
22

3-
Each of the query storage struct implements the `QueryStorageOps` trait found in the [`plumbing`] module:
4-
5-
```rust,no_run,noplayground
6-
{{#include ../../../src/plumbing.rs:QueryStorageOps}}
7-
```
8-
9-
which defines the basic operations that all queries support. The most important are these two:
3+
The most important basic operations that all queries support are:
104

115
* [maybe changed after](./maybe_changed_after.md): Returns true if the value of the query (for the given key) may have changed since the given revision.
126
* [Fetch](./fetch.md): Returns the up-to-date value for the given K (or an error in the case of an "unrecovered" cycle).
13-
14-
[`plumbing`]: https://github.com/salsa-rs/salsa/blob/master/src/plumbing.rs
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Ingredient
22

3-
An *ingredient* is an individual piece of storage used to create a [salsa item](./salsa_item.md)
4-
See the [jars and ingredients](../jars_and_ingredients.md) chapter for more details.
3+
An *ingredient* is an individual piece of storage used to create a [salsa item](./salsa_item.md)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# Salsa item
22

3-
A salsa item is something that is decorated with a `#[salsa::foo]` macro, like a tracked function or struct.
4-
See the [jars and ingredients](../jars_and_ingredients.md) chapter for more details.
3+
A salsa item is something that is decorated with a `#[salsa::foo]` macro, like a tracked function or struct.

book/src/tutorial/db.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Defining the database struct
22

3-
Now that we have defined a [jar](./jar.md), we need to create the **database struct**.
4-
The database struct is where all the jars come together.
3+
First, we need to create the **database struct**.
54
Typically it is only used by the "driver" of your application;
65
the one which starts up the program, supplies the inputs, and relays the outputs.
76

@@ -13,11 +12,8 @@ In `calc`, the database struct is in the [`db`] module, and it looks like this:
1312
{{#include ../../../examples/calc/db.rs:db_struct}}
1413
```
1514

16-
The `#[salsa::db(...)]` attribute takes a list of all the jars to include.
17-
The struct must have a field named `storage` whose type is `salsa::Storage<Self>`, but it can also contain whatever other fields you want.
18-
The `storage` struct owns all the data for the jars listed in the `db` attribute.
19-
20-
The `salsa::db` attribute autogenerates a bunch of impls for things like the `salsa::HasJar<crate::Jar>` trait that we saw earlier.
15+
The `#[salsa::db]` attribute marks the struct as a database.
16+
It must have a field named `storage` whose type is `salsa::Storage<Self>`, but it can also contain whatever other fields you want.
2117

2218
## Implementing the `salsa::Database` trait
2319

@@ -34,11 +30,3 @@ If you want to permit accessing your database from multiple threads at once, the
3430
```rust
3531
{{#include ../../../examples/calc/db.rs:par_db_impl}}
3632
```
37-
38-
## Implementing the traits for each jar
39-
40-
The `Database` struct also needs to implement the [database traits for each jar](./jar.md#database-trait-for-the-jar).
41-
In our case, though, we already wrote that impl as a [blanket impl alongside the jar itself](./jar.md#implementing-the-database-trait-for-the-jar),
42-
so no action is needed.
43-
This is the recommended strategy unless your trait has custom members that depend on fields of the `Database` itself
44-
(for example, sometimes the `Database` holds some kind of custom resource that you want to give access to).

book/src/tutorial/ir.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ All Salsa structs store the actual values of their fields in the Salsa database.
1717
This permits us to track when the values of those fields change to figure out what work will need to be re-executed.
1818

1919
When you annotate a struct with one of the above Salsa attributes, Salsa actually generates a bunch of code to link that struct into the database.
20-
This code must be connected to some [jar](./jar.md).
21-
By default, this is `crate::Jar`, but you can specify a different jar with the `jar=` attribute (e.g., `#[salsa::input(jar = MyJar)]`).
22-
You must also list the struct in the jar definition itself, or you will get errors.
2320

2421
## Input structs
2522

0 commit comments

Comments
 (0)