sqlite_vtable_opendal/backends/mod.rs
1//! Storage backend implementations
2//!
3//! This module defines the trait that all storage backends must implement,
4//! and provides implementations for various cloud storage providers.
5
6use crate::error::Result;
7use crate::types::{FileMetadata, QueryConfig};
8use async_trait::async_trait;
9
10/// Trait that all storage backends must implement
11///
12/// This trait provides a common interface for listing files from different
13/// storage backends (Dropbox, S3, local filesystem, etc.).
14///
15/// Backend implementations handle the specifics of connecting to storage
16/// and converting OpenDAL entries to our FileMetadata structure.
17#[async_trait]
18pub trait StorageBackend: Send + Sync {
19 /// List files from the storage backend according to the query configuration
20 ///
21 /// # Arguments
22 ///
23 /// * `config` - Configuration controlling what to fetch and how
24 ///
25 /// # Returns
26 ///
27 /// A vector of FileMetadata entries
28 ///
29 /// # Errors
30 ///
31 /// Returns an error if the backend fails to list files or if credentials are invalid
32 async fn list_files(&self, config: &QueryConfig) -> Result<Vec<FileMetadata>>;
33
34 /// Get the name of this backend (for logging/debugging)
35 fn backend_name(&self) -> &'static str;
36}
37
38// Backend implementations
39pub mod local_fs;
40pub mod dropbox;
41pub mod s3;
42pub mod gdrive;
43pub mod postgresql;
44pub mod http;