TypeDB.Server (TypeDB v0.2.2)

Copy Markdown View Source

Server introspection: health, version and cluster membership.

health/1 and version/1 are unauthenticated, so they work before (and independently of) sign-in — which is what makes health/1 usable as a readiness probe.

Summary

Types

What TypeDB reports about itself.

Functions

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

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

Lists the servers in the cluster.

Lists the servers in the cluster, raising on failure.

Returns the server's distribution and version.

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

Types

version()

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

What TypeDB reports about itself.

Functions

health(conn)

@spec health(TypeDB.Connection.t()) :: :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!(conn)

@spec health!(TypeDB.Connection.t()) :: :ok

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

servers(conn)

@spec servers(TypeDB.Connection.t()) :: {: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!(conn)

@spec servers!(TypeDB.Connection.t()) :: [map()]

Lists the servers in the cluster, raising on failure.

version(conn)

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

Returns the server's distribution and version.

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

Unauthenticated.

version!(conn)

@spec version!(TypeDB.Connection.t()) :: version()

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