# `TypeDB.Server`
[🔗](https://github.com/NoeticEcho/TypedbEx/blob/v0.11.0/typedb/lib/typedb/server.ex#L1)

Server introspection: health, version and cluster membership.

`health/2` and `version/2` are unauthenticated, so they work before (and
independently of) sign-in — which is what makes `health/2` usable as a
readiness probe. Every function here takes `:timeout` and `:deadline`, which
a readiness probe wants: waiting the connection's default sixty seconds to
learn that a server is down is not a probe.

# `version`

```elixir
@type version() :: %{distribution: String.t(), version: String.t()}
```

What TypeDB reports about itself.

# `health`

```elixir
@spec health(
  TypeDB.Connection.t(),
  keyword()
) :: :ok | {:error, TypeDB.Error.t()}
```

Returns `:ok` when the server is up and serving the HTTP API.

Unauthenticated. Use it to wait for a server to become ready:

    TypeDB.Server.health(conn)

# `health!`

```elixir
@spec health!(
  TypeDB.Connection.t(),
  keyword()
) :: :ok
```

Returns `:ok` when the server is up, raising otherwise.

# `servers`

```elixir
@spec servers(
  TypeDB.Connection.t(),
  keyword()
) :: {:ok, [map()]} | {:error, TypeDB.Error.t()}
```

Lists the servers in the cluster.

A single-server deployment reports one entry. Fields vary by distribution, so
the decoded maps are returned as-is.

# `servers!`

```elixir
@spec servers!(
  TypeDB.Connection.t(),
  keyword()
) :: [map()]
```

Lists the servers in the cluster, raising on failure.

# `version`

```elixir
@spec version(
  TypeDB.Connection.t(),
  keyword()
) :: {:ok, version()} | {:error, TypeDB.Error.t()}
```

Returns the server's distribution and version.

    {:ok, %{distribution: "TypeDB CE", version: "3.12.1"}}

Unauthenticated.

# `version!`

```elixir
@spec version!(
  TypeDB.Connection.t(),
  keyword()
) :: version()
```

Returns the server's distribution and version, raising on failure.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
