Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bot/vikingbot/openviking_mount/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ OpenViking URI 到本地文件路径的映射规则:
OpenViking URI 本地路径
------------------- ------------------
viking://resources/foo -> {mount_point}/resources/foo
viking://session/bar -> {mount_point}/session/bar
viking://user/<uid>/sessions/bar -> {mount_point}/user/<uid>/sessions/bar
viking://user/<uid>/baz -> {mount_point}/user/<uid>/baz
```

Expand Down
5 changes: 3 additions & 2 deletions crates/ragfs/src/core/internal_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ pub fn is_hidden_runtime_lock_name(name: &str) -> bool {
name == PATH_LOCK_FILE || name.starts_with(EXACT_LOCK_FILE_PREFIX)
}

/// Returns `true` when `name` is a hidden runtime lock name.
/// Returns `true` for runtime locks and metadata left by V1 multi-write storage.
pub fn is_hidden_internal_name(name: &str) -> bool {
is_hidden_runtime_lock_name(name)
// V1 metadata can remain during and after migration; never expose it as user data.
is_hidden_runtime_lock_name(name) || matches!(name, ".redirect.json" | ".sync_log.json")
}

/// Returns `true` when a logical path belongs to V2 multi-write internals.
Expand Down
14 changes: 14 additions & 0 deletions crates/ragfs/src/core/mountable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ mod tests {
service_name: "mw-test".to_string(),
initial_partitions: 16,
checkpoint_interval_secs: 86_400,
reconcile_existing_data: false,
provider: "filesystem".to_string(),
items: vec![BackendItemConfig {
name: "backup1".to_string(),
Expand Down Expand Up @@ -2155,6 +2156,8 @@ mod tests {
make_tree_entry("/c", "c", "c", true),
make_tree_entry("/B", "B", "B", true),
make_tree_entry("/.path.ovlock", ".path.ovlock", ".path.ovlock", false),
make_tree_entry("/.sync_log.json", ".sync_log.json", ".sync_log.json", false),
make_tree_entry("/.redirect.json", ".redirect.json", ".redirect.json", false),
],
);
mfs.register_plugin(plugin).await;
Expand All @@ -2170,6 +2173,17 @@ mod tests {

assert_eq!(names, vec!["B", "c", "A.txt", "b.txt"]);

// Upgrade leftovers remain available for migration, but not to business callers.
let internal_names: Vec<String> = mfs
.read_internal_dir("/sorted")
.await
.unwrap()
.into_iter()
.map(|entry| entry.name)
.collect();
assert!(internal_names.iter().any(|name| name == ".sync_log.json"));
assert!(internal_names.iter().any(|name| name == ".redirect.json"));

let page: Vec<String> = mfs
.read_dir(
"/sorted",
Expand Down
9 changes: 9 additions & 0 deletions crates/ragfs/src/core/multibackend_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct MultiWriteWrappedFSBuilder {
metadata_provider: Option<Arc<dyn MultiWriteProvider>>,
initial_partitions: u32,
checkpoint_interval: Duration,
reconcile_existing_data: bool,
ctx_resolver: Arc<dyn FsContextResolver>,
}

Expand Down Expand Up @@ -110,6 +111,12 @@ impl MultiWriteWrappedFSBuilder {
self
}

/// Set whether startup should reconcile existing primary data into V2 metadata.
pub fn reconcile_existing_data(mut self, reconcile_existing_data: bool) -> Self {
self.reconcile_existing_data = reconcile_existing_data;
self
}

/// Configure the resolver for mount-relative foreground paths.
pub fn ctx_resolver(mut self, ctx_resolver: Arc<dyn FsContextResolver>) -> Self {
self.ctx_resolver = ctx_resolver;
Expand Down Expand Up @@ -210,6 +217,7 @@ impl MultiWriteWrappedFSBuilder {
metadata_provider,
self.initial_partitions,
backup_names,
self.reconcile_existing_data,
);
fs.inner.runtime.set_import_worker(async move {
let result = importer.run().await;
Expand All @@ -234,6 +242,7 @@ impl MultiWriteWrappedFS {
metadata_provider: None,
initial_partitions: 16,
checkpoint_interval: Duration::from_secs(86_400),
reconcile_existing_data: false,
ctx_resolver: Arc::new(DefaultFsContextResolver),
}
}
Expand Down
3 changes: 3 additions & 0 deletions crates/ragfs/src/core/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,9 @@ pub struct BackendsConfig {
/// Checkpoint interval in seconds.
#[serde(default = "default_checkpoint_interval_secs")]
pub checkpoint_interval_secs: u64,
/// Whether to scan existing primary data and reconcile it into V2 metadata.
#[serde(default)]
pub reconcile_existing_data: bool,
/// Metadata storage provider.
#[serde(default = "default_backups_provider")]
pub provider: String,
Expand Down
1 change: 1 addition & 0 deletions crates/ragfs/src/git/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6663,6 +6663,7 @@ mod fast_path1_tests {
service_name: "mw-test".to_string(),
initial_partitions: 16,
checkpoint_interval_secs: 86_400,
reconcile_existing_data: false,
provider: "filesystem".to_string(),
items: vec![BackendItemConfig {
name: "backup1".to_string(),
Expand Down
Loading