diff options
| -rw-r--r-- | Cargo.lock | 210 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/lib/client.rs | 22 | ||||
| -rw-r--r-- | test_utils/Cargo.toml | 2 | ||||
| -rw-r--r-- | test_utils/src/lib.rs | 11 |
5 files changed, 165 insertions, 82 deletions
| @@ -499,6 +499,9 @@ name = "bitflags" | |||
| 499 | version = "2.6.0" | 499 | version = "2.6.0" |
| 500 | source = "registry+https://github.com/rust-lang/crates.io-index" | 500 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 501 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" | 501 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" |
| 502 | dependencies = [ | ||
| 503 | "serde", | ||
| 504 | ] | ||
| 502 | 505 | ||
| 503 | [[package]] | 506 | [[package]] |
| 504 | name = "block-buffer" | 507 | name = "block-buffer" |
| @@ -721,6 +724,15 @@ dependencies = [ | |||
| 721 | ] | 724 | ] |
| 722 | 725 | ||
| 723 | [[package]] | 726 | [[package]] |
| 727 | name = "crossbeam-queue" | ||
| 728 | version = "0.3.11" | ||
| 729 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 730 | checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" | ||
| 731 | dependencies = [ | ||
| 732 | "crossbeam-utils", | ||
| 733 | ] | ||
| 734 | |||
| 735 | [[package]] | ||
| 724 | name = "crossbeam-utils" | 736 | name = "crossbeam-utils" |
| 725 | version = "0.8.20" | 737 | version = "0.8.20" |
| 726 | source = "registry+https://github.com/rust-lang/crates.io-index" | 738 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -839,6 +851,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 839 | checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" | 851 | checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" |
| 840 | 852 | ||
| 841 | [[package]] | 853 | [[package]] |
| 854 | name = "doxygen-rs" | ||
| 855 | version = "0.4.2" | ||
| 856 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 857 | checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" | ||
| 858 | dependencies = [ | ||
| 859 | "phf", | ||
| 860 | ] | ||
| 861 | |||
| 862 | [[package]] | ||
| 842 | name = "duplicate" | 863 | name = "duplicate" |
| 843 | version = "1.0.0" | 864 | version = "1.0.0" |
| 844 | source = "registry+https://github.com/rust-lang/crates.io-index" | 865 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -936,18 +957,6 @@ dependencies = [ | |||
| 936 | ] | 957 | ] |
| 937 | 958 | ||
| 938 | [[package]] | 959 | [[package]] |
| 939 | name = "fallible-iterator" | ||
| 940 | version = "0.3.0" | ||
| 941 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 942 | checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" | ||
| 943 | |||
| 944 | [[package]] | ||
| 945 | name = "fallible-streaming-iterator" | ||
| 946 | version = "0.1.9" | ||
| 947 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 948 | checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" | ||
| 949 | |||
| 950 | [[package]] | ||
| 951 | name = "fastrand" | 960 | name = "fastrand" |
| 952 | version = "1.9.0" | 961 | version = "1.9.0" |
| 953 | source = "registry+https://github.com/rust-lang/crates.io-index" | 962 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1205,15 +1214,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1205 | checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" | 1214 | checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" |
| 1206 | 1215 | ||
| 1207 | [[package]] | 1216 | [[package]] |
| 1208 | name = "hashlink" | ||
| 1209 | version = "0.9.1" | ||
| 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1211 | checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" | ||
| 1212 | dependencies = [ | ||
| 1213 | "hashbrown 0.14.5", | ||
| 1214 | ] | ||
| 1215 | |||
| 1216 | [[package]] | ||
| 1217 | name = "heck" | 1217 | name = "heck" |
| 1218 | version = "0.4.1" | 1218 | version = "0.4.1" |
| 1219 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1219 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1226,6 +1226,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1226 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" | 1226 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" |
| 1227 | 1227 | ||
| 1228 | [[package]] | 1228 | [[package]] |
| 1229 | name = "heed" | ||
| 1230 | version = "0.20.5" | ||
| 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1232 | checksum = "7d4f449bab7320c56003d37732a917e18798e2f1709d80263face2b4f9436ddb" | ||
| 1233 | dependencies = [ | ||
| 1234 | "bitflags 2.6.0", | ||
| 1235 | "byteorder", | ||
| 1236 | "heed-traits", | ||
| 1237 | "heed-types", | ||
| 1238 | "libc", | ||
| 1239 | "lmdb-master-sys", | ||
| 1240 | "once_cell", | ||
| 1241 | "page_size", | ||
| 1242 | "synchronoise", | ||
| 1243 | "url", | ||
| 1244 | ] | ||
| 1245 | |||
| 1246 | [[package]] | ||
| 1247 | name = "heed-traits" | ||
| 1248 | version = "0.20.0" | ||
| 1249 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1250 | checksum = "eb3130048d404c57ce5a1ac61a903696e8fcde7e8c2991e9fcfc1f27c3ef74ff" | ||
| 1251 | |||
| 1252 | [[package]] | ||
| 1253 | name = "heed-types" | ||
| 1254 | version = "0.20.1" | ||
| 1255 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1256 | checksum = "9d3f528b053a6d700b2734eabcd0fd49cb8230647aa72958467527b0b7917114" | ||
| 1257 | dependencies = [ | ||
| 1258 | "byteorder", | ||
| 1259 | "heed-traits", | ||
| 1260 | ] | ||
| 1261 | |||
| 1262 | [[package]] | ||
| 1229 | name = "hermit-abi" | 1263 | name = "hermit-abi" |
| 1230 | version = "0.3.9" | 1264 | version = "0.3.9" |
| 1231 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1265 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1545,17 +1579,6 @@ dependencies = [ | |||
| 1545 | ] | 1579 | ] |
| 1546 | 1580 | ||
| 1547 | [[package]] | 1581 | [[package]] |
| 1548 | name = "libsqlite3-sys" | ||
| 1549 | version = "0.28.0" | ||
| 1550 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1551 | checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" | ||
| 1552 | dependencies = [ | ||
| 1553 | "cc", | ||
| 1554 | "pkg-config", | ||
| 1555 | "vcpkg", | ||
| 1556 | ] | ||
| 1557 | |||
| 1558 | [[package]] | ||
| 1559 | name = "libssh2-sys" | 1582 | name = "libssh2-sys" |
| 1560 | version = "0.3.0" | 1583 | version = "0.3.0" |
| 1561 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1584 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1604,6 +1627,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1604 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" | 1627 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" |
| 1605 | 1628 | ||
| 1606 | [[package]] | 1629 | [[package]] |
| 1630 | name = "lmdb-master-sys" | ||
| 1631 | version = "0.2.4" | ||
| 1632 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1633 | checksum = "472c3760e2a8d0f61f322fb36788021bb36d573c502b50fa3e2bcaac3ec326c9" | ||
| 1634 | dependencies = [ | ||
| 1635 | "cc", | ||
| 1636 | "doxygen-rs", | ||
| 1637 | "libc", | ||
| 1638 | ] | ||
| 1639 | |||
| 1640 | [[package]] | ||
| 1607 | name = "lnurl-pay" | 1641 | name = "lnurl-pay" |
| 1608 | version = "0.6.0" | 1642 | version = "0.6.0" |
| 1609 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1643 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1760,9 +1794,9 @@ dependencies = [ | |||
| 1760 | "mockall", | 1794 | "mockall", |
| 1761 | "nostr", | 1795 | "nostr", |
| 1762 | "nostr-database", | 1796 | "nostr-database", |
| 1797 | "nostr-lmdb", | ||
| 1763 | "nostr-sdk", | 1798 | "nostr-sdk", |
| 1764 | "nostr-signer", | 1799 | "nostr-signer", |
| 1765 | "nostr-sqlite", | ||
| 1766 | "once_cell", | 1800 | "once_cell", |
| 1767 | "passwords", | 1801 | "passwords", |
| 1768 | "qrcode", | 1802 | "qrcode", |
| @@ -1851,6 +1885,19 @@ dependencies = [ | |||
| 1851 | ] | 1885 | ] |
| 1852 | 1886 | ||
| 1853 | [[package]] | 1887 | [[package]] |
| 1888 | name = "nostr-lmdb" | ||
| 1889 | version = "0.35.0" | ||
| 1890 | source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" | ||
| 1891 | dependencies = [ | ||
| 1892 | "heed", | ||
| 1893 | "nostr", | ||
| 1894 | "nostr-database", | ||
| 1895 | "thiserror", | ||
| 1896 | "tokio", | ||
| 1897 | "tracing", | ||
| 1898 | ] | ||
| 1899 | |||
| 1900 | [[package]] | ||
| 1854 | name = "nostr-relay-pool" | 1901 | name = "nostr-relay-pool" |
| 1855 | version = "0.35.0" | 1902 | version = "0.35.0" |
| 1856 | source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" | 1903 | source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" |
| @@ -1901,20 +1948,6 @@ dependencies = [ | |||
| 1901 | ] | 1948 | ] |
| 1902 | 1949 | ||
| 1903 | [[package]] | 1950 | [[package]] |
| 1904 | name = "nostr-sqlite" | ||
| 1905 | version = "0.35.0" | ||
| 1906 | source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" | ||
| 1907 | dependencies = [ | ||
| 1908 | "async-trait", | ||
| 1909 | "nostr", | ||
| 1910 | "nostr-database", | ||
| 1911 | "rusqlite", | ||
| 1912 | "thiserror", | ||
| 1913 | "tokio", | ||
| 1914 | "tracing", | ||
| 1915 | ] | ||
| 1916 | |||
| 1917 | [[package]] | ||
| 1918 | name = "nostr-zapper" | 1951 | name = "nostr-zapper" |
| 1919 | version = "0.35.0" | 1952 | version = "0.35.0" |
| 1920 | source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" | 1953 | source = "git+https://github.com/rust-nostr/nostr?rev=4dbfa94#4dbfa94876b136869e2feea75288f0c6a0beaa0e" |
| @@ -2075,6 +2108,16 @@ dependencies = [ | |||
| 2075 | ] | 2108 | ] |
| 2076 | 2109 | ||
| 2077 | [[package]] | 2110 | [[package]] |
| 2111 | name = "page_size" | ||
| 2112 | version = "0.6.0" | ||
| 2113 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2114 | checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" | ||
| 2115 | dependencies = [ | ||
| 2116 | "libc", | ||
| 2117 | "winapi", | ||
| 2118 | ] | ||
| 2119 | |||
| 2120 | [[package]] | ||
| 2078 | name = "parking" | 2121 | name = "parking" |
| 2079 | version = "2.2.1" | 2122 | version = "2.2.1" |
| 2080 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2123 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -2140,6 +2183,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 2140 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" | 2183 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" |
| 2141 | 2184 | ||
| 2142 | [[package]] | 2185 | [[package]] |
| 2186 | name = "phf" | ||
| 2187 | version = "0.11.2" | ||
| 2188 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2189 | checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" | ||
| 2190 | dependencies = [ | ||
| 2191 | "phf_macros", | ||
| 2192 | "phf_shared", | ||
| 2193 | ] | ||
| 2194 | |||
| 2195 | [[package]] | ||
| 2196 | name = "phf_generator" | ||
| 2197 | version = "0.11.2" | ||
| 2198 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2199 | checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" | ||
| 2200 | dependencies = [ | ||
| 2201 | "phf_shared", | ||
| 2202 | "rand", | ||
| 2203 | ] | ||
| 2204 | |||
| 2205 | [[package]] | ||
| 2206 | name = "phf_macros" | ||
| 2207 | version = "0.11.2" | ||
| 2208 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2209 | checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" | ||
| 2210 | dependencies = [ | ||
| 2211 | "phf_generator", | ||
| 2212 | "phf_shared", | ||
| 2213 | "proc-macro2", | ||
| 2214 | "quote", | ||
| 2215 | "syn 2.0.79", | ||
| 2216 | ] | ||
| 2217 | |||
| 2218 | [[package]] | ||
| 2219 | name = "phf_shared" | ||
| 2220 | version = "0.11.2" | ||
| 2221 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2222 | checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" | ||
| 2223 | dependencies = [ | ||
| 2224 | "siphasher", | ||
| 2225 | ] | ||
| 2226 | |||
| 2227 | [[package]] | ||
| 2143 | name = "pin-project" | 2228 | name = "pin-project" |
| 2144 | version = "1.1.5" | 2229 | version = "1.1.5" |
| 2145 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2230 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -2579,20 +2664,6 @@ dependencies = [ | |||
| 2579 | ] | 2664 | ] |
| 2580 | 2665 | ||
| 2581 | [[package]] | 2666 | [[package]] |
| 2582 | name = "rusqlite" | ||
| 2583 | version = "0.31.0" | ||
| 2584 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2585 | checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" | ||
| 2586 | dependencies = [ | ||
| 2587 | "bitflags 2.6.0", | ||
| 2588 | "fallible-iterator", | ||
| 2589 | "fallible-streaming-iterator", | ||
| 2590 | "hashlink", | ||
| 2591 | "libsqlite3-sys", | ||
| 2592 | "smallvec", | ||
| 2593 | ] | ||
| 2594 | |||
| 2595 | [[package]] | ||
| 2596 | name = "rustc-demangle" | 2667 | name = "rustc-demangle" |
| 2597 | version = "0.1.24" | 2668 | version = "0.1.24" |
| 2598 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2669 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -2931,6 +3002,12 @@ dependencies = [ | |||
| 2931 | ] | 3002 | ] |
| 2932 | 3003 | ||
| 2933 | [[package]] | 3004 | [[package]] |
| 3005 | name = "siphasher" | ||
| 3006 | version = "0.3.11" | ||
| 3007 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3008 | checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" | ||
| 3009 | |||
| 3010 | [[package]] | ||
| 2934 | name = "slab" | 3011 | name = "slab" |
| 2935 | version = "0.4.9" | 3012 | version = "0.4.9" |
| 2936 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3013 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -3033,6 +3110,15 @@ dependencies = [ | |||
| 3033 | ] | 3110 | ] |
| 3034 | 3111 | ||
| 3035 | [[package]] | 3112 | [[package]] |
| 3113 | name = "synchronoise" | ||
| 3114 | version = "1.0.1" | ||
| 3115 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3116 | checksum = "3dbc01390fc626ce8d1cffe3376ded2b72a11bb70e1c75f404a210e4daa4def2" | ||
| 3117 | dependencies = [ | ||
| 3118 | "crossbeam-queue", | ||
| 3119 | ] | ||
| 3120 | |||
| 3121 | [[package]] | ||
| 3036 | name = "tempfile" | 3122 | name = "tempfile" |
| 3037 | version = "3.13.0" | 3123 | version = "3.13.0" |
| 3038 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3124 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -3073,8 +3159,8 @@ dependencies = [ | |||
| 3073 | "git2", | 3159 | "git2", |
| 3074 | "nostr", | 3160 | "nostr", |
| 3075 | "nostr-database", | 3161 | "nostr-database", |
| 3162 | "nostr-lmdb", | ||
| 3076 | "nostr-sdk", | 3163 | "nostr-sdk", |
| 3077 | "nostr-sqlite", | ||
| 3078 | "once_cell", | 3164 | "once_cell", |
| 3079 | "rand", | 3165 | "rand", |
| 3080 | "rexpect", | 3166 | "rexpect", |
| @@ -28,7 +28,7 @@ nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | |||
| 28 | nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 28 | nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 29 | nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 29 | nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 30 | nostr-signer = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 30 | nostr-signer = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 31 | nostr-sqlite = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 31 | nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 32 | passwords = "3.1.13" | 32 | passwords = "3.1.13" |
| 33 | qrcode = { version = "0.14.1", default-features = false } | 33 | qrcode = { version = "0.14.1", default-features = false } |
| 34 | scrypt = "0.11.0" | 34 | scrypt = "0.11.0" |
diff --git a/src/lib/client.rs b/src/lib/client.rs index 5f9e996..8a381ab 100644 --- a/src/lib/client.rs +++ b/src/lib/client.rs | |||
| @@ -30,11 +30,11 @@ use indicatif::{MultiProgress, ProgressBar, ProgressDrawTarget, ProgressState, P | |||
| 30 | use mockall::*; | 30 | use mockall::*; |
| 31 | use nostr::{nips::nip01::Coordinate, Event}; | 31 | use nostr::{nips::nip01::Coordinate, Event}; |
| 32 | use nostr_database::NostrDatabase; | 32 | use nostr_database::NostrDatabase; |
| 33 | use nostr_lmdb::NostrLMDB; | ||
| 33 | use nostr_sdk::{ | 34 | use nostr_sdk::{ |
| 34 | prelude::RelayLimits, EventBuilder, EventId, Kind, NostrSigner, Options, PublicKey, | 35 | prelude::RelayLimits, EventBuilder, EventId, Kind, NostrSigner, Options, PublicKey, |
| 35 | SingleLetterTag, Timestamp, Url, | 36 | SingleLetterTag, Timestamp, Url, |
| 36 | }; | 37 | }; |
| 37 | use nostr_sqlite::SQLiteDatabase; | ||
| 38 | 38 | ||
| 39 | use crate::{ | 39 | use crate::{ |
| 40 | get_dirs, | 40 | get_dirs, |
| @@ -157,7 +157,7 @@ impl Connect for Client { | |||
| 157 | .opts(Options::new().relay_limits(RelayLimits::disable())) | 157 | .opts(Options::new().relay_limits(RelayLimits::disable())) |
| 158 | .signer(opts.keys.unwrap_or(nostr::Keys::generate())) | 158 | .signer(opts.keys.unwrap_or(nostr::Keys::generate())) |
| 159 | // .database( | 159 | // .database( |
| 160 | // SQLiteDatabase::open(get_dirs()?.cache_dir().join("nostr-cache.sqlite")). | 160 | // SQLiteDatabase::open(get_dirs()?.cache_dir().join("nostr-cache.lmdb")). |
| 161 | // await?, ) | 161 | // await?, ) |
| 162 | .build(), | 162 | .build(), |
| 163 | fallback_relays: opts.fallback_relays, | 163 | fallback_relays: opts.fallback_relays, |
| @@ -732,23 +732,21 @@ fn pb_after_style(succeed: bool) -> indicatif::ProgressStyle { | |||
| 732 | .unwrap() | 732 | .unwrap() |
| 733 | } | 733 | } |
| 734 | 734 | ||
| 735 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<SQLiteDatabase> { | 735 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { |
| 736 | SQLiteDatabase::open(git_repo_path.join(".git/nostr-cache.sqlite")) | 736 | NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb")) |
| 737 | .await | 737 | .context("cannot open or create nostr cache database at .git/nostr-cache.lmdb") |
| 738 | .context("cannot open or create nostr cache database at .git/nostr-cache.sqlite") | ||
| 739 | } | 738 | } |
| 740 | 739 | ||
| 741 | async fn get_global_cache_database(git_repo_path: &Path) -> Result<SQLiteDatabase> { | 740 | async fn get_global_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { |
| 742 | SQLiteDatabase::open(if std::env::var("NGITTEST").is_err() { | 741 | NostrLMDB::open(if std::env::var("NGITTEST").is_err() { |
| 743 | create_dir_all(get_dirs()?.cache_dir()).context(format!( | 742 | create_dir_all(get_dirs()?.cache_dir()).context(format!( |
| 744 | "cannot create cache directory in: {:?}", | 743 | "cannot create cache directory in: {:?}", |
| 745 | get_dirs()?.cache_dir() | 744 | get_dirs()?.cache_dir() |
| 746 | ))?; | 745 | ))?; |
| 747 | get_dirs()?.cache_dir().join("nostr-cache.sqlite") | 746 | get_dirs()?.cache_dir().join("nostr-cache.lmdb") |
| 748 | } else { | 747 | } else { |
| 749 | git_repo_path.join(".git/test-global-cache.sqlite") | 748 | git_repo_path.join(".git/test-global-cache.lmdb") |
| 750 | }) | 749 | }) |
| 751 | .await | ||
| 752 | .context("cannot open ngit global nostr cache database") | 750 | .context("cannot open ngit global nostr cache database") |
| 753 | } | 751 | } |
| 754 | 752 | ||
| @@ -761,7 +759,7 @@ pub async fn get_events_from_cache( | |||
| 761 | .query(filters.clone()) | 759 | .query(filters.clone()) |
| 762 | .await | 760 | .await |
| 763 | .context( | 761 | .context( |
| 764 | "cannot execute query on opened git repo nostr cache database .git/nostr-cache.sqlite", | 762 | "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", |
| 765 | ) | 763 | ) |
| 766 | } | 764 | } |
| 767 | 765 | ||
diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml index 68484cb..403e478 100644 --- a/test_utils/Cargo.toml +++ b/test_utils/Cargo.toml | |||
| @@ -13,7 +13,7 @@ git2 = "0.19.0" | |||
| 13 | nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 13 | nostr = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 14 | nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 14 | nostr-database = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 15 | nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 15 | nostr-sdk = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 16 | nostr-sqlite = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } | 16 | nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", rev = "4dbfa94" } |
| 17 | once_cell = "1.18.0" | 17 | once_cell = "1.18.0" |
| 18 | rand = "0.8" | 18 | rand = "0.8" |
| 19 | rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" } | 19 | rexpect = { git = "https://github.com/rust-cli/rexpect.git", rev = "9eb61dd" } |
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index f329681..57b0643 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs | |||
| @@ -11,8 +11,8 @@ use futures::executor::block_on; | |||
| 11 | use git::GitTestRepo; | 11 | use git::GitTestRepo; |
| 12 | use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; | 12 | use nostr::{self, nips::nip65::RelayMetadata, Kind, Tag}; |
| 13 | use nostr_database::NostrDatabase; | 13 | use nostr_database::NostrDatabase; |
| 14 | use nostr_lmdb::NostrLMDB; | ||
| 14 | use nostr_sdk::{serde_json, Client, NostrSigner, TagStandard}; | 15 | use nostr_sdk::{serde_json, Client, NostrSigner, TagStandard}; |
| 15 | use nostr_sqlite::SQLiteDatabase; | ||
| 16 | use once_cell::sync::Lazy; | 16 | use once_cell::sync::Lazy; |
| 17 | use rexpect::session::{Options, PtySession}; | 17 | use rexpect::session::{Options, PtySession}; |
| 18 | use strip_ansi_escapes::strip_str; | 18 | use strip_ansi_escapes::strip_str; |
| @@ -1051,10 +1051,9 @@ where | |||
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | /** copied from client.rs */ | 1053 | /** copied from client.rs */ |
| 1054 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<SQLiteDatabase> { | 1054 | async fn get_local_cache_database(git_repo_path: &Path) -> Result<NostrLMDB> { |
| 1055 | SQLiteDatabase::open(git_repo_path.join(".git/nostr-cache.sqlite")) | 1055 | NostrLMDB::open(git_repo_path.join(".git/nostr-cache.lmdb")) |
| 1056 | .await | 1056 | .context("cannot open or create nostr cache database at .git/nostr-cache.lmdb") |
| 1057 | .context("cannot open or create nostr cache database at .git/nostr-cache.sqlite") | ||
| 1058 | } | 1057 | } |
| 1059 | 1058 | ||
| 1060 | /** copied from client.rs */ | 1059 | /** copied from client.rs */ |
| @@ -1067,7 +1066,7 @@ pub async fn get_events_from_cache( | |||
| 1067 | .query(filters.clone()) | 1066 | .query(filters.clone()) |
| 1068 | .await | 1067 | .await |
| 1069 | .context( | 1068 | .context( |
| 1070 | "cannot execute query on opened git repo nostr cache database .git/nostr-cache.sqlite", | 1069 | "cannot execute query on opened git repo nostr cache database .git/nostr-cache.lmdb", |
| 1071 | ) | 1070 | ) |
| 1072 | } | 1071 | } |
| 1073 | 1072 | ||