fetch cache pp imporved

This commit is contained in:
2026-02-11 10:07:24 +08:00
parent 6e135b9d7a
commit 2a6a963ecd
36 changed files with 3201 additions and 265 deletions

View File

@@ -1,7 +1,7 @@
use rpki::storage::{RocksStore, VerifiedKey};
use rpki::storage::{FetchCachePpKey, RocksStore};
#[test]
fn storage_iter_all_lists_raw_and_verified_entries() {
fn storage_iter_all_lists_raw_and_fetch_cache_pp_entries() {
let temp = tempfile::tempdir().expect("tempdir");
let store = RocksStore::open(temp.path()).expect("open rocksdb");
@@ -12,8 +12,10 @@ fn storage_iter_all_lists_raw_and_verified_entries() {
.put_raw("rsync://example.test/repo/b.roa", b"b")
.expect("put_raw b");
let key = VerifiedKey::from_manifest_rsync_uri("rsync://example.test/repo/m.mft");
store.put_verified(&key, b"x").expect("put_verified");
let key = FetchCachePpKey::from_manifest_rsync_uri("rsync://example.test/repo/m.mft");
store
.put_fetch_cache_pp(&key, b"x")
.expect("put_fetch_cache_pp");
let raw_keys = store
.raw_iter_all()
@@ -24,10 +26,10 @@ fn storage_iter_all_lists_raw_and_verified_entries() {
assert!(raw_keys.contains(&"rsync://example.test/repo/a.cer".to_string()));
assert!(raw_keys.contains(&"rsync://example.test/repo/b.roa".to_string()));
let verified_keys = store
.verified_iter_all()
.expect("verified_iter_all")
let keys = store
.fetch_cache_pp_iter_all()
.expect("fetch_cache_pp_iter_all")
.map(|(k, _v)| String::from_utf8(k.to_vec()).expect("utf8 key"))
.collect::<Vec<_>>();
assert_eq!(verified_keys, vec![key.as_str().to_string()]);
assert_eq!(keys, vec![key.as_str().to_string()]);
}