ExArrow.Flight.ClientBehaviour behaviour (ex_arrow v0.4.0)

View Source

Behaviour for Arrow Flight client implementations. Allows swapping the real client for a mock in tests (e.g. with Mox).

Summary

Types

descriptor()

@type descriptor() :: {:cmd, binary()} | {:path, [String.t()]}

Callbacks

connect(host, port, opts)

@callback connect(host :: String.t(), port :: non_neg_integer(), opts :: keyword()) ::
  {:ok, ExArrow.Flight.Client.t()} | {:error, term()}

do_action(client, action_type, action_body)

@callback do_action(
  client :: ExArrow.Flight.Client.t(),
  action_type :: String.t(),
  action_body :: binary()
) :: {:ok, [binary()]} | {:error, term()}

do_get(client, ticket)

@callback do_get(client :: ExArrow.Flight.Client.t(), ticket :: term()) ::
  {:ok, ExArrow.Stream.t()} | {:error, term()}

do_put(client, schema, batches, opts)

@callback do_put(
  client :: ExArrow.Flight.Client.t(),
  schema :: ExArrow.Schema.t(),
  batches :: Enumerable.t(),
  opts :: keyword()
) :: :ok | {:error, term()}

get_flight_info(client, descriptor)

@callback get_flight_info(client :: ExArrow.Flight.Client.t(), descriptor :: descriptor()) ::
  {:ok, ExArrow.Flight.FlightInfo.t()} | {:error, term()}

get_schema(client, descriptor)

@callback get_schema(client :: ExArrow.Flight.Client.t(), descriptor :: descriptor()) ::
  {:ok, ExArrow.Schema.t()} | {:error, term()}

list_actions(client)

@callback list_actions(client :: ExArrow.Flight.Client.t()) ::
  {:ok, [ExArrow.Flight.ActionType.t()]} | {:error, term()}

list_flights(client, criteria)

@callback list_flights(client :: ExArrow.Flight.Client.t(), criteria :: binary()) ::
  {:ok, [ExArrow.Flight.FlightInfo.t()]} | {:error, term()}