WeaviateEx.Cluster.Node (WeaviateEx v0.7.4)
View SourceRepresents a node in the Weaviate cluster.
Nodes are the individual servers that make up a Weaviate cluster. Each node can host shards from multiple collections.
Node Status Values
:healthy- Node is operating normally:unhealthy- Node is experiencing issues:unavailable- Node cannot be reached
Examples
%Node{
name: "node-0",
status: :healthy,
version: "1.24.0",
shards: [%Shard{...}]
}
Summary
Functions
Parse node from API response.
Check if node is healthy.
Parse status string to atom.
Get shards for a specific collection on this node.
Convert status atom to API string.
Get total object count across all shards on this node.
Types
Functions
Parse node from API response.
Examples
iex> Node.from_api(%{"name" => "node-0", "status" => "HEALTHY", "version" => "1.24.0"})
%Node{name: "node-0", status: :healthy, version: "1.24.0"}
Check if node is healthy.
Examples
iex> Node.healthy?(%Node{status: :healthy})
true
iex> Node.healthy?(%Node{status: :unhealthy})
false
Parse status string to atom.
Examples
iex> Node.parse_status("HEALTHY")
:healthy
iex> Node.parse_status("UNHEALTHY")
:unhealthy
@spec shards_for_collection(t(), String.t()) :: [WeaviateEx.Cluster.Shard.t()]
Get shards for a specific collection on this node.
Examples
iex> Node.shards_for_collection(node, "Article")
[%Shard{collection: "Article", ...}]
Convert status atom to API string.
Examples
iex> Node.status_to_api(:healthy)
"HEALTHY"
@spec total_object_count(t()) :: non_neg_integer()
Get total object count across all shards on this node.
Returns 0 if no shard information is available.
Examples
iex> node = %Node{shards: [%Shard{object_count: 100}, %Shard{object_count: 200}]}
iex> Node.total_object_count(node)
300