Skip to content

Update OpenDAL integration for 0.55+ (Scheme enum removed) #442

@mro68

Description

@mro68

Problem

OpenDAL 0.55.0+ removed the Scheme enum from its public API. The current rustic_backend implementation in crates/backend/src/opendal.rs uses Scheme::from_str(), which causes compilation errors with newer OpenDAL versions.

Current error:

error[E0432]: unresolved import `opendal::Scheme`
 --> crates/backend/src/opendal.rs:8:5
  |
8 |     Scheme,
  |     ^^^^^^ no `Scheme` in the root

Root Cause

OpenDAL changed its API in 0.55.0:

  • Old API (0.54.x): Operator::via_iter(Scheme::from_str(path)?, options)
  • New API (0.55.x): Operator::via_iter(scheme_string, options) - accepts &str directly

Solution

Update crates/backend/src/opendal.rs to extract the scheme string directly from the path instead of using the removed Scheme enum:

-use opendal::{
-    Scheme,
-    blocking::Operator,
-    layers::{ConcurrentLimitLayer, LoggingLayer, RetryLayer, ThrottleLayer},
-    options::{ListOptions, ReadOptions},
-};
+use opendal::{
+    blocking::Operator,
+    layers::{ConcurrentLimitLayer, LoggingLayer, RetryLayer, ThrottleLayer},
+    options::{ListOptions, ReadOptions},
+};
-        let schema = Scheme::from_str(path.as_ref()).map_err(|err| {
-            RusticError::with_source(
-                ErrorKind::InvalidInput,
-                "Parsing scheme from path `{path}` failed, the path must contain a valid scheme.",
-                err,
-            )
-            .attach_context("path", path.as_ref().to_string())
-        })?;
-        let mut operator = opendal::Operator::via_iter(schema, options)
+        let scheme = path
+            .as_ref()
+            .split(':')
+            .next()
+            .unwrap_or(path.as_ref());
+
+        let mut operator = opendal::Operator::via_iter(scheme, options)
             .map_err(|err| {
                 RusticError::with_source(
                     ErrorKind::Backend,
                     "Creating Operator from path `{path}` failed. Please check the given schema and options.",
                     err,
                 )
                 .attach_context("path", path.as_ref().to_string())
-                .attach_context("schema", schema.to_string())
+                .attach_context("schema", scheme.to_string())
             })?

Timeline & Dependencies

  1. OpenDAL PR merged: fix(services/gdrive): include size and modifiedTime in list() metadata apache/opendal#7058 (fixes Google Drive metadata in list operations)
  2. OpenDAL release: Waiting for 0.55.1 or 0.56.0 release
  3. rustic_backend update needed: After OpenDAL release, update dependency and apply this fix

Testing

The fix has been tested locally with:

  • OpenDAL 0.55.0 from the fix branch
  • Google Drive backend (backup/repoinfo/check operations successful)
  • No regressions in other backends expected (change is minimal and follows OpenDAL's new API)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-triageStatus: Waiting for a maintainer to triage this issue/PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions