econfd_ha Module

An Erlang interface equivalent to the HA C-API (documented in confd_lib_ha(3)).

Types

ha_node/0

-type ha_node() :: #ha_node{}.

Functions

bemaster/2

-spec bemaster(Socket, NodeId) -> Result
                  when
                      Socket :: econfd:socket(),
                      NodeId :: econfd:value(),
                      Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket(), econfd:value()

Instruct a HA node to be primary in the cluster.

benone/1

-spec benone(Socket) -> Result
                when
                    Socket :: econfd:socket(),
                    Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket()

Instruct a HA node to be nothing in the cluster.

beprimary/2

-spec beprimary(Socket, NodeId) -> Result
                   when
                       Socket :: econfd:socket(),
                       NodeId :: econfd:value(),
                       Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket(), econfd:value()

Instruct a HA node to be primary in the cluster.

berelay/1

-spec berelay(Socket) -> Result
                 when
                     Socket :: econfd:socket(),
                     Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket()

Instruct a HA secondary to be a relay for other secondaries.

besecondary/4

-spec besecondary(Socket, NodeId, PrimaryNodeId, WaitReplyBool) ->
                     Result
                     when
                         Socket :: econfd:socket(),
                         NodeId :: econfd:value(),
                         PrimaryNodeId :: ha_node(),
                         WaitReplyBool :: integer(),
                         Result :: ok | {error, econfd:error_reason()}.

Related types: ha_node(), econfd:error_reason(), econfd:socket(), econfd:value()

Instruct a HA node to be secondary in the cluster where PrimaryNodeId is primary.

beslave/4

-spec beslave(Socket, NodeId, PrimaryNodeId, WaitReplyBool) -> Result
                 when
                     Socket :: econfd:socket(),
                     NodeId :: econfd:value(),
                     PrimaryNodeId :: ha_node(),
                     WaitReplyBool :: integer(),
                     Result :: ok | {error, econfd:error_reason()}.

Related types: ha_node(), econfd:error_reason(), econfd:socket(), econfd:value()

Instruct a HA node to be secondary in the cluster where PrimaryNodeId is primary.

close/1

-spec close(Socket) -> Result
               when
                   Socket :: econfd:socket(),
                   Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket()

Close the HA connection.

connect/2

-spec connect(Path, Token) -> econfd:connect_result()
                 when Path :: string(), Token :: binary();
             (Address, Token) -> econfd:connect_result()
                 when Address :: econfd:ip(), Token :: binary().

Related types: econfd:connect_result(), econfd:ip()

connect/3

connect(Address, Port, Token)

do_connect/2

-spec do_connect(Address, Token) -> econfd:connect_result()
                    when
                        Address ::
                            #econfd_conn_ip{} | #econfd_conn_local{},
                        Token :: binary().

Related types: econfd:connect_result()

Connect to the HA subsystem.

If the port is changed it must also be changed in confd.conf To close a HA socket, use close/1.

getstatus/1

-spec getstatus(Socket) -> Result
                   when
                       Socket :: econfd:socket(),
                       Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket()

Request status from a HA node.

secondary_dead/2

-spec secondary_dead(Socket, NodeId) -> Result
                        when
                            Socket :: econfd:socket(),
                            NodeId :: econfd:value(),
                            Result ::
                                ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket(), econfd:value()

Instruct ConfD that another node is dead.

slave_dead/2

-spec slave_dead(Socket, NodeId) -> Result
                    when
                        Socket :: econfd:socket(),
                        NodeId :: econfd:value(),
                        Result :: ok | {error, econfd:error_reason()}.

Related types: econfd:error_reason(), econfd:socket(), econfd:value()

Instruct ConfD that another node is dead.

Last updated

Was this helpful?