@@ -13,34 +13,34 @@ Install FoundationDB on your system, see [FoundationDB Local Development](https:
13
13
- Ubuntu Linux (this may work on the Linux subsystem for Windows as well)
14
14
15
15
``` console
16
- $> curl -O https://www.foundationdb.org/downloads/6.1.12 /ubuntu/installers/foundationdb-clients_6.1.12 -1_amd64.deb
17
- $> curl -O https://www.foundationdb.org/downloads/6.1.12 /ubuntu/installers/foundationdb-server_6.1.12 -1_amd64.deb
18
- $> sudo dpkg -i foundationdb-clients_6.1.12 -1_amd64.deb
19
- $> sudo dpkg -i foundationdb-server_6.1.12 -1_amd64.deb
16
+ $> curl -O https://www.foundationdb.org/downloads/6.2.15 /ubuntu/installers/foundationdb-clients_6.2.25 -1_amd64.deb
17
+ $> curl -O https://www.foundationdb.org/downloads/6.2.15 /ubuntu/installers/foundationdb-server_6.2.25 -1_amd64.deb
18
+ $> sudo dpkg -i foundationdb-clients_6.2.25 -1_amd64.deb
19
+ $> sudo dpkg -i foundationdb-server_6.2.25 -1_amd64.deb
20
20
```
21
21
22
22
- macOS
23
23
24
24
``` console
25
- $> curl -O https://www.foundationdb.org/downloads/6.1.12 /macOS/installers/FoundationDB-6.1.12 .pkg
26
- $> sudo installer -pkg FoundationDB-6.1.12 .pkg -target /
25
+ $> curl -O https://www.foundationdb.org/downloads/6.2.25 /macOS/installers/FoundationDB-6.2.25 .pkg
26
+ $> sudo installer -pkg FoundationDB-6.2.25 .pkg -target /
27
27
```
28
28
29
29
- Windows
30
30
31
- https://www.foundationdb.org/downloads/6.1.12 /windows/installers/foundationdb-6.1.12 -x64.msi
31
+ https://www.foundationdb.org/downloads/6.2.25 /windows/installers/foundationdb-6.2.25 -x64.msi
32
32
33
33
## Add dependencies on foundationdb-rs
34
34
35
35
``` toml
36
36
[dependencies ]
37
- foundationdb = " 0.4.0 "
37
+ foundationdb = " 0.5 "
38
38
futures = " 0.3"
39
39
```
40
40
41
41
## Initialization
42
42
43
- Due to limitations in the C API, the Client and it's associated Network can only be initialized and run once per the life of a process. Generally the ` foundationdb::boot ` function will be enough to initialize the Client. See ` foundationdb::default_api ` and ` foundationdb::builder ` for more configuration options of the Fdb Client.
43
+ Due to limitations in the C API, the Client and it's associated Network can only be initialized and run once per the life of a process. Generally the ` foundationdb::run ` function will be enough to initialize the Client. See ` foundationdb::default_api ` and ` foundationdb::builder ` for more configuration options of the Fdb Client.
44
44
45
45
## Example
46
46
@@ -65,9 +65,23 @@ async fn async_main() -> foundationdb::FdbResult<()> {
65
65
Ok (())
66
66
}
67
67
68
- foundationdb :: run (|| {
69
- futures :: executor :: block_on (async_main ()). expect (" failed to run" );
70
- });
68
+ // Safe because drop is called before the program exits
69
+ let network = unsafe { foundationdb :: boot () };
70
+ futures :: executor :: block_on (async_main ()). expect (" failed to run" );
71
+ drop (network );
72
+ ```
73
+
74
+ ``` rust
75
+ #[tokio:: main]
76
+ async fn main () {
77
+ // Safe because drop is called before the program exits
78
+ let network = unsafe { foundationdb :: boot () };
79
+
80
+ // Have fun with the FDB API
81
+
82
+ // shutdown the client
83
+ drop (network );
84
+ }
71
85
```
72
86
73
87
## Migration from 0.4 to 0.5
@@ -87,24 +101,13 @@ drop(network);
87
101
This can be converted to:
88
102
89
103
``` rust
90
- foundationdb :: boot (|| {
91
- futures :: executor :: block_on (async_main ()). expect (" failed to run" );
92
- }). expect (" failed to boot fdb" );
93
- ```
94
-
95
- or
96
-
97
- ``` rust
98
- #[tokio:: main]
99
- async fn main () {
100
- // Safe because drop is called before the program exits
101
- let network = unsafe { foundationdb :: boot () }. expect (" failed to initialize Fdb" );
104
+ // Safe because drop is called before the program exits
105
+ let network = unsafe { foundationdb :: boot () };
102
106
103
- // Have fun with the FDB API
107
+ futures :: executor :: block_on ( async_main ()) . expect ( " failed to run " );
104
108
105
- // shutdown the client
106
- drop (network );
107
- }
109
+ // cleanly shutdown the client
110
+ drop (network );
108
111
```
109
112
110
113
## API stability
0 commit comments