initial commit
This commit is contained in:
		
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
/target
 | 
			
		||||
**/*.rs.bk
 | 
			
		||||
/db
 | 
			
		||||
test?.zip
 | 
			
		||||
/exp
 | 
			
		||||
							
								
								
									
										770
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										770
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							@@ -0,0 +1,770 @@
 | 
			
		||||
# This file is automatically @generated by Cargo.
 | 
			
		||||
# It is not intended for manual editing.
 | 
			
		||||
version = 3
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "adler"
 | 
			
		||||
version = "1.0.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "aes"
 | 
			
		||||
version = "0.7.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 1.0.0",
 | 
			
		||||
 "cipher",
 | 
			
		||||
 "cpufeatures",
 | 
			
		||||
 "opaque-debug",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "aho-corasick"
 | 
			
		||||
version = "0.7.19"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "memchr",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "autocfg"
 | 
			
		||||
version = "1.1.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "base64"
 | 
			
		||||
version = "0.13.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "base64ct"
 | 
			
		||||
version = "1.0.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bitflags"
 | 
			
		||||
version = "0.9.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bitflags"
 | 
			
		||||
version = "1.3.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "block-buffer"
 | 
			
		||||
version = "0.10.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "generic-array",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "byteorder"
 | 
			
		||||
version = "1.4.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bzip2"
 | 
			
		||||
version = "0.4.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bzip2-sys",
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bzip2-sys"
 | 
			
		||||
version = "0.1.11+1.0.8"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cc",
 | 
			
		||||
 "libc",
 | 
			
		||||
 "pkg-config",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cc"
 | 
			
		||||
version = "1.0.73"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "jobserver",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cfg-if"
 | 
			
		||||
version = "0.1.10"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cfg-if"
 | 
			
		||||
version = "1.0.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cipher"
 | 
			
		||||
version = "0.3.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "generic-array",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "constant_time_eq"
 | 
			
		||||
version = "0.1.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "cpufeatures"
 | 
			
		||||
version = "0.2.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "crc32fast"
 | 
			
		||||
version = "1.3.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 1.0.0",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "crossbeam-utils"
 | 
			
		||||
version = "0.8.11"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 1.0.0",
 | 
			
		||||
 "once_cell",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "crypto-common"
 | 
			
		||||
version = "0.1.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "generic-array",
 | 
			
		||||
 "typenum",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "digest"
 | 
			
		||||
version = "0.10.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "block-buffer",
 | 
			
		||||
 "crypto-common",
 | 
			
		||||
 "subtle",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "dirs"
 | 
			
		||||
version = "2.0.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 0.1.10",
 | 
			
		||||
 "dirs-sys",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "dirs-sys"
 | 
			
		||||
version = "0.3.7"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
 "redox_users",
 | 
			
		||||
 "winapi",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "dunce"
 | 
			
		||||
version = "1.0.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "edb-test1"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "ledb",
 | 
			
		||||
 "ledb-derive",
 | 
			
		||||
 "ledb-types",
 | 
			
		||||
 "rand",
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_derive",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
 "zip",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "flate2"
 | 
			
		||||
version = "1.0.24"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "crc32fast",
 | 
			
		||||
 "miniz_oxide",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "gcc"
 | 
			
		||||
version = "0.3.55"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "generic-array"
 | 
			
		||||
version = "0.14.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "typenum",
 | 
			
		||||
 "version_check",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "getrandom"
 | 
			
		||||
version = "0.2.7"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 1.0.0",
 | 
			
		||||
 "libc",
 | 
			
		||||
 "wasi",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "half"
 | 
			
		||||
version = "1.8.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "hmac"
 | 
			
		||||
version = "0.12.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "digest",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "itoa"
 | 
			
		||||
version = "1.0.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "jobserver"
 | 
			
		||||
version = "0.1.24"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ledb"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "035e7ab9b9b6de6b16bf9ddd6ef4ab764161c2024e53fa11f592368610128114"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "byteorder",
 | 
			
		||||
 "dirs",
 | 
			
		||||
 "dunce",
 | 
			
		||||
 "ledb-derive",
 | 
			
		||||
 "ledb-types",
 | 
			
		||||
 "lmdb-zero",
 | 
			
		||||
 "ordered-float",
 | 
			
		||||
 "regex",
 | 
			
		||||
 "ron",
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_cbor",
 | 
			
		||||
 "supercow",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ledb-derive"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "01e3e32cca609ef18496c4300c59263964ba8ceb89d7fc5307e1cb9a645484de"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "syn",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ledb-types"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "20d1de30724b365b84e65498d91197524c67a8c0919f045bb6af9c471b2d048e"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_cbor",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "libc"
 | 
			
		||||
version = "0.2.132"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "liblmdb-sys"
 | 
			
		||||
version = "0.2.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "feed38a3a580f60bf61aaa067b0ff4123395966839adeaf67258a9e50c4d2e49"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "gcc",
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "lmdb-zero"
 | 
			
		||||
version = "0.4.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "13416eee745b087c22934f35f1f24da22da41ba2a5ce197143d168ce055cc58d"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bitflags 0.9.1",
 | 
			
		||||
 "libc",
 | 
			
		||||
 "liblmdb-sys",
 | 
			
		||||
 "supercow",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "memchr"
 | 
			
		||||
version = "2.5.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "miniz_oxide"
 | 
			
		||||
version = "0.5.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "adler",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "num-traits"
 | 
			
		||||
version = "0.2.15"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "autocfg",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "num_threads"
 | 
			
		||||
version = "0.1.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "once_cell"
 | 
			
		||||
version = "1.14.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "opaque-debug"
 | 
			
		||||
version = "0.3.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ordered-float"
 | 
			
		||||
version = "1.1.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "num-traits",
 | 
			
		||||
 "serde",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "password-hash"
 | 
			
		||||
version = "0.3.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "1d791538a6dcc1e7cb7fe6f6b58aca40e7f79403c45b2bc274008b5e647af1d8"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "base64ct",
 | 
			
		||||
 "rand_core",
 | 
			
		||||
 "subtle",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "pbkdf2"
 | 
			
		||||
version = "0.10.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "271779f35b581956db91a3e55737327a03aa051e90b1c47aeb189508533adfd7"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "digest",
 | 
			
		||||
 "hmac",
 | 
			
		||||
 "password-hash",
 | 
			
		||||
 "sha2",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "pkg-config"
 | 
			
		||||
version = "0.3.25"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ppv-lite86"
 | 
			
		||||
version = "0.2.16"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "proc-macro2"
 | 
			
		||||
version = "1.0.43"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "unicode-ident",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "quote"
 | 
			
		||||
version = "1.0.21"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rand"
 | 
			
		||||
version = "0.8.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
 "rand_chacha",
 | 
			
		||||
 "rand_core",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rand_chacha"
 | 
			
		||||
version = "0.3.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "ppv-lite86",
 | 
			
		||||
 "rand_core",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rand_core"
 | 
			
		||||
version = "0.6.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "getrandom",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "redox_syscall"
 | 
			
		||||
version = "0.2.16"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bitflags 1.3.2",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "redox_users"
 | 
			
		||||
version = "0.4.3"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "getrandom",
 | 
			
		||||
 "redox_syscall",
 | 
			
		||||
 "thiserror",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "regex"
 | 
			
		||||
version = "1.6.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "aho-corasick",
 | 
			
		||||
 "memchr",
 | 
			
		||||
 "regex-syntax",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "regex-syntax"
 | 
			
		||||
version = "0.6.27"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ron"
 | 
			
		||||
version = "0.6.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "86018df177b1beef6c7c8ef949969c4f7cb9a9344181b92486b23c79995bdaa4"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "base64",
 | 
			
		||||
 "bitflags 1.3.2",
 | 
			
		||||
 "serde",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ryu"
 | 
			
		||||
version = "1.0.11"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde"
 | 
			
		||||
version = "1.0.144"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "serde_derive",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde_cbor"
 | 
			
		||||
version = "0.11.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "half",
 | 
			
		||||
 "serde",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde_derive"
 | 
			
		||||
version = "1.0.144"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "syn",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "serde_json"
 | 
			
		||||
version = "1.0.85"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "itoa",
 | 
			
		||||
 "ryu",
 | 
			
		||||
 "serde",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "sha1"
 | 
			
		||||
version = "0.10.5"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 1.0.0",
 | 
			
		||||
 "cpufeatures",
 | 
			
		||||
 "digest",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "sha2"
 | 
			
		||||
version = "0.10.6"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cfg-if 1.0.0",
 | 
			
		||||
 "cpufeatures",
 | 
			
		||||
 "digest",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "subtle"
 | 
			
		||||
version = "2.4.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "supercow"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "171758edb47aa306a78dfa4ab9aeb5167405bd4e3dc2b64e88f6a84bbe98bd63"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "syn"
 | 
			
		||||
version = "1.0.99"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "unicode-ident",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "thiserror"
 | 
			
		||||
version = "1.0.35"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "thiserror-impl",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "thiserror-impl"
 | 
			
		||||
version = "1.0.35"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "syn",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "time"
 | 
			
		||||
version = "0.3.14"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "itoa",
 | 
			
		||||
 "libc",
 | 
			
		||||
 "num_threads",
 | 
			
		||||
 "time-macros",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "time-macros"
 | 
			
		||||
version = "0.2.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "typenum"
 | 
			
		||||
version = "1.15.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "unicode-ident"
 | 
			
		||||
version = "1.0.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "version_check"
 | 
			
		||||
version = "0.9.4"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "wasi"
 | 
			
		||||
version = "0.11.0+wasi-snapshot-preview1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi"
 | 
			
		||||
version = "0.3.9"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "winapi-i686-pc-windows-gnu",
 | 
			
		||||
 "winapi-x86_64-pc-windows-gnu",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi-i686-pc-windows-gnu"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "winapi-x86_64-pc-windows-gnu"
 | 
			
		||||
version = "0.4.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "zip"
 | 
			
		||||
version = "0.6.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "bf225bcf73bb52cbb496e70475c7bd7a3f769df699c0020f6c7bd9a96dcf0b8d"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "aes",
 | 
			
		||||
 "byteorder",
 | 
			
		||||
 "bzip2",
 | 
			
		||||
 "constant_time_eq",
 | 
			
		||||
 "crc32fast",
 | 
			
		||||
 "crossbeam-utils",
 | 
			
		||||
 "flate2",
 | 
			
		||||
 "hmac",
 | 
			
		||||
 "pbkdf2",
 | 
			
		||||
 "sha1",
 | 
			
		||||
 "time",
 | 
			
		||||
 "zstd",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "zstd"
 | 
			
		||||
version = "0.10.2+zstd.1.5.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "5f4a6bd64f22b5e3e94b4e238669ff9f10815c27a5180108b849d24174a83847"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "zstd-safe",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "zstd-safe"
 | 
			
		||||
version = "4.1.6+zstd.1.5.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "94b61c51bb270702d6167b8ce67340d2754b088d0c091b06e593aa772c3ee9bb"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
 "zstd-sys",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "zstd-sys"
 | 
			
		||||
version = "1.6.3+zstd.1.5.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cc",
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										17
									
								
								Cargo.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Cargo.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
[package]
 | 
			
		||||
name = "edb-test1"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
authors = ["Dmitry <b4tm4n@mail.ru>"]
 | 
			
		||||
edition = "2021"
 | 
			
		||||
 | 
			
		||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
			
		||||
 | 
			
		||||
[dependencies]
 | 
			
		||||
serde="1.0"
 | 
			
		||||
serde_derive="1.0"
 | 
			
		||||
serde_json="1.0"
 | 
			
		||||
ledb="0.4"
 | 
			
		||||
ledb-derive="0.4"
 | 
			
		||||
ledb-types="0.4"
 | 
			
		||||
zip="0.6"
 | 
			
		||||
rand="0.8"
 | 
			
		||||
							
								
								
									
										437
									
								
								src/main.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										437
									
								
								src/main.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,437 @@
 | 
			
		||||
/*
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
#![feature(test)]
 | 
			
		||||
extern crate test;
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
extern crate serde;
 | 
			
		||||
#[macro_use]
 | 
			
		||||
extern crate serde_derive;
 | 
			
		||||
// This allows inserting JSON documents
 | 
			
		||||
#[macro_use]
 | 
			
		||||
extern crate serde_json;
 | 
			
		||||
#[macro_use]
 | 
			
		||||
extern crate ledb;
 | 
			
		||||
// This allows define typed documents easy
 | 
			
		||||
#[macro_use]
 | 
			
		||||
extern crate ledb_derive;
 | 
			
		||||
extern crate ledb_types;
 | 
			
		||||
extern crate zip;
 | 
			
		||||
 | 
			
		||||
use rand::seq::IteratorRandom;
 | 
			
		||||
use std::time::Instant;
 | 
			
		||||
 | 
			
		||||
use std::{fs, io};
 | 
			
		||||
 | 
			
		||||
use ledb::{Options, Storage};
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Default, Clone, Deserialize)]
 | 
			
		||||
struct SourceQuestion {
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    num: u32,
 | 
			
		||||
    id: String,
 | 
			
		||||
 | 
			
		||||
    #[serde(alias = "Вопрос")]
 | 
			
		||||
    description: String,
 | 
			
		||||
    #[serde(alias = "Ответ")]
 | 
			
		||||
    answer: String,
 | 
			
		||||
 | 
			
		||||
    #[serde(alias = "Автор")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    author: String,
 | 
			
		||||
    #[serde(alias = "Комментарий")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    comment: String,
 | 
			
		||||
    #[serde(alias = "Комментарии")]
 | 
			
		||||
    #[serde(alias = "Инфо")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    comment1: String,
 | 
			
		||||
    #[serde(alias = "Тур")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    tour: String,
 | 
			
		||||
    #[serde(alias = "Ссылка")]
 | 
			
		||||
    #[serde(alias = "URL")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    url: String,
 | 
			
		||||
    #[serde(alias = "Дата")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    date: String,
 | 
			
		||||
    #[serde(alias = "Обработан")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    processed_by: String,
 | 
			
		||||
    #[serde(alias = "Редактор")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    redacted_by: String,
 | 
			
		||||
    #[serde(alias = "Копирайт")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    copyright: String,
 | 
			
		||||
    #[serde(alias = "Тема")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    theme: String,
 | 
			
		||||
    #[serde(alias = "Вид")]
 | 
			
		||||
    #[serde(alias = "Тип")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    kind: String,
 | 
			
		||||
    #[serde(alias = "Источник")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    source: String,
 | 
			
		||||
    #[serde(alias = "Рейтинг")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    rating: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Default, Clone, Deserialize)]
 | 
			
		||||
struct SourceQuestionsBatch {
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    filename: String,
 | 
			
		||||
    #[serde(alias = "Пакет")]
 | 
			
		||||
    #[serde(alias = "Чемпионат")]
 | 
			
		||||
    description: String,
 | 
			
		||||
    #[serde(alias = "Автор")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    author: String,
 | 
			
		||||
    #[serde(alias = "Комментарий")]
 | 
			
		||||
    #[serde(alias = "Комментарии")]
 | 
			
		||||
    #[serde(alias = "Инфо")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    comment: String,
 | 
			
		||||
    #[serde(alias = "Ссылка")]
 | 
			
		||||
    #[serde(alias = "URL")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    url: String,
 | 
			
		||||
    #[serde(alias = "Дата")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    date: String,
 | 
			
		||||
    #[serde(alias = "Обработан")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    processed_by: String,
 | 
			
		||||
    #[serde(alias = "Редактор")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    redacted_by: String,
 | 
			
		||||
    #[serde(alias = "Копирайт")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    copyright: String,
 | 
			
		||||
    #[serde(alias = "Тема")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    theme: String,
 | 
			
		||||
    #[serde(alias = "Вид")]
 | 
			
		||||
    #[serde(alias = "Тип")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    kind: String,
 | 
			
		||||
    #[serde(alias = "Источник")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    source: String,
 | 
			
		||||
    #[serde(alias = "Рейтинг")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    rating: String,
 | 
			
		||||
    #[serde(alias = "Вопросы")]
 | 
			
		||||
    questions: Vec<SourceQuestion>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Default, Clone, Serialize, Deserialize, Document)]
 | 
			
		||||
struct BatchInfo {
 | 
			
		||||
    #[document(primary)]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    filename: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    description: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    author: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    comment: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    url: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    date: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    processed_by: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    redacted_by: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    copyright: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    theme: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    kind: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    source: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    rating: String,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Default, Clone, Serialize, Deserialize, Document)]
 | 
			
		||||
struct Question {
 | 
			
		||||
    #[document(primary)]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    num: u32,
 | 
			
		||||
    #[document(index)]
 | 
			
		||||
    id: String,
 | 
			
		||||
 | 
			
		||||
    description: String,
 | 
			
		||||
    answer: String,
 | 
			
		||||
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    author: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    comment: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    comment1: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    tour: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    url: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    date: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    processed_by: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    redacted_by: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    copyright: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    theme: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    kind: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    source: String,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    rating: String,
 | 
			
		||||
    #[document(nested)]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    batch_info: BatchInfo,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl From<SourceQuestion> for Question {
 | 
			
		||||
    fn from(src: SourceQuestion) -> Self {
 | 
			
		||||
        Self {
 | 
			
		||||
            num: src.num,
 | 
			
		||||
            id: src.id,
 | 
			
		||||
            description: src.description,
 | 
			
		||||
            answer: src.answer,
 | 
			
		||||
            author: src.author,
 | 
			
		||||
            comment: src.comment,
 | 
			
		||||
            comment1: src.comment1,
 | 
			
		||||
            tour: src.tour,
 | 
			
		||||
            url: src.url,
 | 
			
		||||
            date: src.date,
 | 
			
		||||
            processed_by: src.processed_by,
 | 
			
		||||
            redacted_by: src.redacted_by,
 | 
			
		||||
            copyright: src.copyright,
 | 
			
		||||
            theme: src.theme,
 | 
			
		||||
            kind: src.kind,
 | 
			
		||||
            source: src.source,
 | 
			
		||||
            rating: src.rating,
 | 
			
		||||
            batch_info: BatchInfo::default(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl From<&SourceQuestionsBatch> for BatchInfo {
 | 
			
		||||
    fn from(src: &SourceQuestionsBatch) -> Self {
 | 
			
		||||
        Self {
 | 
			
		||||
            filename: src.filename.clone(),
 | 
			
		||||
            description: src.description.clone(),
 | 
			
		||||
            author: src.author.clone(),
 | 
			
		||||
            comment: src.comment.clone(),
 | 
			
		||||
            url: src.url.clone(),
 | 
			
		||||
            date: src.date.clone(),
 | 
			
		||||
            processed_by: src.processed_by.clone(),
 | 
			
		||||
            redacted_by: src.redacted_by.clone(),
 | 
			
		||||
            copyright: src.copyright.clone(),
 | 
			
		||||
            theme: src.theme.clone(),
 | 
			
		||||
            kind: src.kind.clone(),
 | 
			
		||||
            source: src.source.clone(),
 | 
			
		||||
            rating: src.rating.clone(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Into<Vec<Question>> for SourceQuestionsBatch {
 | 
			
		||||
    fn into(self) -> Vec<Question> {
 | 
			
		||||
        let mut result = Vec::<Question>::with_capacity(self.questions.len());
 | 
			
		||||
        self.questions.iter().for_each(|item| {
 | 
			
		||||
            let mut question: Question = item.clone().into();
 | 
			
		||||
            question.batch_info = BatchInfo::from(&self);
 | 
			
		||||
            result.push(question);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        result
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// measure and return time elapsed in `func` in seconds
 | 
			
		||||
pub fn measure<F: FnOnce()>(func: F) -> f64 {
 | 
			
		||||
    let start = Instant::now();
 | 
			
		||||
    func();
 | 
			
		||||
    let elapsed = start.elapsed();
 | 
			
		||||
    (elapsed.as_secs() as f64) + (elapsed.subsec_nanos() as f64 / 1000_000_000.0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn measure_and_print<F: FnOnce()>(func: F) {
 | 
			
		||||
    let m = measure(func);
 | 
			
		||||
    eprintln!("{}", m);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn writer_v4() {
 | 
			
		||||
    let zip_file = fs::File::open("test1.zip").unwrap();
 | 
			
		||||
    let zip_reader = io::BufReader::new(zip_file);
 | 
			
		||||
    let mut archive = zip::ZipArchive::new(zip_reader).unwrap();
 | 
			
		||||
 | 
			
		||||
    let options: Options = serde_json::from_value(json!({
 | 
			
		||||
        "map_size": 900 * 1024 * 1024, // 900mb
 | 
			
		||||
        "write_map": true,
 | 
			
		||||
        "map_async": true,
 | 
			
		||||
        "no_lock": true,
 | 
			
		||||
        "no_meta_sync": true,
 | 
			
		||||
        "no_sync": true,
 | 
			
		||||
    }))
 | 
			
		||||
    .unwrap();
 | 
			
		||||
 | 
			
		||||
    let storage = Storage::new("db", options).unwrap();
 | 
			
		||||
    let collection = storage.collection("questions").unwrap();
 | 
			
		||||
 | 
			
		||||
    query!(index for collection
 | 
			
		||||
        num int,
 | 
			
		||||
        batch_info.filename str,
 | 
			
		||||
    )
 | 
			
		||||
    .unwrap();
 | 
			
		||||
    let mut count: usize = 0;
 | 
			
		||||
    let count = &mut count;
 | 
			
		||||
    (0..archive.len())
 | 
			
		||||
        .map(|i| {
 | 
			
		||||
            let file = archive.by_index(i).unwrap();
 | 
			
		||||
            let name = file.mangled_name();
 | 
			
		||||
            let name_str = name.to_str().unwrap();
 | 
			
		||||
 | 
			
		||||
            let data: Result<SourceQuestionsBatch, _> = serde_json::from_reader(file);
 | 
			
		||||
 | 
			
		||||
            (String::from(name_str), data)
 | 
			
		||||
        })
 | 
			
		||||
        .filter(|(_, data)| data.is_ok())
 | 
			
		||||
        .map(|(filename, data)| {
 | 
			
		||||
            let mut data = data.unwrap();
 | 
			
		||||
            data.filename = filename.clone();
 | 
			
		||||
            let questions: Vec<Question> = data.into();
 | 
			
		||||
            questions
 | 
			
		||||
        })
 | 
			
		||||
        .flatten()
 | 
			
		||||
        .for_each(|question| {
 | 
			
		||||
            let result = collection.insert(&question);
 | 
			
		||||
            if result.is_err() {
 | 
			
		||||
                println!(
 | 
			
		||||
                    "Error: {:?} \n\
 | 
			
		||||
                         On: {:?}",
 | 
			
		||||
                    result, question
 | 
			
		||||
                );
 | 
			
		||||
            } else {
 | 
			
		||||
                *count += 1;
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    println!("inserted {}", count);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn print_question(q: Question) {
 | 
			
		||||
    println!("{:?}", q)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn reader_v1() -> Option<Question> {
 | 
			
		||||
    let zip_file = fs::File::open("test1.zip").unwrap();
 | 
			
		||||
    let zip_reader = io::BufReader::new(zip_file);
 | 
			
		||||
    let mut archive = zip::ZipArchive::new(zip_reader).unwrap();
 | 
			
		||||
 | 
			
		||||
    let mut rng = rand::thread_rng();
 | 
			
		||||
    let file_n = (0..archive.len()).choose(&mut rng).unwrap();
 | 
			
		||||
    let file = archive.by_index(file_n).unwrap();
 | 
			
		||||
    let data: Result<SourceQuestionsBatch, _> = serde_json::from_reader(file);
 | 
			
		||||
    let data = data.unwrap();
 | 
			
		||||
    let questions: Vec<Question> = data.into();
 | 
			
		||||
 | 
			
		||||
    let ret = questions.iter().choose(&mut rng);
 | 
			
		||||
 | 
			
		||||
    if let Some(question) = ret {
 | 
			
		||||
        Some(question.clone())
 | 
			
		||||
    } else {
 | 
			
		||||
        None
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn compact_db() {
 | 
			
		||||
    let options: Options = serde_json::from_value(json!({
 | 
			
		||||
        "write_map": true,
 | 
			
		||||
        "map_async": true,
 | 
			
		||||
        "no_lock": true,
 | 
			
		||||
        "no_meta_sync": true,
 | 
			
		||||
        "no_sync": true,
 | 
			
		||||
    }))
 | 
			
		||||
    .unwrap();
 | 
			
		||||
 | 
			
		||||
    let storage = Storage::new("db", options).unwrap();
 | 
			
		||||
    //let collection = storage.collection("questions").unwrap();
 | 
			
		||||
 | 
			
		||||
    //query!(index for collection
 | 
			
		||||
    //    num int,
 | 
			
		||||
    //    batch_info.filename str,
 | 
			
		||||
    //)
 | 
			
		||||
    //.unwrap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn reader_v4() -> Option<Question> {
 | 
			
		||||
    let options: Options = serde_json::from_value(json!({
 | 
			
		||||
            "read_only": true,
 | 
			
		||||
    //        "map_async": true,
 | 
			
		||||
            "no_lock": true,
 | 
			
		||||
    //        "no_meta_sync": true,
 | 
			
		||||
    //        "no_sync": true,
 | 
			
		||||
    //        "no_tls": true
 | 
			
		||||
        }))
 | 
			
		||||
    .unwrap();
 | 
			
		||||
 | 
			
		||||
    let storage = Storage::new("db", options).unwrap();
 | 
			
		||||
    let collection = storage.collection("questions").unwrap();
 | 
			
		||||
    let mut rng = rand::thread_rng();
 | 
			
		||||
    let last_id = collection.last_id().unwrap();
 | 
			
		||||
    let id = (1..(last_id + 1)).choose(&mut rng).unwrap();
 | 
			
		||||
    //let id = ledb::KeyData::Int(id as i64);
 | 
			
		||||
 | 
			
		||||
    collection.get::<Question>(id).unwrap()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn main() {
 | 
			
		||||
    //println!("-- v1: ");
 | 
			
		||||
    //measure_and_print(|| print_question(reader_v1().unwrap()));
 | 
			
		||||
    //println!(" --- ");
 | 
			
		||||
    //println!("-- v4: ");
 | 
			
		||||
    //measure_and_print(|| print_question(reader_v4().unwrap()));
 | 
			
		||||
    //println!(" --- ");
 | 
			
		||||
    measure_and_print(writer_v4);
 | 
			
		||||
    //measure_and_print(compact_db);
 | 
			
		||||
    //measure_and_print(|| print_question(reader_v4().unwrap()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod tests {
 | 
			
		||||
    use super::*;
 | 
			
		||||
    use test::Bencher;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn reader_v1_works() {
 | 
			
		||||
        reader_v1().unwrap();
 | 
			
		||||
    }
 | 
			
		||||
    fn reader_v4_works() {
 | 
			
		||||
        reader_v4().unwrap();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[bench]
 | 
			
		||||
    fn bench_reader_v1(b: &mut Bencher) {
 | 
			
		||||
        b.iter(|| reader_v1());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[bench]
 | 
			
		||||
    fn bench_reader_v4(b: &mut Bencher) {
 | 
			
		||||
        b.iter(|| reader_v4());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
		Reference in New Issue
	
	Block a user