ExArrow.Flight.Server (ex_arrow v0.4.0)

View Source

Arrow Flight server: multi-dataset routing server with optional TLS.

Each do_put stores data under a ticket derived from the Flight descriptor (cmd bytes or path segments joined with /). If no descriptor is provided the legacy ticket "echo" is used, preserving backward compatibility.

TLS

Transport security is controlled by the :tls option:

:tls valuebehaviour
not set (default)plaintext HTTP/2
[cert_pem: pem, key_pem: pem]one-way TLS (server presents cert)
[cert_pem: pem, key_pem: pem, ca_cert_pem: pem]mutual TLS (mTLS)

Examples

# Plaintext (default)
{:ok, server} = ExArrow.Flight.Server.start_link(9999)

# One-way TLS
cert = File.read!("server.crt")
key  = File.read!("server.key")
{:ok, server} = ExArrow.Flight.Server.start_link(9999, tls: [cert_pem: cert, key_pem: key])

# Mutual TLS
ca = File.read!("ca.crt")
{:ok, server} = ExArrow.Flight.Server.start_link(9999,
  tls: [cert_pem: cert, key_pem: key, ca_cert_pem: ca])

# OS-assigned port, all interfaces
{:ok, server} = ExArrow.Flight.Server.start_link(0, host: "0.0.0.0")

Summary

Functions

Returns the host address the server is bound to, e.g. "127.0.0.1" or "0.0.0.0".

Returns the port the server is listening on (useful when port: 0 was passed).

Starts a Flight server on port (use 0 for any available port).

Stops the Flight server, waiting for in-flight requests to drain.

Types

t()

@opaque t()

Functions

host(server)

@spec host(t()) :: {:ok, String.t()} | {:error, term()}

Returns the host address the server is bound to, e.g. "127.0.0.1" or "0.0.0.0".

port(server)

@spec port(t()) :: {:ok, non_neg_integer()} | {:error, term()}

Returns the port the server is listening on (useful when port: 0 was passed).

start_link(port, opts \\ [])

@spec start_link(
  non_neg_integer(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Starts a Flight server on port (use 0 for any available port).

Options

  • :host — bind address (default "127.0.0.1").
  • :tls — TLS config keyword list; see module doc.

stop(server)

@spec stop(t()) :: :ok | {:error, term()}

Stops the Flight server, waiting for in-flight requests to drain.