pub struct Topology<T: Clone + Debug> {
pub name: TopologyName,
pub config: T,
/* private fields */
}Expand description
A named replication topology spanning multiple provider regions.
§Example
use chroma_types::{Topology, TopologyName, RegionName};
let topology = Topology::new(
TopologyName::new("us-multi-az").unwrap(),
vec![
RegionName::new("aws-us-east-1").unwrap(),
RegionName::new("aws-us-west-2").unwrap(),
],
(),
);
assert_eq!(topology.name().as_str(), "us-multi-az");
assert_eq!(topology.regions().len(), 2);Fields§
§name: TopologyNameThe unique name for this topology.
config: TThe configuration of this topology.
Implementations§
Source§impl<T: Clone + Debug> Topology<T>
impl<T: Clone + Debug> Topology<T>
Sourcepub fn new(name: TopologyName, regions: Vec<RegionName>, config: T) -> Self
pub fn new(name: TopologyName, regions: Vec<RegionName>, config: T) -> Self
Creates a new topology.
§Example
use chroma_types::{Topology, TopologyName, RegionName};
let topology = Topology::new(
TopologyName::new("global").unwrap(),
vec![RegionName::new("aws-us-east-1").unwrap()],
(),
);Sourcepub fn name(&self) -> &TopologyName
pub fn name(&self) -> &TopologyName
Returns the unique name for this topology.
Sourcepub fn regions(&self) -> &[RegionName]
pub fn regions(&self) -> &[RegionName]
Returns the names of provider regions included in this topology.
Sourcepub fn cast<U, F>(self, f: F) -> Topology<U>
pub fn cast<U, F>(self, f: F) -> Topology<U>
Transforms this topology into a new type by applying a function to the config.
Sourcepub fn try_cast<U, E, F>(self, f: F) -> Result<Topology<U>, E>
pub fn try_cast<U, E, F>(self, f: F) -> Result<Topology<U>, E>
Transforms this topology into a new type by applying a fallible function to the config.
§Errors
Returns an error if the transformation function returns an error.
Sourcepub async fn try_cast_async<U, E, F, R>(self, f: F) -> Result<Topology<U>, E>
pub async fn try_cast_async<U, E, F, R>(self, f: F) -> Result<Topology<U>, E>
Transforms this topology into a new type by applying an async fallible function to the config.
§Errors
Returns an error if the transformation function returns an error.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Topology<T>
impl<'de, T> Deserialize<'de> for Topology<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
impl<T: Eq + Clone + Debug> Eq for Topology<T>
impl<T: Clone + Debug> StructuralPartialEq for Topology<T>
Auto Trait Implementations§
impl<T> Freeze for Topology<T>where
T: Freeze,
impl<T> RefUnwindSafe for Topology<T>where
T: RefUnwindSafe,
impl<T> Send for Topology<T>where
T: Send,
impl<T> Sync for Topology<T>where
T: Sync,
impl<T> Unpin for Topology<T>where
T: Unpin,
impl<T> UnwindSafe for Topology<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.