open-trade лет назад: 4
Родитель
Сommit
482b5e0a66
5 измененных файлов с 165 добавлено и 158 удалено
  1. 145 142
      Cargo.lock
  2. 4 1
      Cargo.toml
  3. 1 1
      libs/hbb_common
  4. 1 1
      src/rendezvous_server.rs
  5. 14 13
      src/sled_async.rs

+ 145 - 142
Cargo.lock

@@ -71,6 +71,30 @@ version = "0.13.0"
71
 source = "registry+https://github.com/rust-lang/crates.io-index"
71
 source = "registry+https://github.com/rust-lang/crates.io-index"
72
 checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
72
 checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
73
 
73
 
74
+[[package]]
75
+name = "bindgen"
76
+version = "0.54.0"
77
+source = "registry+https://github.com/rust-lang/crates.io-index"
78
+checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36"
79
+dependencies = [
80
+ "bitflags",
81
+ "cexpr",
82
+ "cfg-if 0.1.10",
83
+ "clang-sys",
84
+ "clap",
85
+ "env_logger 0.7.1",
86
+ "lazy_static",
87
+ "lazycell",
88
+ "log",
89
+ "peeking_take_while",
90
+ "proc-macro2",
91
+ "quote",
92
+ "regex",
93
+ "rustc-hash",
94
+ "shlex",
95
+ "which",
96
+]
97
+
74
 [[package]]
98
 [[package]]
75
 name = "bitflags"
99
 name = "bitflags"
76
 version = "1.2.1"
100
 version = "1.2.1"
@@ -94,12 +118,6 @@ version = "3.4.0"
94
 source = "registry+https://github.com/rust-lang/crates.io-index"
118
 source = "registry+https://github.com/rust-lang/crates.io-index"
95
 checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
119
 checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
96
 
120
 
97
-[[package]]
98
-name = "byteorder"
99
-version = "1.3.4"
100
-source = "registry+https://github.com/rust-lang/crates.io-index"
101
-checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
102
-
103
 [[package]]
121
 [[package]]
104
 name = "bytes"
122
 name = "bytes"
105
 version = "0.5.6"
123
 version = "0.5.6"
@@ -115,6 +133,15 @@ dependencies = [
115
  "jobserver",
133
  "jobserver",
116
 ]
134
 ]
117
 
135
 
136
+[[package]]
137
+name = "cexpr"
138
+version = "0.4.0"
139
+source = "registry+https://github.com/rust-lang/crates.io-index"
140
+checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27"
141
+dependencies = [
142
+ "nom",
143
+]
144
+
118
 [[package]]
145
 [[package]]
119
 name = "cfg-if"
146
 name = "cfg-if"
120
 version = "0.1.10"
147
 version = "0.1.10"
@@ -127,6 +154,17 @@ version = "1.0.0"
127
 source = "registry+https://github.com/rust-lang/crates.io-index"
154
 source = "registry+https://github.com/rust-lang/crates.io-index"
128
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
155
 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
129
 
156
 
157
+[[package]]
158
+name = "clang-sys"
159
+version = "0.29.3"
160
+source = "registry+https://github.com/rust-lang/crates.io-index"
161
+checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a"
162
+dependencies = [
163
+ "glob",
164
+ "libc",
165
+ "libloading",
166
+]
167
+
130
 [[package]]
168
 [[package]]
131
 name = "clap"
169
 name = "clap"
132
 version = "2.33.3"
170
 version = "2.33.3"
@@ -142,15 +180,6 @@ dependencies = [
142
  "vec_map",
180
  "vec_map",
143
 ]
181
 ]
144
 
182
 
145
-[[package]]
146
-name = "cloudabi"
147
-version = "0.1.0"
148
-source = "registry+https://github.com/rust-lang/crates.io-index"
149
-checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
150
-dependencies = [
151
- "bitflags",
152
-]
153
-
154
 [[package]]
183
 [[package]]
155
 name = "confy"
184
 name = "confy"
156
 version = "0.4.1"
185
 version = "0.4.1"
@@ -161,12 +190,6 @@ dependencies = [
161
  "toml",
190
  "toml",
162
 ]
191
 ]
163
 
192
 
164
-[[package]]
165
-name = "const_fn"
166
-version = "0.4.3"
167
-source = "registry+https://github.com/rust-lang/crates.io-index"
168
-checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab"
169
-
170
 [[package]]
193
 [[package]]
171
 name = "constant_time_eq"
194
 name = "constant_time_eq"
172
 version = "0.1.5"
195
 version = "0.1.5"
@@ -189,29 +212,6 @@ version = "0.7.0"
189
 source = "registry+https://github.com/rust-lang/crates.io-index"
212
 source = "registry+https://github.com/rust-lang/crates.io-index"
190
 checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
213
 checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
191
 
214
 
192
-[[package]]
193
-name = "crc32fast"
194
-version = "1.2.1"
195
-source = "registry+https://github.com/rust-lang/crates.io-index"
196
-checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
197
-dependencies = [
198
- "cfg-if 1.0.0",
199
-]
200
-
201
-[[package]]
202
-name = "crossbeam-epoch"
203
-version = "0.9.1"
204
-source = "registry+https://github.com/rust-lang/crates.io-index"
205
-checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
206
-dependencies = [
207
- "cfg-if 1.0.0",
208
- "const_fn",
209
- "crossbeam-utils",
210
- "lazy_static",
211
- "memoffset",
212
- "scopeguard",
213
-]
214
-
215
 [[package]]
215
 [[package]]
216
 name = "crossbeam-utils"
216
 name = "crossbeam-utils"
217
 version = "0.8.1"
217
 version = "0.8.1"
@@ -299,6 +299,19 @@ version = "1.6.1"
299
 source = "registry+https://github.com/rust-lang/crates.io-index"
299
 source = "registry+https://github.com/rust-lang/crates.io-index"
300
 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
300
 checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
301
 
301
 
302
+[[package]]
303
+name = "env_logger"
304
+version = "0.7.1"
305
+source = "registry+https://github.com/rust-lang/crates.io-index"
306
+checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
307
+dependencies = [
308
+ "atty",
309
+ "humantime 1.3.0",
310
+ "log",
311
+ "regex",
312
+ "termcolor",
313
+]
314
+
302
 [[package]]
315
 [[package]]
303
 name = "env_logger"
316
 name = "env_logger"
304
 version = "0.8.2"
317
 version = "0.8.2"
@@ -306,7 +319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
306
 checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
319
 checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
307
 dependencies = [
320
 dependencies = [
308
  "atty",
321
  "atty",
309
- "humantime",
322
+ "humantime 2.0.1",
310
  "log",
323
  "log",
311
  "regex",
324
  "regex",
312
  "termcolor",
325
  "termcolor",
@@ -344,16 +357,6 @@ version = "1.0.7"
344
 source = "registry+https://github.com/rust-lang/crates.io-index"
357
 source = "registry+https://github.com/rust-lang/crates.io-index"
345
 checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
358
 checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
346
 
359
 
347
-[[package]]
348
-name = "fs2"
349
-version = "0.4.3"
350
-source = "registry+https://github.com/rust-lang/crates.io-index"
351
-checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
352
-dependencies = [
353
- "libc",
354
- "winapi 0.3.9",
355
-]
356
-
357
 [[package]]
360
 [[package]]
358
 name = "fuchsia-zircon"
361
 name = "fuchsia-zircon"
359
 version = "0.3.3"
362
 version = "0.3.3"
@@ -465,15 +468,6 @@ dependencies = [
465
  "slab",
468
  "slab",
466
 ]
469
 ]
467
 
470
 
468
-[[package]]
469
-name = "fxhash"
470
-version = "0.2.1"
471
-source = "registry+https://github.com/rust-lang/crates.io-index"
472
-checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
473
-dependencies = [
474
- "byteorder",
475
-]
476
-
477
 [[package]]
471
 [[package]]
478
 name = "getrandom"
472
 name = "getrandom"
479
 version = "0.1.15"
473
 version = "0.1.15"
@@ -509,7 +503,7 @@ dependencies = [
509
  "confy",
503
  "confy",
510
  "directories-next",
504
  "directories-next",
511
  "dirs-next",
505
  "dirs-next",
512
- "env_logger",
506
+ "env_logger 0.8.2",
513
  "filetime",
507
  "filetime",
514
  "futures",
508
  "futures",
515
  "futures-util",
509
  "futures-util",
@@ -540,11 +534,11 @@ dependencies = [
540
  "clap",
534
  "clap",
541
  "hbb_common",
535
  "hbb_common",
542
  "lazy_static",
536
  "lazy_static",
537
+ "rocksdb",
543
  "rust-ini",
538
  "rust-ini",
544
  "serde",
539
  "serde",
545
  "serde_derive",
540
  "serde_derive",
546
  "serde_json",
541
  "serde_json",
547
- "sled",
548
 ]
542
 ]
549
 
543
 
550
 [[package]]
544
 [[package]]
@@ -558,18 +552,18 @@ dependencies = [
558
 
552
 
559
 [[package]]
553
 [[package]]
560
 name = "humantime"
554
 name = "humantime"
561
-version = "2.0.1"
555
+version = "1.3.0"
562
 source = "registry+https://github.com/rust-lang/crates.io-index"
556
 source = "registry+https://github.com/rust-lang/crates.io-index"
563
-checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a"
557
+checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
558
+dependencies = [
559
+ "quick-error",
560
+]
564
 
561
 
565
 [[package]]
562
 [[package]]
566
-name = "instant"
567
-version = "0.1.9"
563
+name = "humantime"
564
+version = "2.0.1"
568
 source = "registry+https://github.com/rust-lang/crates.io-index"
565
 source = "registry+https://github.com/rust-lang/crates.io-index"
569
-checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
570
-dependencies = [
571
- "cfg-if 1.0.0",
572
-]
566
+checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a"
573
 
567
 
574
 [[package]]
568
 [[package]]
575
 name = "iovec"
569
 name = "iovec"
@@ -629,6 +623,12 @@ version = "1.4.0"
629
 source = "registry+https://github.com/rust-lang/crates.io-index"
623
 source = "registry+https://github.com/rust-lang/crates.io-index"
630
 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
624
 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
631
 
625
 
626
+[[package]]
627
+name = "lazycell"
628
+version = "1.3.0"
629
+source = "registry+https://github.com/rust-lang/crates.io-index"
630
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
631
+
632
 [[package]]
632
 [[package]]
633
 name = "libc"
633
 name = "libc"
634
 version = "0.2.80"
634
 version = "0.2.80"
@@ -636,23 +636,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
636
 checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
636
 checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
637
 
637
 
638
 [[package]]
638
 [[package]]
639
-name = "libsodium-sys"
640
-version = "0.2.6"
639
+name = "libloading"
640
+version = "0.5.2"
641
 source = "registry+https://github.com/rust-lang/crates.io-index"
641
 source = "registry+https://github.com/rust-lang/crates.io-index"
642
-checksum = "a685b64f837b339074115f2e7f7b431ac73681d08d75b389db7498b8892b8a58"
642
+checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
643
 dependencies = [
643
 dependencies = [
644
  "cc",
644
  "cc",
645
+ "winapi 0.3.9",
646
+]
647
+
648
+[[package]]
649
+name = "librocksdb-sys"
650
+version = "6.11.4"
651
+source = "registry+https://github.com/rust-lang/crates.io-index"
652
+checksum = "eb5b56f651c204634b936be2f92dbb42c36867e00ff7fe2405591f3b9fa66f09"
653
+dependencies = [
654
+ "bindgen",
655
+ "cc",
656
+ "glob",
645
  "libc",
657
  "libc",
646
- "pkg-config",
647
 ]
658
 ]
648
 
659
 
649
 [[package]]
660
 [[package]]
650
-name = "lock_api"
651
-version = "0.4.2"
661
+name = "libsodium-sys"
662
+version = "0.2.6"
652
 source = "registry+https://github.com/rust-lang/crates.io-index"
663
 source = "registry+https://github.com/rust-lang/crates.io-index"
653
-checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
664
+checksum = "a685b64f837b339074115f2e7f7b431ac73681d08d75b389db7498b8892b8a58"
654
 dependencies = [
665
 dependencies = [
655
- "scopeguard",
666
+ "cc",
667
+ "libc",
668
+ "pkg-config",
656
 ]
669
 ]
657
 
670
 
658
 [[package]]
671
 [[package]]
@@ -680,15 +693,6 @@ version = "2.3.4"
680
 source = "registry+https://github.com/rust-lang/crates.io-index"
693
 source = "registry+https://github.com/rust-lang/crates.io-index"
681
 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
694
 checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
682
 
695
 
683
-[[package]]
684
-name = "memoffset"
685
-version = "0.6.1"
686
-source = "registry+https://github.com/rust-lang/crates.io-index"
687
-checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
688
-dependencies = [
689
- "autocfg",
690
-]
691
-
692
 [[package]]
696
 [[package]]
693
 name = "mio"
697
 name = "mio"
694
 version = "0.6.22"
698
 version = "0.6.22"
@@ -776,6 +780,16 @@ dependencies = [
776
  "libc",
780
  "libc",
777
 ]
781
 ]
778
 
782
 
783
+[[package]]
784
+name = "nom"
785
+version = "5.1.2"
786
+source = "registry+https://github.com/rust-lang/crates.io-index"
787
+checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
788
+dependencies = [
789
+ "memchr",
790
+ "version_check",
791
+]
792
+
779
 [[package]]
793
 [[package]]
780
 name = "num_cpus"
794
 name = "num_cpus"
781
 version = "1.13.0"
795
 version = "1.13.0"
@@ -809,30 +823,10 @@ dependencies = [
809
 ]
823
 ]
810
 
824
 
811
 [[package]]
825
 [[package]]
812
-name = "parking_lot"
813
-version = "0.11.1"
826
+name = "peeking_take_while"
827
+version = "0.1.2"
814
 source = "registry+https://github.com/rust-lang/crates.io-index"
828
 source = "registry+https://github.com/rust-lang/crates.io-index"
815
-checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
816
-dependencies = [
817
- "instant",
818
- "lock_api",
819
- "parking_lot_core",
820
-]
821
-
822
-[[package]]
823
-name = "parking_lot_core"
824
-version = "0.8.0"
825
-source = "registry+https://github.com/rust-lang/crates.io-index"
826
-checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
827
-dependencies = [
828
- "cfg-if 0.1.10",
829
- "cloudabi",
830
- "instant",
831
- "libc",
832
- "redox_syscall",
833
- "smallvec",
834
- "winapi 0.3.9",
835
-]
829
+checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
836
 
830
 
837
 [[package]]
831
 [[package]]
838
 name = "pin-project"
832
 name = "pin-project"
@@ -951,6 +945,12 @@ dependencies = [
951
  "protobuf-codegen",
945
  "protobuf-codegen",
952
 ]
946
 ]
953
 
947
 
948
+[[package]]
949
+name = "quick-error"
950
+version = "1.2.3"
951
+source = "registry+https://github.com/rust-lang/crates.io-index"
952
+checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
953
+
954
 [[package]]
954
 [[package]]
955
 name = "quinn"
955
 name = "quinn"
956
 version = "0.6.1"
956
 version = "0.6.1"
@@ -1087,6 +1087,16 @@ dependencies = [
1087
  "winapi 0.3.9",
1087
  "winapi 0.3.9",
1088
 ]
1088
 ]
1089
 
1089
 
1090
+[[package]]
1091
+name = "rocksdb"
1092
+version = "0.15.0"
1093
+source = "registry+https://github.com/rust-lang/crates.io-index"
1094
+checksum = "23d83c02c429044d58474eaf5ae31e062d0de894e21125b47437ec0edc1397e6"
1095
+dependencies = [
1096
+ "libc",
1097
+ "librocksdb-sys",
1098
+]
1099
+
1090
 [[package]]
1100
 [[package]]
1091
 name = "rust-argon2"
1101
 name = "rust-argon2"
1092
 version = "0.8.3"
1102
 version = "0.8.3"
@@ -1109,6 +1119,12 @@ dependencies = [
1109
  "ordered-multimap",
1119
  "ordered-multimap",
1110
 ]
1120
 ]
1111
 
1121
 
1122
+[[package]]
1123
+name = "rustc-hash"
1124
+version = "1.1.0"
1125
+source = "registry+https://github.com/rust-lang/crates.io-index"
1126
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
1127
+
1112
 [[package]]
1128
 [[package]]
1113
 name = "rustls"
1129
 name = "rustls"
1114
 version = "0.17.0"
1130
 version = "0.17.0"
@@ -1156,12 +1172,6 @@ dependencies = [
1156
  "winapi 0.3.9",
1172
  "winapi 0.3.9",
1157
 ]
1173
 ]
1158
 
1174
 
1159
-[[package]]
1160
-name = "scopeguard"
1161
-version = "1.1.0"
1162
-source = "registry+https://github.com/rust-lang/crates.io-index"
1163
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
1164
-
1165
 [[package]]
1175
 [[package]]
1166
 name = "sct"
1176
 name = "sct"
1167
 version = "0.6.0"
1177
 version = "0.6.0"
@@ -1223,6 +1233,12 @@ dependencies = [
1223
  "serde",
1233
  "serde",
1224
 ]
1234
 ]
1225
 
1235
 
1236
+[[package]]
1237
+name = "shlex"
1238
+version = "0.1.1"
1239
+source = "registry+https://github.com/rust-lang/crates.io-index"
1240
+checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
1241
+
1226
 [[package]]
1242
 [[package]]
1227
 name = "signal-hook-registry"
1243
 name = "signal-hook-registry"
1228
 version = "1.2.2"
1244
 version = "1.2.2"
@@ -1238,28 +1254,6 @@ version = "0.4.2"
1238
 source = "registry+https://github.com/rust-lang/crates.io-index"
1254
 source = "registry+https://github.com/rust-lang/crates.io-index"
1239
 checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
1255
 checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
1240
 
1256
 
1241
-[[package]]
1242
-name = "sled"
1243
-version = "0.34.6"
1244
-source = "registry+https://github.com/rust-lang/crates.io-index"
1245
-checksum = "1d0132f3e393bcb7390c60bb45769498cf4550bcb7a21d7f95c02b69f6362cdc"
1246
-dependencies = [
1247
- "crc32fast",
1248
- "crossbeam-epoch",
1249
- "crossbeam-utils",
1250
- "fs2",
1251
- "fxhash",
1252
- "libc",
1253
- "log",
1254
- "parking_lot",
1255
-]
1256
-
1257
-[[package]]
1258
-name = "smallvec"
1259
-version = "1.5.0"
1260
-source = "registry+https://github.com/rust-lang/crates.io-index"
1261
-checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85"
1262
-
1263
 [[package]]
1257
 [[package]]
1264
 name = "socket2"
1258
 name = "socket2"
1265
 version = "0.3.17"
1259
 version = "0.3.17"
@@ -1546,6 +1540,15 @@ dependencies = [
1546
  "untrusted",
1540
  "untrusted",
1547
 ]
1541
 ]
1548
 
1542
 
1543
+[[package]]
1544
+name = "which"
1545
+version = "3.1.1"
1546
+source = "registry+https://github.com/rust-lang/crates.io-index"
1547
+checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
1548
+dependencies = [
1549
+ "libc",
1550
+]
1551
+
1549
 [[package]]
1552
 [[package]]
1550
 name = "winapi"
1553
 name = "winapi"
1551
 version = "0.2.8"
1554
 version = "0.2.8"

+ 4 - 1
Cargo.toml

@@ -13,7 +13,6 @@ path = "src/hbbr/main.rs"
13
 
13
 
14
 [dependencies]
14
 [dependencies]
15
 hbb_common = { path = "libs/hbb_common" }
15
 hbb_common = { path = "libs/hbb_common" }
16
-sled = "0.34"
17
 serde_derive = "1.0"
16
 serde_derive = "1.0"
18
 serde = "1.0"
17
 serde = "1.0"
19
 serde_json = "1.0"
18
 serde_json = "1.0"
@@ -28,3 +27,7 @@ hbb_common = { path = "libs/hbb_common" }
28
 [workspace]
27
 [workspace]
29
 members = ["libs/hbb_common"]
28
 members = ["libs/hbb_common"]
30
 
29
 
30
+[dependencies.rocksdb]
31
+default-features = false
32
+features = ["lz4"]
33
+version = "0.15"

+ 1 - 1
libs/hbb_common

@@ -1 +1 @@
1
-Subproject commit 9b9677c6a438645fe1e77d308d08e5d908b501bc
1
+Subproject commit 3a1ef5db98239175384aa8034a27e387bbcb8816

+ 1 - 1
src/rendezvous_server.rs

@@ -65,7 +65,7 @@ impl PeerMap {
65
     fn new() -> ResultType<Self> {
65
     fn new() -> ResultType<Self> {
66
         Ok(Self {
66
         Ok(Self {
67
             map: Default::default(),
67
             map: Default::default(),
68
-            db: super::SledAsync::new("./sled.db", true)?,
68
+            db: super::SledAsync::new("./hbbs.db", true)?,
69
         })
69
         })
70
     }
70
     }
71
 
71
 

+ 14 - 13
src/sled_async.rs

@@ -3,49 +3,50 @@ use hbb_common::{
3
     tokio::{self, sync::mpsc},
3
     tokio::{self, sync::mpsc},
4
     ResultType,
4
     ResultType,
5
 };
5
 };
6
+use rocksdb::DB;
6
 
7
 
7
 #[derive(Debug)]
8
 #[derive(Debug)]
8
 enum Action {
9
 enum Action {
9
     Insert((String, Vec<u8>)),
10
     Insert((String, Vec<u8>)),
10
-    Get((String, mpsc::Sender<Option<sled::IVec>>)),
11
+    Get((String, mpsc::Sender<Option<Vec<u8>>>)),
11
     _Close,
12
     _Close,
12
 }
13
 }
13
 
14
 
14
 #[derive(Clone)]
15
 #[derive(Clone)]
15
 pub struct SledAsync {
16
 pub struct SledAsync {
16
-    db: sled::Db,
17
     tx: Option<mpsc::UnboundedSender<Action>>,
17
     tx: Option<mpsc::UnboundedSender<Action>>,
18
+    path: String,
18
 }
19
 }
19
 
20
 
20
 impl SledAsync {
21
 impl SledAsync {
21
     pub fn new(path: &str, run: bool) -> ResultType<Self> {
22
     pub fn new(path: &str, run: bool) -> ResultType<Self> {
22
         let mut res = Self {
23
         let mut res = Self {
23
-            db: sled::open(path)?,
24
             tx: None,
24
             tx: None,
25
+            path: path.to_owned(),
25
         };
26
         };
26
         if run {
27
         if run {
27
-            res.run();
28
+            res.run()?;
28
         }
29
         }
29
         Ok(res)
30
         Ok(res)
30
     }
31
     }
31
 
32
 
32
-    pub fn run(&mut self) -> std::thread::JoinHandle<()> {
33
+    pub fn run(&mut self) -> ResultType<std::thread::JoinHandle<()>> {
33
         let (tx, rx) = mpsc::unbounded_channel::<Action>();
34
         let (tx, rx) = mpsc::unbounded_channel::<Action>();
34
         self.tx = Some(tx);
35
         self.tx = Some(tx);
35
-        let db = self.db.clone();
36
-        std::thread::spawn(move || {
36
+        let db = DB::open_default(&self.path)?;
37
+        Ok(std::thread::spawn(move || {
37
             Self::io_loop(db, rx);
38
             Self::io_loop(db, rx);
38
             log::debug!("Exit SledAsync loop");
39
             log::debug!("Exit SledAsync loop");
39
-        })
40
+        }))
40
     }
41
     }
41
 
42
 
42
     #[tokio::main(basic_scheduler)]
43
     #[tokio::main(basic_scheduler)]
43
-    async fn io_loop(db: sled::Db, rx: mpsc::UnboundedReceiver<Action>) {
44
+    async fn io_loop(db: DB, rx: mpsc::UnboundedReceiver<Action>) {
44
         let mut rx = rx;
45
         let mut rx = rx;
45
         while let Some(x) = rx.recv().await {
46
         while let Some(x) = rx.recv().await {
46
             match x {
47
             match x {
47
                 Action::Insert((key, value)) => {
48
                 Action::Insert((key, value)) => {
48
-                    allow_err!(db.insert(key, value));
49
+                    allow_err!(db.put(&key, &value));
49
                 }
50
                 }
50
                 Action::Get((key, sender)) => {
51
                 Action::Get((key, sender)) => {
51
                     let mut sender = sender;
52
                     let mut sender = sender;
@@ -67,9 +68,9 @@ impl SledAsync {
67
         allow_err!(j.join());
68
         allow_err!(j.join());
68
     }
69
     }
69
 
70
 
70
-    pub async fn get(&mut self, key: String) -> Option<sled::IVec> {
71
+    pub async fn get(&mut self, key: String) -> Option<Vec<u8>> {
71
         if let Some(tx) = &self.tx {
72
         if let Some(tx) = &self.tx {
72
-            let (tx_once, mut rx) = mpsc::channel::<Option<sled::IVec>>(1);
73
+            let (tx_once, mut rx) = mpsc::channel::<Option<Vec<u8>>>(1);
73
             allow_err!(tx.send(Action::Get((key, tx_once))));
74
             allow_err!(tx.send(Action::Get((key, tx_once))));
74
             if let Some(v) = rx.recv().await {
75
             if let Some(v) = rx.recv().await {
75
                 return v;
76
                 return v;
@@ -79,7 +80,7 @@ impl SledAsync {
79
     }
80
     }
80
 
81
 
81
     #[inline]
82
     #[inline]
82
-    pub fn deserialize<'a, T: serde::Deserialize<'a>>(v: &'a Option<sled::IVec>) -> Option<T> {
83
+    pub fn deserialize<'a, T: serde::Deserialize<'a>>(v: &'a Option<Vec<u8>>) -> Option<T> {
83
         if let Some(v) = v {
84
         if let Some(v) = v {
84
             if let Ok(v) = std::str::from_utf8(v) {
85
             if let Ok(v) = std::str::from_utf8(v) {
85
                 if let Ok(v) = serde_json::from_str::<T>(&v) {
86
                 if let Ok(v) = serde_json::from_str::<T>(&v) {