pub struct MultiCloudMultiRegionConfiguration<T: Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> { /* private fields */ }Expand description
Configuration for multi-cloud, multi-region deployments.
This type validates its invariants both during construction via new
and during deserialization. Invalid configurations will fail with a ValidationError.
§Example
use chroma_types::{
MultiCloudMultiRegionConfiguration, ProviderRegion, Topology,
RegionName, TopologyName,
};
let config = MultiCloudMultiRegionConfiguration::new(
RegionName::new("aws-us-east-1").unwrap(),
vec![ProviderRegion::new(
RegionName::new("aws-us-east-1").unwrap(),
"aws",
"us-east-1",
(),
)],
vec![],
).expect("valid configuration");
assert_eq!(config.preferred().as_str(), "aws-us-east-1");Implementations§
Source§impl<T: Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> MultiCloudMultiRegionConfiguration<T>
impl<T: Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> MultiCloudMultiRegionConfiguration<T>
Sourcepub fn new(
preferred: RegionName,
regions: Vec<ProviderRegion<T>>,
topologies: Vec<Topology>,
) -> Result<Self, ValidationError>
pub fn new( preferred: RegionName, regions: Vec<ProviderRegion<T>>, topologies: Vec<Topology>, ) -> Result<Self, ValidationError>
Creates and validates a new multi-cloud, multi-region configuration.
Returns an error if validation fails.
§Example
use chroma_types::{
MultiCloudMultiRegionConfiguration, ProviderRegion, Topology,
RegionName, TopologyName,
};
// Valid configuration
let config = MultiCloudMultiRegionConfiguration::new(
RegionName::new("aws-us-east-1").unwrap(),
vec![ProviderRegion::new(
RegionName::new("aws-us-east-1").unwrap(),
"aws",
"us-east-1",
(),
)],
vec![Topology::new(
TopologyName::new("default").unwrap(),
vec![RegionName::new("aws-us-east-1").unwrap()],
)],
);
assert!(config.is_ok());
// Invalid configuration - preferred region doesn't exist
let config = MultiCloudMultiRegionConfiguration::<()>::new(
RegionName::new("nonexistent").unwrap(),
vec![ProviderRegion::new(
RegionName::new("aws-us-east-1").unwrap(),
"aws",
"us-east-1",
(),
)],
vec![],
);
assert!(config.is_err());Sourcepub fn preferred(&self) -> &RegionName
pub fn preferred(&self) -> &RegionName
Returns the preferred region for operations with region affinity.
Sourcepub fn regions(&self) -> &[ProviderRegion<T>]
pub fn regions(&self) -> &[ProviderRegion<T>]
Returns the set of provider regions available in this configuration.
Sourcepub fn topologies(&self) -> &[Topology]
pub fn topologies(&self) -> &[Topology]
Returns the set of topologies defined over the provider regions.
Trait Implementations§
Source§impl<T: Clone + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> Clone for MultiCloudMultiRegionConfiguration<T>
impl<T: Clone + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> Clone for MultiCloudMultiRegionConfiguration<T>
Source§fn clone(&self) -> MultiCloudMultiRegionConfiguration<T>
fn clone(&self) -> MultiCloudMultiRegionConfiguration<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> Debug for MultiCloudMultiRegionConfiguration<T>
impl<T: Debug + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> Debug for MultiCloudMultiRegionConfiguration<T>
Source§impl<'de, T: Clone + Debug + Eq + PartialEq + Serialize + DeserializeOwned> Deserialize<'de> for MultiCloudMultiRegionConfiguration<T>
impl<'de, T: Clone + Debug + Eq + PartialEq + Serialize + DeserializeOwned> Deserialize<'de> for MultiCloudMultiRegionConfiguration<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T: PartialEq + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> PartialEq for MultiCloudMultiRegionConfiguration<T>
impl<T: PartialEq + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> PartialEq for MultiCloudMultiRegionConfiguration<T>
Source§fn eq(&self, other: &MultiCloudMultiRegionConfiguration<T>) -> bool
fn eq(&self, other: &MultiCloudMultiRegionConfiguration<T>) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl<T> Serialize for MultiCloudMultiRegionConfiguration<T>
impl<T> Serialize for MultiCloudMultiRegionConfiguration<T>
impl<T: Eq + Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> Eq for MultiCloudMultiRegionConfiguration<T>
impl<T: Clone + Debug + Eq + PartialEq + Serialize + for<'a> Deserialize<'a>> StructuralPartialEq for MultiCloudMultiRegionConfiguration<T>
Auto Trait Implementations§
impl<T> Freeze for MultiCloudMultiRegionConfiguration<T>
impl<T> RefUnwindSafe for MultiCloudMultiRegionConfiguration<T>where
T: RefUnwindSafe,
impl<T> Send for MultiCloudMultiRegionConfiguration<T>where
T: Send,
impl<T> Sync for MultiCloudMultiRegionConfiguration<T>where
T: Sync,
impl<T> Unpin for MultiCloudMultiRegionConfiguration<T>where
T: Unpin,
impl<T> UnwindSafe for MultiCloudMultiRegionConfiguration<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.