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 python/cocoindex/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ class GoogleDrive(op.SourceSpec):
_op_category = op.OpCategory.SOURCE

service_account_credential_path: str
root_folder_id: str
root_folder_ids: list[str]
binary: bool = False
12 changes: 7 additions & 5 deletions src/ops/sources/google_drive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ fn is_supported_file_type(mime_type: &str) -> bool {
pub struct Spec {
service_account_credential_path: String,
binary: bool,
root_folder_id: String,
root_folder_ids: Vec<String>,
}

struct Executor {
drive_hub: DriveHub<HttpsConnector<HttpConnector>>,
binary: bool,
root_folder_id: String,
root_folder_ids: Vec<String>,
}

impl Executor {
Expand All @@ -102,7 +102,7 @@ impl Executor {
Ok(Self {
drive_hub,
binary: spec.binary,
root_folder_id: spec.root_folder_id,
root_folder_ids: spec.root_folder_ids,
})
}
}
Expand Down Expand Up @@ -176,8 +176,10 @@ impl Executor {
impl SourceExecutor for Executor {
async fn list_keys(&self) -> Result<Vec<KeyValue>> {
let mut result = IndexSet::new();
self.traverse_folder(&self.root_folder_id, &mut IndexSet::new(), &mut result)
.await?;
for root_folder_id in &self.root_folder_ids {
self.traverse_folder(root_folder_id, &mut IndexSet::new(), &mut result)
.await?;
}
Ok(result.into_iter().collect())
}

Expand Down