Merge branch 'master' into android-bundled-face-models
This commit is contained in:
+22
-22
@@ -26,7 +26,7 @@ use std::sync::mpsc::{Receiver, Sender};
|
||||
|
||||
use dr_catalog::{Catalog, JobKind, Priority};
|
||||
use dr_sync::{RemoteBackend, RemoteId, RemotePath};
|
||||
use dr_sync_nextcloud::{AppCredentials, NextcloudBackend};
|
||||
use dr_sync_nextcloud::AppCredentials;
|
||||
use dr_thumbs::ThumbStore;
|
||||
|
||||
use crate::sidecar_cache::SidecarCache;
|
||||
@@ -541,11 +541,11 @@ pub fn spawn_sidecar_writes(
|
||||
let report = match rt {
|
||||
None => queue_all(),
|
||||
Some(rt) => rt.block_on(async {
|
||||
match NextcloudBackend::new(&creds, &user_id) {
|
||||
match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => {
|
||||
let mut report = SidecarReport::default();
|
||||
for w in &writes {
|
||||
match write_one_sidecar_online(&b, &cache, w).await {
|
||||
match write_one_sidecar_online(&*b, &cache, w).await {
|
||||
Ok(Outcome::Uploaded) => report.written += 1,
|
||||
Ok(Outcome::Queued) => report.queued += 1,
|
||||
Err(e) => {
|
||||
@@ -707,7 +707,7 @@ fn write_one_sidecar(cache: &SidecarCache, w: &SidecarWrite) -> Result<Outcome,
|
||||
/// TRACES: FR-CAT-8 | FR-CAT-9
|
||||
/// Read-modify-write one sidecar, with a server to read from and send to.
|
||||
async fn write_one_sidecar_online(
|
||||
backend: &NextcloudBackend,
|
||||
backend: &dyn RemoteBackend,
|
||||
cache: &SidecarCache,
|
||||
w: &SidecarWrite,
|
||||
) -> Result<Outcome, String> {
|
||||
@@ -810,7 +810,7 @@ pub fn spawn_outbox_drain(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = match NextcloudBackend::new(&creds, &user_id) {
|
||||
let backend = match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
let _ = tx.send(SidecarMessage::Finished {
|
||||
@@ -825,7 +825,7 @@ pub fn spawn_outbox_drain(
|
||||
|
||||
let mut report = SidecarReport::default();
|
||||
for path_str in &queued {
|
||||
match drain_one(&backend, &cache, path_str).await {
|
||||
match drain_one(&*backend, &cache, path_str).await {
|
||||
Ok(()) => report.written += 1,
|
||||
Err(e) => {
|
||||
// Warn, for the reason the write path does: this is
|
||||
@@ -854,7 +854,7 @@ pub fn spawn_outbox_drain(
|
||||
|
||||
/// Reconcile one queued sidecar with the server and upload it.
|
||||
async fn drain_one(
|
||||
backend: &NextcloudBackend,
|
||||
backend: &dyn RemoteBackend,
|
||||
cache: &SidecarCache,
|
||||
path_str: &str,
|
||||
) -> Result<(), String> {
|
||||
@@ -1100,14 +1100,14 @@ fn run_scan(
|
||||
let rt = crate::net_runtime::build().map_err(ScanFailure::local)?;
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = NextcloudBackend::new(&creds, &user_id).map_err(ScanFailure::local)?;
|
||||
let backend = crate::remote::connect(&creds, &user_id).map_err(ScanFailure::local)?;
|
||||
|
||||
// Stored folder ETags, so an unchanged subtree is skipped whole. On a
|
||||
// first run this is empty and the walk is complete; on every run after
|
||||
// it is what keeps cost proportional to what changed (ARCH §8.4).
|
||||
let known = load_folder_etags(&catalog, &root);
|
||||
|
||||
let result = dr_sync::scan(&backend, &RemotePath::new(&root), &filter, &known, |p| {
|
||||
let result = dr_sync::scan(&*backend, &RemotePath::new(&root), &filter, &known, |p| {
|
||||
let _ = tx.send(ScanMessage::Progress {
|
||||
directories: p.directories_listed,
|
||||
pruned: p.directories_pruned,
|
||||
@@ -1446,7 +1446,7 @@ pub fn spawn_pin_fetch(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = match NextcloudBackend::new(&creds, &user_id) {
|
||||
let backend = match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
let _ = tx.send(PinMessage::Failed {
|
||||
@@ -1635,7 +1635,7 @@ pub fn spawn_sidecar_fetch(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = match NextcloudBackend::new(&creds, &user_id) {
|
||||
let backend = match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
log::debug!("sidecar fetch backend: {e}");
|
||||
@@ -1723,7 +1723,7 @@ pub fn spawn_full_fetch(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = match NextcloudBackend::new(&creds, &user_id) {
|
||||
let backend = match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
let _ = tx.send(Err(FetchFailure::local(e)));
|
||||
@@ -1873,7 +1873,7 @@ pub fn spawn_thumbnails(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = match NextcloudBackend::new(&creds, &user_id) {
|
||||
let backend = match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
for req in &to_fetch {
|
||||
@@ -1898,7 +1898,7 @@ pub fn spawn_thumbnails(
|
||||
let mut offline = false;
|
||||
|
||||
for req in to_fetch {
|
||||
let msg = fetch_one(&backend, store.as_mut(), &req, &mut found).await;
|
||||
let msg = fetch_one(&*backend, store.as_mut(), &req, &mut found).await;
|
||||
offline = matches!(msg, ThumbnailMessage::Offline { .. });
|
||||
// A closed channel means the window went away mid-fetch.
|
||||
if tx.send(msg).is_err() || offline {
|
||||
@@ -1923,7 +1923,7 @@ pub fn spawn_thumbnails(
|
||||
if tx.send(ThumbnailMessage::DateProgress).is_err() {
|
||||
break;
|
||||
}
|
||||
read_metadata_only(&backend, &req, &mut found).await;
|
||||
read_metadata_only(&*backend, &req, &mut found).await;
|
||||
|
||||
if found.len() >= FLUSH_EVERY {
|
||||
flush_metadata(&catalog_path, &mut found, &tx);
|
||||
@@ -1942,7 +1942,7 @@ pub fn spawn_thumbnails(
|
||||
}
|
||||
|
||||
async fn fetch_one(
|
||||
backend: &NextcloudBackend,
|
||||
backend: &dyn RemoteBackend,
|
||||
store: Option<&mut ThumbStore>,
|
||||
req: &ThumbnailRequest,
|
||||
found_metadata: &mut Vec<MetadataFound>,
|
||||
@@ -1999,7 +1999,7 @@ enum PreviewOutcome {
|
||||
/// the embedded JPEG partway through, and decoders render a truncated JPEG as
|
||||
/// the top fraction of the frame rather than reporting an error.
|
||||
async fn fetch_preview(
|
||||
backend: &NextcloudBackend,
|
||||
backend: &dyn RemoteBackend,
|
||||
req: &ThumbnailRequest,
|
||||
found_metadata: &mut Vec<MetadataFound>,
|
||||
) -> PreviewOutcome {
|
||||
@@ -2219,7 +2219,7 @@ fn flush_metadata(
|
||||
/// happened both leave `found` untouched, and recording the second as "this
|
||||
/// image has no date" would let one lock mark it dateless for good.
|
||||
async fn read_metadata_only(
|
||||
backend: &NextcloudBackend,
|
||||
backend: &dyn RemoteBackend,
|
||||
req: &ThumbnailRequest,
|
||||
found: &mut Vec<MetadataFound>,
|
||||
) -> bool {
|
||||
@@ -2444,7 +2444,7 @@ pub fn spawn_sweep(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let Ok(backend) = NextcloudBackend::new(&creds, &user_id) else {
|
||||
let Ok(backend) = crate::remote::connect(&creds, &user_id) else {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -2483,7 +2483,7 @@ pub fn spawn_sweep(
|
||||
.collect();
|
||||
|
||||
let results = futures_join_all(lanes.into_iter().map(|lane| {
|
||||
let backend = &backend;
|
||||
let backend: &dyn RemoteBackend = &*backend;
|
||||
async move {
|
||||
let mut found = Vec::new();
|
||||
let mut reached = Vec::new();
|
||||
@@ -3213,7 +3213,7 @@ pub fn spawn_thumbnail_sweep(
|
||||
};
|
||||
|
||||
rt.block_on(async {
|
||||
let backend = match NextcloudBackend::new(&creds, &user_id) {
|
||||
let backend = match crate::remote::connect(&creds, &user_id) {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
log::warn!("thumbnail sweep: {e}");
|
||||
@@ -3235,7 +3235,7 @@ pub fn spawn_thumbnail_sweep(
|
||||
.collect();
|
||||
|
||||
let results = futures_join_all(lanes.into_iter().map(|lane| {
|
||||
let backend = &backend;
|
||||
let backend: &dyn RemoteBackend = &*backend;
|
||||
async move {
|
||||
let mut made: Vec<(u64, dr_thumbs::Thumbnail)> = Vec::new();
|
||||
let mut found = Vec::new();
|
||||
|
||||
Reference in New Issue
Block a user