1- From a4c71309ddb76ad79808e3e8f7797bcd9bfc174a Mon Sep 17 00:00:00 2001
1+ From cc373477a6485cb24ed7ea88ef506e93caacedd0 Mon Sep 17 00:00:00 2001
22From: zhangstar333 <
[email protected] >
33Date: Thu, 3 Sep 2026 13:00:43 +0800
44Subject: [PATCH] foyer
55
66---
7- Cargo.lock | 205 ++++++
7+ Cargo.lock | 207 +++++-
88 Cargo.toml | 4 +
99 README.md | 22 +
1010 include/lance/lance.h | 63 ++
@@ -19,32 +19,28 @@ Subject: [PATCH] foyer
1919 tests/c_api_test.rs | 221 +++++++
2020 tests/cpp/test_c_api.c | 32 +
2121 tests/cpp/test_cpp_api.cpp | 23 +
22- 15 files changed, 1918 insertions(+), 1 deletion (-)
22+ 15 files changed, 1917 insertions(+), 4 deletions (-)
2323 create mode 100644 src/data_cache.rs
2424 create mode 100644 src/foyer_data_cache.rs
2525
2626diff --git a/Cargo.lock b/Cargo.lock
27- index 60c1caf..85536f5 100644
27+ index bc37cb9..199f997 100644
2828--- a/Cargo.lock
2929+++ b/Cargo.lock
30- @@ -434 ,6 +434,16 @@ dependencies = [
31- "loom ",
30+ @@ -444 ,6 +444,12 @@ dependencies = [
31+ "slab ",
3232 ]
3333
3434+ [[package]]
3535+ name = "asyncband"
36- + version = "0.6.7 "
36+ + version = "0.7.1 "
3737+ source = "registry+https://github.com/rust-lang/crates.io-index"
38- + checksum = "94a214ba60d6231afd0e805e3c27c45a1626d9debaa5a5061c45a1ea1b2f1ed0"
39- + dependencies = [
40- + "hashbrown 0.17.1",
41- + "slab",
42- + ]
38+ + checksum = "2e52766975a4f080528a898235c51e82e65df9db713419067b5368040eeb5659"
4339+
4440 [[package]]
4541 name = "atoi"
4642 version = "2.0.0"
47- @@ -1267 ,6 +1277 ,17 @@ version = "0.8.7"
43+ @@ -1293 ,6 +1299 ,17 @@ version = "0.8.7"
4844 source = "registry+https://github.com/rust-lang/crates.io-index"
4945 checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
5046
@@ -62,7 +58,7 @@ index 60c1caf..85536f5 100644
6258 [[package]]
6359 name = "countio"
6460 version = "0.3.0"
65- @@ -2112 ,6 +2133 ,12 @@ dependencies = [
61+ @@ -2148 ,6 +2165 ,12 @@ dependencies = [
6662 "url",
6763 ]
6864
@@ -73,9 +69,9 @@ index 60c1caf..85536f5 100644
7369+ checksum = "46c4cf71a36b46dcfc00e5014c0c20ccad2b1b6a008304d7d57d2749b2d41b3d"
7470+
7571 [[package]]
76- name = "der "
77- version = "0.7.10 "
78- @@ -2298 ,6 +2325 ,16 @@ version = "0.2.3"
72+ name = "defmt "
73+ version = "1.1.1 "
74+ @@ -2366 ,6 +2389 ,16 @@ version = "0.2.3"
7975 source = "registry+https://github.com/rust-lang/crates.io-index"
8076 checksum = "f8eb564c5c7423d25c886fb561d1e4ee69f72354d16918afa32c08811f6b6a55"
8177
@@ -92,18 +88,18 @@ index 60c1caf..85536f5 100644
9288 [[package]]
9389 name = "fastrand"
9490 version = "2.3.0"
95- @@ -2369,6 +2406,127 @@ dependencies = [
91+ @@ -2437,12 +2470,133 @@ dependencies = [
9692 "percent-encoding",
9793 ]
9894
9995+ [[package]]
10096+ name = "foyer"
101- + version = "0.22.4 "
97+ + version = "0.22.5 "
10298+ source = "registry+https://github.com/rust-lang/crates.io-index"
103- + checksum = "cab5c4bac30455a0dbc4c858436fb440d51bc6543daafbdf35c5e6ca94c0afd7 "
99+ + checksum = "f911e6f0b4909f23d65a95c5d27bcf2f92855b8a0f629b47b743d53d14f2828b "
104100+ dependencies = [
105101+ "anyhow",
106- + "asyncband",
102+ + "asyncband 0.7.1 ",
107103+ "equivalent",
108104+ "foyer-common",
109105+ "foyer-memory",
@@ -118,9 +114,9 @@ index 60c1caf..85536f5 100644
118114+
119115+ [[package]]
120116+ name = "foyer-common"
121- + version = "0.22.4 "
117+ + version = "0.22.5 "
122118+ source = "registry+https://github.com/rust-lang/crates.io-index"
123- + checksum = "e3634c6f3da978b6cae98d54367a2342041d3a4786b20c0384164cc7fce94787 "
119+ + checksum = "05cdcae6cedec72c28e97ada0b453e33b1df57fbc209708091107be2a283d577 "
124120+ dependencies = [
125121+ "anyhow",
126122+ "bytes",
@@ -143,13 +139,13 @@ index 60c1caf..85536f5 100644
143139+
144140+ [[package]]
145141+ name = "foyer-memory"
146- + version = "0.22.4 "
142+ + version = "0.22.5 "
147143+ source = "registry+https://github.com/rust-lang/crates.io-index"
148- + checksum = "5349a61af676b3275bfef7a5fceceeadf6b0a7dd9ec14ba0edd78e1ff771d101 "
144+ + checksum = "8a51c8ce8e1e323a1e087ac45bf629d953676fc5e0037d14a799fadd272b42db "
149145+ dependencies = [
150146+ "anyhow",
151- + "asyncband",
152- + "bitflags",
147+ + "asyncband 0.7.1 ",
148+ + "bitflags 2.11.0 ",
153149+ "datasketches",
154150+ "equivalent",
155151+ "foyer-common",
@@ -168,13 +164,13 @@ index 60c1caf..85536f5 100644
168164+
169165+ [[package]]
170166+ name = "foyer-storage"
171- + version = "0.22.4 "
167+ + version = "0.22.5 "
172168+ source = "registry+https://github.com/rust-lang/crates.io-index"
173- + checksum = "49cfcce3c10a1f2ac65bfcf0bd85501462d454c594c8a16a4a27cce773599381 "
169+ + checksum = "127a64057f63e361123cf62b3fd50a36147783687d4cd36e7087c27f9909265b "
174170+ dependencies = [
175171+ "allocator-api2",
176172+ "anyhow",
177- + "asyncband",
173+ + "asyncband 0.7.1 ",
178174+ "bytes",
179175+ "core_affinity",
180176+ "equivalent",
@@ -200,13 +196,19 @@ index 60c1caf..85536f5 100644
200196+
201197+ [[package]]
202198+ name = "foyer-tokio"
203- + version = "0.22.4 "
199+ + version = "0.22.5 "
204200+ source = "registry+https://github.com/rust-lang/crates.io-index"
205- + checksum = "6b7315103199f3415a010befd6dd5a1c8e7082fbc49c0194931e65629995d9d1 "
201+ + checksum = "cbdbb9f39443cb348a069baa1a0ec73bcea848a4a383eb2da1a5ea7a0ca05941 "
206202+ dependencies = [
207203+ "tokio",
208204+ ]
209205+
206+ [[package]]
207+ name = "frostem"
208+ version = "1.20260821.5"
209+ source = "registry+https://github.com/rust-lang/crates.io-index"
210+ checksum = "36a80a7406da302e04bfd2ca987907590d3a1f3c69958947c43890abd7426b2f"
211+
210212+ [[package]]
211213+ name = "fs4"
212214+ version = "0.13.1"
@@ -220,7 +222,7 @@ index 60c1caf..85536f5 100644
220222 [[package]]
221223 name = "fs_extra"
222224 version = "1.3.0"
223- @@ -3392 ,6 +3550 ,15 @@ dependencies = [
225+ @@ -3485 ,6 +3639 ,15 @@ dependencies = [
224226 "either",
225227 ]
226228
@@ -236,7 +238,7 @@ index 60c1caf..85536f5 100644
236238 [[package]]
237239 name = "itoa"
238240 version = "1.0.18"
239- @@ -3703 ,8 +3870 ,11 @@ dependencies = [
241+ @@ -3788 ,8 +3951 ,11 @@ dependencies = [
240242 "arrow",
241243 "arrow-array",
242244 "arrow-schema",
@@ -248,17 +250,17 @@ index 60c1caf..85536f5 100644
248250 "futures",
249251 "half",
250252 "lance",
251- @@ -3718 ,6 +3888 ,7 @@ dependencies = [
253+ @@ -3803 ,6 +3969 ,7 @@ dependencies = [
252254 "lance-table",
253255 "libc",
254256 "log",
255257+ "object_store",
256258 "pin-project",
257259 "prost",
258260 "snafu",
259- @@ -4399 ,6 +4570 ,15 @@ version = "2.8.0"
260- source = "registry+https://github.com/rust-lang/crates.io-index"
261- checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
261+ @@ -4492 ,6 +4659 ,15 @@ dependencies = [
262+ "libc",
263+ ]
262264
263265+ [[package]]
264266+ name = "memoffset"
@@ -272,7 +274,7 @@ index 60c1caf..85536f5 100644
272274 [[package]]
273275 name = "mime"
274276 version = "0.3.17"
275- @@ -4436 ,6 +4616 ,16 @@ dependencies = [
277+ @@ -4529 ,6 +4705 ,16 @@ dependencies = [
276278 "windows-sys 0.61.2",
277279 ]
278280
@@ -289,7 +291,34 @@ index 60c1caf..85536f5 100644
289291 [[package]]
290292 name = "moka"
291293 version = "0.12.15"
292- @@ -6547,6 +6737,12 @@ version = "0.4.12"
294+ @@ -4840,7 +5026,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
295+ checksum = "48dbcef97d3eb7591db2c18d5cae95c836bcce07359b98d98dd6f4e861eb77b7"
296+ dependencies = [
297+ "anyhow",
298+ - "asyncband",
299+ + "asyncband 0.6.7",
300+ "base64 0.23.1",
301+ "bytes",
302+ "futures",
303+ @@ -4879,7 +5065,7 @@ version = "0.58.2"
304+ source = "registry+https://github.com/rust-lang/crates.io-index"
305+ checksum = "03f9e144b5228d741c3763ade8711d9b72e5fb6d998e779f2d7a09da0b5a3eba"
306+ dependencies = [
307+ - "asyncband",
308+ + "asyncband 0.6.7",
309+ "futures",
310+ "http 1.4.0",
311+ "opendal-core",
312+ @@ -4943,7 +5129,7 @@ version = "0.58.2"
313+ source = "registry+https://github.com/rust-lang/crates.io-index"
314+ checksum = "2d564484a8f7d091827e825cfc91ed45bd48e64d262451ee041fe843db81bd8a"
315+ dependencies = [
316+ - "asyncband",
317+ + "asyncband 0.6.7",
318+ "base64 0.23.1",
319+ "bytes",
320+ "http 1.4.0",
321+ @@ -6668,6 +6854,12 @@ version = "0.4.12"
293322 source = "registry+https://github.com/rust-lang/crates.io-index"
294323 checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
295324
@@ -302,7 +331,7 @@ index 60c1caf..85536f5 100644
302331 [[package]]
303332 name = "smallvec"
304333 version = "1.15.1"
305- @@ -7831 ,6 +8027 ,15 @@ dependencies = [
334+ @@ -7930 ,6 +8122 ,15 @@ dependencies = [
306335 "windows-targets 0.52.6",
307336 ]
308337
@@ -319,7 +348,7 @@ index 60c1caf..85536f5 100644
319348 name = "windows-sys"
320349 version = "0.60.2"
321350diff --git a/Cargo.toml b/Cargo.toml
322- index d072a5d..342928c 100644
351+ index 3920a65..356c9dd 100644
323352--- a/Cargo.toml
324353+++ b/Cargo.toml
325354@@ -30,6 +30,8 @@ datafusion = { version = "54.0.0", default-features = false }
@@ -335,7 +364,7 @@ index d072a5d..342928c 100644
335364 half = "2"
336365 tokio = { version = "1", features = ["rt-multi-thread", "sync"] }
337366 futures = "0.3"
338- + foyer = "=0.22.4 "
367+ + foyer = "=0.22.5 "
339368 log = "0.4"
340369 libc = "0.2"
341370+ object_store = "0.13.2"
@@ -383,7 +412,7 @@ index 2056671..d9a5f2b 100644
383412
384413 `lance_dataset_open` takes a `version` argument — `0` means the latest, any
385414diff --git a/include/lance/lance.h b/include/lance/lance.h
386- index 3bf291f..e4c593e 100644
415+ index 31213da..152351b 100644
387416--- a/include/lance/lance.h
388417+++ b/include/lance/lance.h
389418@@ -206,6 +206,36 @@ typedef struct LanceSessionCacheStats {
@@ -471,10 +500,10 @@ index 3bf291f..e4c593e 100644
471500 void lance_dataset_close(LanceDataset* dataset);
472501
473502diff --git a/include/lance/lance.hpp b/include/lance/lance.hpp
474- index 6cf245f..c1102e4 100644
503+ index 404d2df..3fe9dbc 100644
475504--- a/include/lance/lance.hpp
476505+++ b/include/lance/lance.hpp
477- @@ -171 ,6 +171 ,13 @@ struct SqlColumn {
506+ @@ -176 ,6 +176 ,13 @@ struct SqlColumn {
478507
479508 // ─── Shared Session ──────────────────────────────────────────────────────────
480509
@@ -488,7 +517,7 @@ index 6cf245f..c1102e4 100644
488517 class Session {
489518 Handle<LanceSession, lance_session_close> handle_;
490519
491- @@ -180 ,6 +187 ,21 @@ class Session {
520+ @@ -185 ,6 +192 ,21 @@ class Session {
492521 if (!handle_) check_error();
493522 }
494523
@@ -510,7 +539,7 @@ index 6cf245f..c1102e4 100644
510539 LanceSessionCacheStats cache_stats() const {
511540 LanceSessionCacheStats stats{};
512541 if (lance_session_get_cache_stats(handle_.get(), &stats) != 0)
513- @@ -260 ,6 +282 ,13 @@ class Dataset {
542+ @@ -265 ,6 +287 ,13 @@ class Dataset {
514543 return Dataset(ds);
515544 }
516545
@@ -1975,7 +2004,7 @@ index 1971510..ba51c87 100644
19752004 // SAFETY: `out_dataset` is non-NULL (checked above) and the caller
19762005 // guarantees it points to caller-owned, writable storage of size
19772006diff --git a/tests/c_api_test.rs b/tests/c_api_test.rs
1978- index 8805764..b4313f4 100644
2007+ index bde742d..a4ea8f8 100644
19792008--- a/tests/c_api_test.rs
19802009+++ b/tests/c_api_test.rs
19812010@@ -96,10 +96,83 @@ fn create_large_dataset(num_rows: i32) -> (tempfile::TempDir, String) {
@@ -2183,7 +2212,7 @@ index 8805764..b4313f4 100644
21832212 #[test]
21842213 fn test_open_nonexistent() {
21852214 let c_uri = c_str("memory://nonexistent_dataset_xyz");
2186- @@ -2787 ,6 +2974 ,40 @@ fn test_dataset_restore_to_prior_version() {
2215+ @@ -2977 ,6 +3164 ,40 @@ fn test_dataset_restore_to_prior_version() {
21872216 unsafe { lance_dataset_close(ds) };
21882217 }
21892218
@@ -2275,7 +2304,7 @@ index c49ecfa..dd674eb 100644
22752304 test_scan_with_limit(uri);
22762305 test_versions(uri);
22772306diff --git a/tests/cpp/test_cpp_api.cpp b/tests/cpp/test_cpp_api.cpp
2278- index 17b1ab6..e1aadbd 100644
2307+ index 28762b8..5f34bde 100644
22792308--- a/tests/cpp/test_cpp_api.cpp
22802309+++ b/tests/cpp/test_cpp_api.cpp
22812310@@ -99,6 +99,28 @@ static void test_shared_session(const std::string& uri) {
@@ -2307,7 +2336,7 @@ index 17b1ab6..e1aadbd 100644
23072336 static void test_dataset_schema(const std::string& uri) {
23082337 TEST(test_dataset_schema);
23092338
2310- @@ -922 ,6 +944 ,7 @@ int main(int argc, char** argv) {
2339+ @@ -929 ,6 +951 ,7 @@ int main(int argc, char** argv) {
23112340
23122341 test_dataset_open(uri);
23132342 test_shared_session(uri);
0 commit comments