Skip to main content

stac_server/backend/
mod.rs

1#[cfg(feature = "duckdb")]
2mod duckdb;
3mod memory;
4#[cfg(feature = "pgstac")]
5mod pgstac;
6
7use crate::Error;
8#[cfg(feature = "duckdb")]
9pub use duckdb::DuckdbBackend;
10pub use memory::MemoryBackend;
11#[cfg(feature = "pgstac")]
12pub use pgstac::PgstacBackend;
13use stac::api::{CollectionSearchClient, SearchClient, TransactionClient};
14
15/// Storage backend for a STAC API.
16///
17/// This trait combines [`SearchClient`], [`CollectionSearchClient`], and
18/// [`TransactionClient`] with backend-specific capability flags.
19pub trait Backend:
20    SearchClient<Error = Error>
21    + CollectionSearchClient<Error = Error>
22    + TransactionClient<Error = Error>
23    + Clone
24    + Sync
25    + Send
26    + 'static
27{
28    /// Returns true if this backend has item search capabilities.
29    ///
30    /// # Examples
31    ///
32    /// ```
33    /// use stac_server::{MemoryBackend, Backend};
34    ///
35    /// assert!(MemoryBackend::new().has_item_search());
36    /// ```
37    fn has_item_search(&self) -> bool;
38
39    /// Returns true if this backend has [filter](https://github.com/stac-api-extensions/filter) capabilities.
40    ///
41    /// # Examples
42    ///
43    /// ```
44    /// use stac_server::{MemoryBackend, Backend};
45    ///
46    /// assert!(!MemoryBackend::new().has_filter());
47    /// ```
48    fn has_filter(&self) -> bool;
49}