stac-rs icon indicating copy to clipboard operation
stac-rs copied to clipboard

Abstract the idea of a `Client` to a trait or traits

Open gadomski opened this issue 7 months ago • 0 comments

Our backends and our clients are all doing more-or-less the same stuff ... we should abstract those behaviors to a trait or traits.

Initial thoughts (could change, all async):

  • SearchClient: search is only required method, item, items, etc all default to using search
  • CollectionSearchClient: same thing but for collections
  • TransactionClient: add/create/upsert items and collections (do we need to separate into a CollectionTransactionClient?)
  • ArrowSearchClient: search_to_arrow iterates over record batches, and provides a default impl of search that does a conversion (like the DuckDB client does now)

We'll want to update several places to use these traits:

  • https://github.com/stac-utils/rustac/tree/main/crates/server/src/backend
  • https://github.com/stac-utils/rustac/blob/main/crates/api/src/client.rs
  • https://github.com/stac-utils/rustac/blob/main/crates/duckdb/src/client.rs

The traits should live in stac-api.

gadomski avatar May 05 '25 17:05 gadomski