Add fresh read variants that await a server round-trip (closes #75)
check / check (push) Successful in 24s
check / check (push) Successful in 24s
Owner amendment to design #36: alongside the default reads, which answer from RAM and refresh in the background, `Library.fresh()` forces a refresh, awaits it, and only then hands back the albums/photos/timeline namespaces, so a caller (the CLI, in #52) gets server-current data. The background loop and the default reads are unchanged. Both paths now share one in-flight-cycle slot: the loop skips when a cycle runs and swallows its errors as before; a fresh read coalesces onto that cycle or starts one, and propagates a failure so a refresh that could not complete rejects the caller instead of silently serving stale data. Concurrent fresh reads therefore collapse to a single server round-trip. Model: opus-4-8
This commit is contained in:
@@ -193,6 +193,15 @@ export interface TimelineAPI {
|
||||
groups(args: { groupBy: GroupBy; filter?: PhotoFilter }): TimelineGroup[];
|
||||
}
|
||||
|
||||
// The surface `Library.fresh()` resolves to (issue #75). It is the same three
|
||||
// read namespaces as the default `albums`/`photos`/`timeline`, handed back only
|
||||
// after a forced refresh has brought the local copy current.
|
||||
export interface FreshReads {
|
||||
albums: AlbumsAPI;
|
||||
photos: PhotosAPI;
|
||||
timeline: TimelineAPI;
|
||||
}
|
||||
|
||||
export const makeAlbumsAPI = (
|
||||
derive: () => DerivedRecords,
|
||||
content?: PhotoContent,
|
||||
|
||||
Reference in New Issue
Block a user