You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guide/src/start.md
+52Lines changed: 52 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,58 @@ while let Some(entry) = scan.next().await.transpose().unwrap() {
138
138
}
139
139
```
140
140
141
+
### Persistence
142
+
As Tonbo uses LSM(Log-Structured-Merge Tree) as the underlying data structure, some data are in the memory(mem). If you want to persist these data, you can use the `flush` method.
143
+
144
+
If WAL is enabled, the data will be persisted to disk automatically. But as tonbo has buffer for WAL by default, you need to call `flush_wal` method if you want to ensure that all the data will be recovered. If you don not want to use buffer for WAL, you can disable it by setting `wal_buffer_size` to 0.
> **Note**: If you disable WAL, there is nothing to do with `flush_wal`. You need to call `flush` method to persist the memory data.
162
+
>
163
+
> If you enable WAL and set `wal_buffer_size` to 0, you do not need to call `flush_wal` method, since WAL will be flushed to disk before writing.
164
+
165
+
### Using in S3
166
+
167
+
If you want to use Tonbo in S3, you can configure `DbOption` to specify which part of the data to store in S3 and which part to store in local disk. Here is an example:
Copy file name to clipboardExpand all lines: guide/src/usage/tonbo.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -183,7 +183,7 @@ Transactions support easily reading the state of keys that are currently batched
183
183
184
184
You can use `get` method to get a record by key, and `get` method will return a `UserRef` instance. This `UserRef` instance is a struct that tonbo generates for you in the compile time. All fields except primary key are `Option` type, because you may not have set them when you create the record. You can also pass a `Projection` to specify which fields you want to get. `Projection::All` will get all fields, `Projection::Parts(Vec<&str>)` will get only primary key, `email` and `bytes` fields(other fields will be `None`).
185
185
186
-
You can use `scan` method to scan all records that in the specified range. `scan` method will return a `Scan` instance. You can use `taken` method to get a `Stream` instance and iterate all records that satisfied. Tonbo also supports pushing down filters and projections. You can use `Scan::projection(vec!["id", "email"])` to specify which fields you want to get and use `Scan::limit(10)` to limit the number of records you want to get.
186
+
You can use `scan` method to scan all records that in the specified range. `scan` method will return a `Scan` instance. You can use `take` method to get a `Stream` instance and iterate all records that satisfied. Tonbo also supports pushing down filters and projections. You can use `Scan::projection(vec!["id", "email"])` to specify which fields you want to get and use `Scan::limit(10)` to limit the number of records you want to get.
0 commit comments