ct_containers_engine behaviour (ct_containers v0.1.1)

Link to this section Summary

Link to this section Types

Link to this type

container_engine_cb_module/0

-type container_engine_cb_module() :: module().
Link to this type

container_id/0

-type container_id() :: string() | binary().
Link to this type

ct_container_context/0

-type ct_container_context() ::
    #{image => binary(),
      wait_strategy => wait_strategy(),
      wait_timeout => number(),
      port_mapping => list(),
      labels => labels(),
      binds => list(),
      network => {atom(), binary()},
      alias => binary(),
      env => #{binary() => binary()},
      container_engine_module => module()}.
-type labels() :: #{binary() => binary()}.
Link to this type

port_mapping/0

-type port_mapping() :: {1..65535, tcp | udp}.
Link to this type

wait_strategy/0

-type wait_strategy() ::
    fun((container_id(), container_engine_cb_module(), wait_strategy_ctx()) ->
            {true | false, wait_strategy_ctx()}).
Link to this type

wait_strategy_ctx/0

-type wait_strategy_ctx() :: map().

Link to this section Callbacks

Link to this callback

container_logs/1

-callback container_logs(container_id()) -> {ok, binary()}.
Link to this callback

create_container/1

-callback create_container(ct_container_context()) -> {ok, container_id()}.
Link to this callback

create_network/2

-callback create_network(network_name(), labels()) -> {ok, network_id()}.
Link to this callback

delete_container/1

-callback delete_container(container_id()) -> {ok, container_id()}.
Link to this callback

delete_network/1

-callback delete_network(network_id()) -> {ok, network_id()}.
-callback host(container_id()) -> {ok, binary()}.
Link to this callback

list_containers/0

-callback list_containers() -> {ok, list()}.
Link to this callback

list_containers/1

-callback list_containers([{filters, map()}] | []) -> {ok, list()}.
Link to this callback

list_networks/1

-callback list_networks([{filters, map()}] | []) -> {ok, list()}.
-callback port(container_id(), port_mapping()) -> {ok, integer()}.
Link to this callback

start_container/1

-callback start_container(container_id()) -> {ok, container_id()}.
-callback status(container_id()) -> {ok, binary()}.
Link to this callback

stop_container/1

-callback stop_container(container_id()) -> {ok, container_id()}.