65 lines
1.7 KiB
Rust
65 lines
1.7 KiB
Rust
//! Driver definitions shared by the backend configuration modules.
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Common backend type for catalog lookups in Rust.
|
|
///
|
|
/// Serialized configuration uses category-specific driver types in its fields.
|
|
/// Deriving Serde traits on this enum would also require them on every wrapped type.
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum Driver {
|
|
Sql(SqlDriver),
|
|
ObjectStore(ObjectStoreDriver),
|
|
// Reserved categories gain Serde traits when their configuration fields are added.
|
|
Cache(CacheDriver),
|
|
Search(SearchDriver),
|
|
EventStream(EventStreamDriver),
|
|
BatchCompute(BatchComputeDriver),
|
|
OnlineService(OnlineServiceKind),
|
|
}
|
|
|
|
/// The driver in SQL cluster configuration. Serde uses snake_case names such as `postgres`.
|
|
/// `SqlDriver::default()` selects `Sqlite`.
|
|
#[derive(Clone, Copy, Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum SqlDriver {
|
|
#[default]
|
|
Sqlite,
|
|
Postgres,
|
|
Mysql,
|
|
}
|
|
|
|
/// The driver in object storage configuration. Serde reads and writes `S3` as `s3`.
|
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, Eq, PartialEq)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum ObjectStoreDriver {
|
|
S3,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum CacheDriver {
|
|
Redis,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum SearchDriver {
|
|
OpenSearch,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum EventStreamDriver {
|
|
Kafka,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum BatchComputeDriver {
|
|
Spark,
|
|
}
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum OnlineServiceKind {
|
|
Recommendation,
|
|
Retrieval,
|
|
Ranking,
|
|
}
|