Skip to main content

storage_kit/core/
capability.rs

1use bitflags::bitflags;
2use serde::{Deserialize, Serialize};
3
4bitflags! {
5    /// Optional behavior within the retained portable database inventory.
6    ///
7    /// Capabilities describe retained optional behavior, not acceptance of every
8    /// request or a backend identity. The operation remains authoritative: inspect
9    /// its result and handle unsupported combinations before relying on an effect.
10    ///
11    /// # Examples
12    ///
13    /// ```
14    /// use storage_kit::database::CapabilitySet;
15    /// let required = CapabilitySet::FILTERING | CapabilitySet::DENSE_VECTOR;
16    /// assert!(required.contains(CapabilitySet::FILTERING));
17    /// assert!(!required.contains(CapabilitySet::FULL_TEXT));
18    /// # Ok::<(), storage_kit::StorageError>(())
19    /// ```
20    #[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
21    pub struct CapabilitySet: u16 {
22        /// Dense vector storage and nearest-neighbor search.
23        const DENSE_VECTOR = 1 << 0;
24        /// Full-text indexing and text search.
25        const FULL_TEXT = 1 << 1;
26        /// Structured filter lowering.
27        const FILTERING = 1 << 2;
28        /// Post-creation schema alteration.
29        const SCHEMA_EVOLUTION = 1 << 4;
30        /// Waiting for index readiness.
31        const WAIT_FOR_INDEX = 1 << 5;
32        /// Atomic bounded partition replacement.
33        const ATOMIC_PARTITION_REPLACE = 1 << 6;
34    }
35}