distribute/node_builder

Types

Node configuration builder

pub type NodeBuilder {
  NodeBuilder(
    name: option.Option(String),
    cookie: option.Option(String),
    peers: List(String),
    auto_register_services: Bool,
  )
}

Constructors

Result of node startup operations

pub type NodeResult {
  NodeResult(
    node_started: Bool,
    connections: List(String),
    registered_services: List(String),
    errors: List(String),
  )
}

Constructors

  • NodeResult(
      node_started: Bool,
      connections: List(String),
      registered_services: List(String),
      errors: List(String),
    )

Values

pub fn connect_to(
  builder: NodeBuilder,
  peers: List(String),
) -> NodeBuilder

Add peers to connect to

pub fn new() -> NodeBuilder

Create a new node builder with default settings

pub fn start(
  builder: NodeBuilder,
) -> Result(NodeResult, cluster.StartError)

Start the node with the configured settings

pub fn with_auto_register(builder: NodeBuilder) -> NodeBuilder

Enable auto-registration of common services

pub fn with_cookie(
  builder: NodeBuilder,
  cookie: String,
) -> NodeBuilder

Set the cookie

pub fn with_name(
  builder: NodeBuilder,
  name: String,
) -> NodeBuilder

Set the node name

Search Document