pub struct DatacakeNodeBuilder<S = DCAwareSelector> { /* private fields */ }
Expand description
Build a Datacake node using provided settings.
Implementations§
Source§impl<S> DatacakeNodeBuilder<S>where
S: NodeSelector + Send + 'static,
impl<S> DatacakeNodeBuilder<S>where
S: NodeSelector + Send + 'static,
Sourcepub fn new(
node_id: NodeId,
connection_cfg: ConnectionConfig,
) -> DatacakeNodeBuilder<DCAwareSelector>
pub fn new( node_id: NodeId, connection_cfg: ConnectionConfig, ) -> DatacakeNodeBuilder<DCAwareSelector>
Create a new node builder.
Sourcepub fn with_node_selector<S2>(self, selector: S2) -> DatacakeNodeBuilder<S2>
pub fn with_node_selector<S2>(self, selector: S2) -> DatacakeNodeBuilder<S2>
Set a node selector.
This is used by systems to select a specific set of nodes from the live membership set with a given consistency level.
Sourcepub fn with_cluster_id(self, cluster_id: impl Display) -> Self
pub fn with_cluster_id(self, cluster_id: impl Display) -> Self
Set the cluster id for the given node.
Sourcepub fn with_data_center(self, dc: impl Display) -> Self
pub fn with_data_center(self, dc: impl Display) -> Self
Set the data center the node belongs to.
Sourcepub async fn connect(self) -> Result<DatacakeNode, NodeError>
pub async fn connect(self) -> Result<DatacakeNode, NodeError>
Starts the Datacake cluster, connecting to the targeted seed nodes.
When connecting to the cluster, the node_id
must be unique otherwise
the cluster will incorrectly propagate state and not become consistent.
Typically you will only have one cluster and therefore only have one cluster_id
which should be the same for each node in the cluster.
Currently the cluster_id
is not handled by anything other than
chitchat
No seed nodes need to be live at the time of connecting for the cluster to start correctly, but they are required in order for nodes to discover one-another and share their basic state.