econfd_maapi Module

An Erlang interface equivalent to the MAAPI C-API

This modules implements the Management Agent API. All functions in this module have an equivalent function in the C library. The actual semantics of each of the API functions described here is better described in the man page confd_lib_maapi(3).

Types

confd_user_identification/0

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

confd_user_info/0

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

dbname/0

-type dbname() :: 0 | 1 | 2 | 3 | 4 | 6 | 7.

The DB name can be either

  • 0 = CONFD_NO_DB

  • 1 = CONFD_CANDIDATE

  • 2 = CONFD_RUNNING

  • 3 = CONFD_STARTUP

  • 4 = CONFD_OPERATIONAL

  • 6 = CONFD_PRE_COMMIT_RUNNING

  • 7 = CONFD_INTENDED

Check maapi_start_trans() in confd_lib_maapi(3) for detailed information.

err/0

-type err() :: {error, {integer(), binary()}} | {error, closed}.

Errors can be either

  • {error, Ecode::integer(), Reason::binary()} where Ecode is one of the error codes defined in econfd_errors.hrl, and Reason is (possibly empty) textual description

  • {error, closed} if the socket gets closed

find_next_type/0

-type find_next_type() :: 0 | 1.

The type is used in find_next/3 can be either

  • 0 = CONFD_FIND_NEXT

  • 1 = CONFD_FIND_SAME_OR_NEXT

Check maapi_find_next() in confd_lib_maapi(3) for detailed information.

maapi_cursor/0

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

proto/0

-type proto() :: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9.

The protocol to start user session can be either

  • 0 = CONFD_PROTO_UNKNOWN

  • 1 = CONFD_PROTO_TCP

  • 2 = CONFD_PROTO_SSH

  • 3 = CONFD_PROTO_SYSTEM

  • 4 = CONFD_PROTO_CONSOLE

  • 5 = CONFD_PROTO_SSL

  • 6 = CONFD_PROTO_HTTP

  • 7 = CONFD_PROTO_HTTPS

  • 8 = CONFD_PROTO_UDP

  • 9 = CONFD_PROTO_TLS

read_ret/0

-type read_ret() ::
          ok |
          {ok, term()} |
          {error, {ErrorCode :: non_neg_integer(), Info :: binary()}} |
          {error, econfd:transport_error()}.

Related types: econfd:transport_error()

template_type/0

-type template_type() :: 0 | 1 | 2.

The type is used in ncs_template_variables/3

  • 0 = DEVICE_TEMPLATE - Designates device template, device template means the specific template configuration name under /ncs:devices/ncs:template.

  • 1 = SERVICE_TEMPLATE - Designates service template, service template means the specific template configuration name of template loaded from the directory templates of the package.

  • 2 = COMPLIANCE_TEMPLATE - Designates compliance template, compliance template used to verify that the configuration on a device conforms to an expected, predefined configuration, it also means the specific template configuration name under /ncs:compliance/ncs:template

trans_mode/0

-type trans_mode() :: read | read_write.

verbosity/0

-type verbosity() :: 0 | 1 | 2 | 3.

The type is used in start_span_th/7 and can be either

  • 0 = CONFD_PROGRESS_NORMAL

  • 1 = CONFD_PROGRESS_VERBOSE

  • 2 = CONFD_PROGRESS_VERY_VERBOSE

  • 3 = CONFD_PROGRESS_DEBUG

Check maapi_start_span_th() in confd_lib_maapi(3) for detailed information.

xpath_eval_option/0

-type xpath_eval_option() ::
          {tracefun, term()} |
          {context, econfd:ikeypath()} |
          {varbindings,
           [{Name :: string(), ValueExpr :: string() | binary()}]} |
          {root, econfd:ikeypath()}.

Related types: econfd:ikeypath()

Functions

aaa_reload/2

-spec aaa_reload(Socket, Synchronous) -> ok | err()
                    when
                        Socket :: econfd:socket(),
                        Synchronous :: boolean().

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

Tell AAA to reload external AAA data.

abort_trans/2

-spec abort_trans(Socket, Tid) -> ok | err()
                     when Socket :: econfd:socket(), Tid :: integer().

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

Abort transaction.

abort_upgrade/1

-spec abort_upgrade(Socket) -> ok | err() when Socket :: econfd:socket().

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

Abort in-service upgrade.

aes256_key/1

aes256_key(Aes256Key)

aes_key/2

aes_key(AesKey, AesIVec)

all_keys/2

all_keys(Cursor, Acc)

all_keys/3

-spec all_keys(Socket, Tid, IKeypath) -> Result
                  when
                      Socket :: econfd:socket(),
                      Tid :: integer(),
                      IKeypath :: econfd:ikeypath(),
                      Result :: {ok, [econfd:key()]} | err().

Related types: err(), econfd:ikeypath(), econfd:key(), econfd:socket()

Utility function. Return all keys in a list.

apply_trans/3

-spec apply_trans(Socket, Tid, KeepOpen) -> ok | err()
                     when
                         Socket :: econfd:socket(),
                         Tid :: integer(),
                         KeepOpen :: boolean().

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

Equivalent to apply_trans(Socket, Tid, KeepOpen, 0).

apply_trans/4

-spec apply_trans(Socket, Tid, KeepOpen, Flags) -> ok | err()
                     when
                         Socket :: econfd:socket(),
                         Tid :: integer(),
                         KeepOpen :: boolean(),
                         Flags :: non_neg_integer().

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

Apply all in the transaction.

This is the combination of validate/prepare/commit done in the right order.

attach/3

-spec attach(Socket, Ns, Tctx) -> ok | err()
                when
                    Socket :: econfd:socket(),
                    Ns :: econfd:namespace() | 0,
                    Tctx :: econfd:confd_trans_ctx().

Related types: err(), econfd:confd_trans_ctx(), econfd:namespace(), econfd:socket()

Attach to a running transaction.

Give NameSpace as 0 if it doesn't matter (-1 works too but is deprecated).

attach2/4

-spec attach2(Socket, Ns, USid, Thandle) -> ok | err()
                 when
                     Socket :: econfd:socket(),
                     Ns :: econfd:namespace() | 0,
                     USid :: integer(),
                     Thandle :: integer().

Related types: err(), econfd:namespace(), econfd:socket()

Attach to a running transaction. Give NameSpace as 0 if it doesn't matter (-1 works too but is deprecated).

attach_init/1

-spec attach_init(Socket) -> Result
                     when
                         Socket :: econfd:socket(),
                         Result :: {ok, Thandle} | err().

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

Attach to the CDB init/upgrade transaction in phase0.

Returns the transaction handle to use in subsequent maapi calls on success.

authenticate/4

-spec authenticate(Socket, User, Pass, Groups) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          User :: binary(),
                          Pass :: binary(),
                          Groups :: [binary()].

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

Autenticate a user using ConfD AAA.

authenticate2/8

-spec authenticate2(Socket, User, Pass, SrcIp, SrcPort, Context, Proto,
                    Groups) ->
                       ok | err()
                       when
                           Socket :: econfd:socket(),
                           User :: binary(),
                           Pass :: binary(),
                           SrcIp :: econfd:ip(),
                           SrcPort :: non_neg_integer(),
                           Context :: binary(),
                           Proto :: integer(),
                           Groups :: [binary()].

Related types: err(), econfd:ip(), econfd:socket()

Autenticate a user using ConfD AAA.

bool2int/1

bool2int(_)

candidate_abort_commit/1

-spec candidate_abort_commit(Socket) -> ok | err()
                                when Socket :: econfd:socket().

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

Equivalent to candidate_abort_commit(Socket, <<>>).

candidate_abort_commit/2

-spec candidate_abort_commit(Socket, PersistId) -> ok | err()
                                when
                                    Socket :: econfd:socket(),
                                    PersistId :: binary().

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

Cancel persistent confirmed commit.

candidate_commit/1

-spec candidate_commit(Socket) -> ok | err()
                          when Socket :: econfd:socket().

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

Equivalent to candidate_commit_info(Socket, undefined, <<>>, <<>>).

Copies candidate to running or confirms a confirmed commit.

candidate_commit/2

-spec candidate_commit(Socket, PersistId) -> ok | err()
                          when
                              Socket :: econfd:socket(),
                              PersistId :: binary().

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

Equivalent to candidate_commit_info(Socket, PersistId, <<>>, <<>>).

Confirms persistent confirmed commit.

candidate_commit_info/3

-spec candidate_commit_info(Socket, Label, Comment) -> ok | err()
                               when
                                   Socket :: econfd:socket(),
                                   Label :: binary(),
                                   Comment :: binary().

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

Equivalent to candidate_commit_info(Socket, undefined, Label, Comment).

Like candidate_commit/1, but set the "Label" and/or "Comment" that is stored in the rollback file when the candidate is committed to running.

To set only the "Label", give Comment as an empty binary, and to set only the "Comment", give Label as an empty binary.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using candidate_confirmed_commit_info/4) and with the confirming commit (using this function).

candidate_commit_info/4

-spec candidate_commit_info(Socket, PersistId, Label, Comment) ->
                               ok | err()
                               when
                                   Socket :: econfd:socket(),
                                   PersistId :: binary() | undefined,
                                   Label :: binary(),
                                   Comment :: binary().

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

Combines candidate_commit/2 and candidate_commit_info/3 - set "Label" and/or "Comment" when confirming a persistent confirmed commit.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using candidate_confirmed_commit_info/6) and with the confirming commit (using this function).

candidate_confirmed_commit/2

-spec candidate_confirmed_commit(Socket, TimeoutSecs) -> ok | err()
                                    when
                                        Socket :: econfd:socket(),
                                        TimeoutSecs :: integer().

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

Equivalent to candidate_confirmed_commit_info(Socket, TimeoutSecs, undefined, undefined, <<>>, <<>>).

Copy candidate into running, but rollback if not confirmed by a call of candidate_commit/1.

candidate_confirmed_commit/4

-spec candidate_confirmed_commit(Socket, TimeoutSecs, Persist,
                                 PersistId) ->
                                    ok | err()
                                    when
                                        Socket :: econfd:socket(),
                                        TimeoutSecs :: integer(),
                                        Persist :: binary() | undefined,
                                        PersistId ::
                                            binary() | undefined.

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

Equivalent to candidate_confirmed_commit_info(Socket, TimeoutSecs, Persist, PersistId, <<>>, <<>>).

Starts or extends persistent confirmed commit.

candidate_confirmed_commit_info/4

-spec candidate_confirmed_commit_info(Socket, TimeoutSecs, Label,
                                      Comment) ->
                                         ok | err()
                                         when
                                             Socket :: econfd:socket(),
                                             TimeoutSecs :: integer(),
                                             Label :: binary(),
                                             Comment :: binary().

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

Equivalent to candidate_confirmed_commit_info(Socket, TimeoutSecs, undefined, undefined, Label, Comment).

Like candidate_confirmed_commit/2, but set the "Label" and/or "Comment" that is stored in the rollback file when the candidate is committed to running.

To set only the "Label", give Comment as an empty binary, and to set only the "Comment", give Label as an empty binary.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using this function) and with the confirming commit (using candidate_commit_info/3).

candidate_confirmed_commit_info/6

-spec candidate_confirmed_commit_info(Socket, TimeoutSecs, Persist,
                                      PersistId, Label, Comment) ->
                                         ok | err()
                                         when
                                             Socket :: econfd:socket(),
                                             TimeoutSecs :: integer(),
                                             Persist ::
                                                 binary() | undefined,
                                             PersistId ::
                                                 binary() | undefined,
                                             Label :: binary(),
                                             Comment :: binary().

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

Combines candidate_confirmed_commit/4 and candidate_confirmed_commit_info/4 - set "Label" and/or "Comment" when starting or extending a persistent confirmed commit.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using this function) and with the confirming commit (using candidate_commit_info/4).

candidate_reset/1

-spec candidate_reset(Socket) -> ok | err()
                         when Socket :: econfd:socket().

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

Copy running into candidate.

candidate_validate/1

-spec candidate_validate(Socket) -> ok | err()
                            when Socket :: econfd:socket().

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

Validate the candidate config.

cli_prompt/4

-spec cli_prompt(Socket, USid, Prompt, Echo) -> {ok, binary()} | err()
                    when
                        Socket :: econfd:socket(),
                        USid :: integer(),
                        Prompt :: binary(),
                        Echo :: boolean().

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

Prompt CLI user for a reply.

cli_prompt/5

-spec cli_prompt(Socket, USid, Prompt, Echo, Timeout) ->
                    {ok, binary()} | err()
                    when
                        Socket :: econfd:socket(),
                        USid :: integer(),
                        Prompt :: binary(),
                        Echo :: boolean(),
                        Timeout :: non_neg_integer().

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

Prompt CLI user for a reply - return error if no reply is received within Timeout seconds.

cli_prompt_oneof/4

-spec cli_prompt_oneof(Socket, USid, Prompt, Choice) ->
                          {ok, binary()} | err()
                          when
                              Socket :: econfd:socket(),
                              USid :: integer(),
                              Prompt :: binary(),
                              Choice :: binary().

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

Prompt CLI user for a reply.

cli_prompt_oneof/5

-spec cli_prompt_oneof(Socket, USid, Prompt, Choice, Timeout) ->
                          {ok, binary()} | err()
                          when
                              Socket :: econfd:socket(),
                              USid :: integer(),
                              Prompt :: binary(),
                              Choice :: binary(),
                              Timeout :: non_neg_integer().

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

Prompt CLI user for a reply - return error if no reply is received within Timeout seconds.

cli_read_eof/3

-spec cli_read_eof(Socket, USid, Echo) -> {ok, binary()} | err()
                      when
                          Socket :: econfd:socket(),
                          USid :: integer(),
                          Echo :: boolean().

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

Read data from CLI until EOF.

cli_read_eof/4

-spec cli_read_eof(Socket, USid, Echo, Timeout) ->
                      {ok, binary()} | err()
                      when
                          Socket :: econfd:socket(),
                          USid :: integer(),
                          Echo :: boolean(),
                          Timeout :: non_neg_integer().

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

Read data from CLI until EOF - return error if no reply is received within Timeout seconds.

cli_write/3

-spec cli_write(Socket, USid, Message) -> ok | err()
                   when
                       Socket :: econfd:socket(),
                       USid :: integer(),
                       Message :: binary().

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

Write mesage to the CLI.

close/1

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

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

Close socket.

commit_trans/2

-spec commit_trans(Socket, Tid) -> ok | err()
                      when Socket :: econfd:socket(), Tid :: integer().

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

Commit a transaction.

commit_upgrade/1

-spec commit_upgrade(Socket) -> ok | err()
                        when Socket :: econfd:socket().

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

Commit in-service upgrade.

confirmed_commit_in_progress/1

-spec confirmed_commit_in_progress(Socket) -> Result
                                      when
                                          Socket :: econfd:socket(),
                                          Result ::
                                              {ok, boolean()} | err().

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

Is a confirmed commit in progress.

connect/1

-spec connect(Path) -> econfd:connect_result() when Path :: string().

Related types: econfd:connect_result()

Connect a maapi socket to ConfD.

connect/2

-spec connect(Address, Port) -> econfd:connect_result()
                 when Address :: econfd:ip(), Port :: non_neg_integer().

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

Connect a maapi socket to ConfD.

copy/3

-spec copy(Socket, FromTH, ToTH) -> ok | err()
              when
                  Socket :: econfd:socket(),
                  FromTH :: integer(),
                  ToTH :: integer().

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

Copy data from one transaction to another.

copy_running_to_startup/1

-spec copy_running_to_startup(Socket) -> ok | err()
                                 when Socket :: econfd:socket().

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

Copy running to startup.

copy_tree/4

-spec copy_tree(Socket, Tid, FromIKeypath, ToIKeypath) -> ok | err()
                   when
                       Socket :: econfd:socket(),
                       Tid :: integer(),
                       FromIKeypath :: econfd:ikeypath(),
                       ToIKeypath :: econfd:ikeypath().

Related types: err(), econfd:ikeypath(), econfd:socket()

Copy an entire subtree in the configuration from one point to another.

create/3

-spec create(Socket, Tid, IKeypath) -> ok | err()
                when
                    Socket :: econfd:socket(),
                    Tid :: integer(),
                    IKeypath :: econfd:ikeypath().

Related types: err(), econfd:ikeypath(), econfd:socket()

Create a new element.

delete/3

-spec delete(Socket, Tid, IKeypath) -> ok | err()
                when
                    Socket :: econfd:socket(),
                    Tid :: integer(),
                    IKeypath :: econfd:ikeypath().

Related types: err(), econfd:ikeypath(), econfd:socket()

Delete an element.

delete_config/2

-spec delete_config(Socket, DbName) -> ok | err()
                       when
                           Socket :: econfd:socket(), DbName :: dbname().

Related types: dbname(), err(), econfd:socket()

Delete all data from a data store.

des_key/4

des_key(DesKey1, DesKey2, DesKey3, DesIVec)

detach/2

-spec detach(Socket, Thandle) -> ok | err()
                when Socket :: econfd:socket(), Thandle :: integer().

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

Detach from the transaction.

diff_iterate/4

diff_iterate(Sock, Tid, Fun, InitState)

Equivalent to diff_iterate(Sock, Tid, Fun, 0, InitState).

diff_iterate/5

-spec diff_iterate(Socket, Tid, Fun, Flags, State) -> Result
                      when
                          Socket :: econfd:socket(),
                          Tid :: integer(),
                          Fun ::
                              fun((IKeypath, Op, OldValue, Value, State) ->
                                      {ok, Ret, State} | {error, term()}),
                          Flags :: non_neg_integer(),
                          State :: term(),
                          Result :: {ok, State} | {error, term()}.

Related types: econfd:socket()

Iterate through a diff.

This function is used in combination with the notifications API where we get a chance to iterate through the diff of a transaction just before it gets commited. The transaction hangs until we have called econfd_notif:notification_done/2. The function can also be called from within validate() callbacks to traverse a diff while validating. Currently OldValue is always the atom 'undefined'. When Op == ?MOP_MOVED_AFTER (only for "ordered-by user" list entry), Value == {} means that the entry was moved first in the list, otherwise Value is a econfd:key() tuple that identifies the entry it was moved after.

do_connect/1

do_connect(SockAddr)

end_progress_span/3

-spec end_progress_span(Socket, SpanId1, Annotation) -> Result
                           when
                               Socket :: econfd:socket(),
                               SpanId1 :: binary(),
                               Annotation :: iolist(),
                               Result ::
                                   {ok,
                                    {SpanId2 :: binary() | undefined,
                                     TraceId :: binary() | undefined}}.

Related types: econfd:socket()

end_user_session/1

-spec end_user_session(Socket) -> ok | err()
                          when Socket :: econfd:socket().

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

Ends a user session.

exists/3

-spec exists(Socket, Tid, IKeypath) -> Result
                when
                    Socket :: econfd:socket(),
                    Tid :: integer(),
                    IKeypath :: econfd:ikeypath(),
                    Result :: {ok, boolean()} | err().

Related types: err(), econfd:ikeypath(), econfd:socket()

Check if an element exists.

find_next/3

-spec find_next(Cursor, Type, Key) -> Result
                   when
                       Cursor :: maapi_cursor(),
                       Type :: find_next_type(),
                       Key :: econfd:key(),
                       Result ::
                           {ok, econfd:key(), Cursor} | done | err().

Related types: err(), find_next_type(), maapi_cursor(), econfd:key()

find the list entry matching Type and Key.

finish_trans/2

-spec finish_trans(Socket, Tid) -> ok | err()
                      when Socket :: econfd:socket(), Tid :: integer().

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

Finish a transaction.

get_attrs/4

-spec get_attrs(Socket, Tid, IKeypath, AttrList) -> Result
                   when
                       Socket :: econfd:socket(),
                       Tid :: integer(),
                       IKeypath :: econfd:ikeypath(),
                       AttrList :: [Attr],
                       Result :: {ok, [{Attr, Value}]} | err().

Related types: err(), econfd:ikeypath(), econfd:socket()

Get the selected attributes for an element.

Calling with an empty attribute list returns all attributes.

get_authorization_info/2

-spec get_authorization_info(Socket, USid) -> Result
                                when
                                    Socket :: econfd:socket(),
                                    USid :: integer(),
                                    Result :: {ok, Info} | err().

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

Get authorization info for a user session.

get_case/4

-spec get_case(Socket, Tid, IKeypath, Choice) -> Result
                  when
                      Socket :: econfd:socket(),
                      Tid :: integer(),
                      IKeypath :: econfd:ikeypath(),
                      Choice :: econfd:qtag() | [econfd:qtag()],
                      Result :: {ok, Case} | err().

Related types: err(), econfd:ikeypath(), econfd:qtag(), econfd:socket()

Get the current case for a choice.

get_elem/3

-spec get_elem(Socket, Tid, IKeypath) -> Result
                  when
                      Socket :: econfd:socket(),
                      Tid :: integer(),
                      IKeypath :: econfd:ikeypath(),
                      Result :: {ok, econfd:value()} | err().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Read an element.

get_elem_no_defaults/3

-spec get_elem_no_defaults(Socket, Tid, IKeypath) -> Result
                              when
                                  Socket :: econfd:socket(),
                                  Tid :: integer(),
                                  IKeypath :: econfd:ikeypath(),
                                  Result :: {ok, Value} | err().

Related types: err(), econfd:ikeypath(), econfd:socket()

Read an element, but return 'default' instead of the value if the default value is in effect.

get_mode/2

-spec get_mode(Socket, Tid) -> {ok, trans_mode() | -1}
                  when Socket :: econfd:socket(), Tid :: integer().

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

Get the mode for the given transaction.

get_my_user_session_id/1

-spec get_my_user_session_id(Socket) -> Result
                                when
                                    Socket :: econfd:socket(),
                                    Result :: {ok, USid} | err().

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

Get my user session id.

get_next/1

-spec get_next(Cursor) -> Result
                  when
                      Cursor :: maapi_cursor(),
                      Result ::
                          {ok, econfd:key(), Cursor} | done | err().

Related types: err(), maapi_cursor(), econfd:key()

iterate through the entries of a list.

get_object/3

-spec get_object(Socket, Tid, IKeypath) -> Result
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        IKeypath :: econfd:ikeypath(),
                        Result :: {ok, [econfd:value()]} | err().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Read all the values in a container or list entry.

get_objects/2

-spec get_objects(Cursor, NumEntries) -> Result
                     when
                         Cursor :: maapi_cursor(),
                         NumEntries :: integer(),
                         Result ::
                             {ok, Cursor, Values} |
                             {done, Values} |
                             err().

Related types: err(), maapi_cursor()

Read all the values for NumEntries list entries, starting at the point given by the cursor C.

The return value has one Erlang list for each YANG list entry, i.e. it is a list of at most NumEntries lists. If we reached the end of the YANG list, {done, Values} is returned, and there will be fewer than NumEntries lists in Values - otherwise {ok, C2, Values} is returned, where C2 can be used to continue the traversal.

get_rollback_id/2

-spec get_rollback_id(Socket, Tid) -> non_neg_integer() | -1
                         when
                             Socket :: econfd:socket(), Tid :: integer().

Related types: econfd:socket()

Get rollback id of commited transaction.

get_running_db_status/1

-spec get_running_db_status(Socket) -> Result
                               when
                                   Socket :: econfd:socket(),
                                   Result :: {ok, Status} | err().

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

Get the "running status".

get_user_session/2

-spec get_user_session(Socket, USid) -> Result
                          when
                              Socket :: econfd:socket(),
                              USid :: integer(),
                              Result :: {ok, confd_user_info()} | err().

Related types: confd_user_info(), err(), econfd:socket()

Get session info for a user session.

get_user_sessions/1

-spec get_user_sessions(Socket) -> Result
                           when
                               Socket :: econfd:socket(),
                               Result :: {ok, [USid]} | err().

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

Get all user sessions.

get_values/4

-spec get_values(Socket, Tid, IKeypath, Values) -> Result
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        IKeypath :: econfd:ikeypath(),
                        Values :: [econfd:tagval()],
                        Result :: {ok, [econfd:tagval()]} | err().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:tagval()

Read the values for the leafs that have the "value" 'not_found' in the Values list.

This can be used to read an arbitrary set of sub-elements of a container or list entry. The return value is a list of the same length as Values, i.e. the requested leafs are in the same position in the returned list as in the Values argument. The elements in the returned list are always "canonical" though, i.e. of the form econfd:tagval().

hide_group/3

-spec hide_group(Socket, Tid, GroupName) -> ok | err()
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        GroupName :: binary().

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

Do hide a hide group.

Hide all nodes belonging to a hide group in a transaction that started with flag FLAG_HIDE_ALL_HIDEGROUPS.

hkeypath2ikeypath/2

-spec hkeypath2ikeypath(Socket, HKeypath) -> Result
                           when
                               Socket :: econfd:socket(),
                               HKeypath :: [non_neg_integer()],
                               Result :: {ok, IKeypath} | err().

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

Convert a hkeypath to an ikeypath.

ibool/1

ibool(X)

init_cursor/3

-spec init_cursor(Socket, Tid, IKeypath) -> maapi_cursor()
                     when
                         Socket :: econfd:socket(),
                         Tid :: integer(),
                         IKeypath :: econfd:ikeypath().

Related types: maapi_cursor(), econfd:ikeypath(), econfd:socket()

Equivalent to init_cursor(Socket, Tik, IKeypath, undefined).

init_cursor/4

-spec init_cursor(Socket, Tid, IKeypath, XPath) -> maapi_cursor()
                     when
                         Socket :: econfd:socket(),
                         Tid :: integer(),
                         IKeypath :: econfd:ikeypath(),
                         XPath :: undefined | binary() | string().

Related types: maapi_cursor(), econfd:ikeypath(), econfd:socket()

Initalize a get_next() cursor.

init_upgrade/3

-spec init_upgrade(Socket, TimeoutSecs, Flags) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          TimeoutSecs :: integer(),
                          Flags :: non_neg_integer().

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

Start in-service upgrade.

insert/3

-spec insert(Socket, Tid, IKeypath) -> ok | err()
                when
                    Socket :: econfd:socket(),
                    Tid :: integer(),
                    IKeypath :: econfd:ikeypath().

Related types: err(), econfd:ikeypath(), econfd:socket()

Insert an entry in an integer-keyed list.

install_crypto_keys/1

-spec install_crypto_keys(Socket) -> ok | err()
                             when Socket :: econfd:socket().

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

Fetch keys for the encrypted data types from the server.

Encrypted data type can be tailf:aes-cfb-128-encrypted-string and tailf:aes-256-cfb-128-encrypted-string.

is_candidate_modified/1

-spec is_candidate_modified(Socket) -> Result
                               when
                                   Socket :: econfd:socket(),
                                   Result :: {ok, boolean()} | err().

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

Check if candidate has been modified.

is_lock_set/2

-spec is_lock_set(Socket, DbName) -> Result
                     when
                         Socket :: econfd:socket(),
                         DbName :: dbname(),
                         Result :: {ok, integer()} | err().

Related types: dbname(), err(), econfd:socket()

Check if a db is locked or not.

Return 0 or the Usid of the lock owner.

is_running_modified/1

-spec is_running_modified(Socket) -> Result
                             when
                                 Socket :: econfd:socket(),
                                 Result :: {ok, boolean()} | err().

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

Check if running has been modified since the last copy to startup was done.

iterate/6

-spec iterate(Socket, Tid, IKeypath, Fun, Flags, State) -> Result
                 when
                     Socket :: econfd:socket(),
                     Tid :: integer(),
                     IKeypath :: econfd:ikeypath(),
                     Fun ::
                         fun((IKeypath, Value, Attrs, State) ->
                                 {ok, Ret, State} | {error, term()}),
                     Flags :: non_neg_integer(),
                     State :: term(),
                     Result :: {ok, State} | {error, term()}.

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

Iterate over all the data in the transaction and the underlying data store.

Flags can be given as ?MAAPI_ITER_WANT_ATTR to request that attributes (if any) are passed to the Fun, otherwise it should be 0. The possible values for Ret in the return value for Fun are the same as for diff_iterate/5.

iterate_result/3

iterate_result(Sock, Fun, _)

keypath_diff_iterate/5

-spec keypath_diff_iterate(Socket, Tid, IKeypath, Fun, State) -> Result
                              when
                                  Socket :: econfd:socket(),
                                  Tid :: integer(),
                                  IKeypath :: econfd:ikeypath(),
                                  Fun ::
                                      fun((IKeypath, Op, OldValue,
                                           Value, State) ->
                                              {ok, Ret, State} |
                                              {error, term()}),
                                  State :: term(),
                                  Result ::
                                      {ok, State} | {error, term()}.

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

Iterate through a diff.

This function behaves like diff_iterate/5 with the exception that the provided keypath IKP, prunes the tree and only diffs below that path are considered.

keypath_diff_iterate/6

keypath_diff_iterate(Sock, Tid, IKP, Fun, Flags, InitState)

kill_user_session/2

-spec kill_user_session(Socket, USid) -> ok | err()
                           when
                               Socket :: econfd:socket(),
                               USid :: integer().

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

Kill a user session.

lock/2

-spec lock(Socket, DbName) -> ok | err()
              when Socket :: econfd:socket(), DbName :: dbname().

Related types: dbname(), err(), econfd:socket()

Lock a database.

lock_partial/3

-spec lock_partial(Socket, DbName, XPath) -> Result
                      when
                          Socket :: econfd:socket(),
                          DbName :: dbname(),
                          XPath :: [binary()],
                          Result :: {ok, LockId} | err().

Related types: dbname(), err(), econfd:socket()

Request a partial lock on a database.

The set of nodes to lock is specified as a list of XPath expressions.

mk_uident/1

mk_uident(UId)

move/4

-spec move(Socket, Tid, IKeypath, ToKey) -> ok | err()
              when
                  Socket :: econfd:socket(),
                  Tid :: integer(),
                  IKeypath :: econfd:ikeypath(),
                  ToKey :: econfd:key().

Related types: err(), econfd:ikeypath(), econfd:key(), econfd:socket()

Move (rename) an entry in a list.

move_ordered/4

-spec move_ordered(Socket, Tid, IKeypath, To) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          Tid :: integer(),
                          IKeypath :: econfd:ikeypath(),
                          To ::
                              first | last |
                              {before | 'after', econfd:key()}.

Related types: err(), econfd:ikeypath(), econfd:key(), econfd:socket()

Move an entry in an "ordered-by user" list.

ncs_apply_template/7

-spec ncs_apply_template(Socket, Tid, TemplateName, RootIKeypath,
                         Variables, Documents, Shared) ->
                            ok | err()
                            when
                                Socket :: econfd:socket(),
                                Tid :: integer(),
                                TemplateName :: binary(),
                                RootIKeypath :: econfd:ikeypath(),
                                Variables :: term(),
                                Documents :: term(),
                                Shared :: boolean().

Related types: err(), econfd:ikeypath(), econfd:socket()

Apply a template that has been loaded into NCS.

The TemplateName parameter gives the name of the template. The Variables parameter is a list of variables and names for substitution into the template.

ncs_apply_trans_params/4

-spec ncs_apply_trans_params(Socket, Tid, KeepOpen, Params) -> Result
                                when
                                    Socket :: econfd:socket(),
                                    Tid :: integer(),
                                    KeepOpen :: boolean(),
                                    Params :: [econfd:tagval()],
                                    Result ::
                                        ok |
                                        {ok, [econfd:tagval()]} |
                                        err().

Related types: err(), econfd:socket(), econfd:tagval()

Apply transaction with commit parameters.

This is a version of apply_trans that takes commit parameters in form of a list of tagged values according to the input parameters for rpc prepare-transaction as defined in tailf-netconf-ncs.yang module. The result of this function may include a list of tagged values according to the output parameters of rpc prepare-transaction or output parameters of rpc commit-transaction as defined in tailf-netconf-ncs.yang module.

ncs_get_trans_params/2

-spec ncs_get_trans_params(Socket, Tid) -> Result
                              when
                                  Socket :: econfd:socket(),
                                  Tid :: integer(),
                                  Result ::
                                      {ok, [econfd:tagval()]} | err().

Related types: err(), econfd:socket(), econfd:tagval()

Get transaction commit parameters.

ncs_template_variables/2

-spec ncs_template_variables(Socket, TemplateName) ->
                                {ok, binary()} | err()
                                when
                                    Socket :: econfd:socket(),
                                    TemplateName :: binary().

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

Retrieve the variables used in a template.

ncs_template_variables/3

-spec ncs_template_variables(Socket, TemplateName, Type) ->
                                {ok, binary()} | err()
                                when
                                    Socket :: econfd:socket(),
                                    TemplateName :: string(),
                                    Type :: template_type().

Related types: err(), template_type(), econfd:socket()

Retrieve the variables used in a template.

ncs_templates/1

-spec ncs_templates(Socket) -> {ok, binary()} | err()
                       when Socket :: econfd:socket().

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

Retrieve a list of the templates currently loaded into NCS.

ncs_write_service_log_entry/5

-spec ncs_write_service_log_entry(Socket, IKeypath, Message, Type,
                                  Level) ->
                                     ok | err()
                                     when
                                         Socket :: econfd:socket(),
                                         IKeypath :: econfd:ikeypath(),
                                         Message :: string(),
                                         Type :: econfd:value(),
                                         Level :: econfd:value().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Write a service log entry.

netconf_ssh_call_home/3

-spec netconf_ssh_call_home(Socket, Host, Port) -> ok | err()
                               when
                                   Socket :: econfd:socket(),
                                   Host :: econfd:ip() | string(),
                                   Port :: non_neg_integer().

Related types: err(), econfd:ip(), econfd:socket()

netconf_ssh_call_home_opaque/4

-spec netconf_ssh_call_home_opaque(Socket, Host, Opaque, Port) ->
                                      ok | err()
                                      when
                                          Socket :: econfd:socket(),
                                          Host :: econfd:ip() | string(),
                                          Opaque :: string(),
                                          Port :: non_neg_integer().

Related types: err(), econfd:ip(), econfd:socket()

num_instances/3

-spec num_instances(Socket, Tid, IKeypath) -> Result
                       when
                           Socket :: econfd:socket(),
                           Tid :: non_neg_integer(),
                           IKeypath :: econfd:ikeypath(),
                           Result :: {ok, integer()} | err().

Related types: err(), econfd:ikeypath(), econfd:socket()

Find the number of entries in a list.

perform_upgrade/2

-spec perform_upgrade(Socket, LoadPathList) -> ok | err()
                         when
                             Socket :: econfd:socket(),
                             LoadPathList :: [binary()].

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

Do in-service upgrade.

prepare_trans/2

-spec prepare_trans(Socket, Tid) -> ok | err()
                       when Socket :: econfd:socket(), Tid :: integer().

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

Equivalent to prepare_trans(Socket, Tid, 0).

prepare_trans/3

-spec prepare_trans(Socket, Tid, Flags) -> ok | err()
                       when
                           Socket :: econfd:socket(),
                           Tid :: integer(),
                           Flags :: non_neg_integer().

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

Prepare for commit.

prio_message/3

-spec prio_message(Socket, To, Message) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          To :: binary(),
                          Message :: binary().

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

Write priority message.

progress_info/6

-spec progress_info(Socket, Verbosity, Msg, SIKP, Attrs, Links) -> ok
                       when
                           Socket :: econfd:socket(),
                           Verbosity :: verbosity(),
                           Msg :: iolist(),
                           SIKP :: econfd:ikeypath(),
                           Attrs ::
                               [{K :: binary(),
                                 V :: binary() | integer()}],
                           Links ::
                               [{TraceId :: binary() | undefined,
                                 SpanId :: binary() | undefined}].

Related types: verbosity(), econfd:ikeypath(), econfd:socket()

progress_info_th/7

-spec progress_info_th(Socket, Tid, Verbosity, Msg, SIKP, Attrs, Links) ->
                          ok
                          when
                              Socket :: econfd:socket(),
                              Tid :: integer(),
                              Verbosity :: verbosity(),
                              Msg :: iolist(),
                              SIKP :: econfd:ikeypath(),
                              Attrs ::
                                  [{K :: binary(),
                                    V :: binary() | integer()}],
                              Links ::
                                  [{TraceId :: binary() | undefined,
                                    SpanId :: binary() | undefined}].

Related types: verbosity(), econfd:ikeypath(), econfd:socket()

reload_config/1

-spec reload_config(Socket) -> ok | err() when Socket :: econfd:socket().

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

Tell ConfD daemon to reload its configuration.

request_action/3

-spec request_action(Socket, Params, IKeypath) -> Result
                        when
                            Socket :: econfd:socket(),
                            Params :: [econfd:tagval()],
                            IKeypath :: econfd:ikeypath(),
                            Result ::
                                ok | {ok, [econfd:tagval()]} | err().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:tagval()

Invoke an action defined in the data model.

request_action_th/4

-spec request_action_th(Socket, Tid, Params, IKeypath) -> Result
                           when
                               Socket :: econfd:socket(),
                               Tid :: integer(),
                               Params :: [econfd:tagval()],
                               IKeypath :: econfd:ikeypath(),
                               Result ::
                                   ok | {ok, [econfd:tagval()]} | err().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:tagval()

Invoke an action defined in the data model using the provided transaction.

Does the same thing as request_action/3, but uses the current namespace, the path position, and the user session from the transaction indicated by the 'Tid' handle.

reverse/1

reverse(X)

revert/2

-spec revert(Socket, Tid) -> ok | err()
                when Socket :: econfd:socket(), Tid :: integer().

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

Remove all changes in the transaction.

set_attr/5

-spec set_attr(Socket, Tid, IKeypath, Attr, Value) -> ok | err()
                  when
                      Socket :: econfd:socket(),
                      Tid :: integer(),
                      IKeypath :: econfd:ikeypath(),
                      Attr :: integer(),
                      Value :: econfd:value() | undefined.

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Set the an attribute for an element. Value == undefined means that the attribute should be deleted.

set_comment/3

-spec set_comment(Socket, Tid, Comment) -> ok | err()
                     when
                         Socket :: econfd:socket(),
                         Tid :: integer(),
                         Comment :: binary().

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

Set the "Comment" that is stored in the rollback file when a transaction towards running is committed.

set_delayed_when/3

-spec set_delayed_when(Socket, Tid, Value) -> Result
                          when
                              Socket :: econfd:socket(),
                              Tid :: integer(),
                              Value :: boolean(),
                              Result :: {ok, OldValue} | err().

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

Enable/disable the "delayed when" mode for a transaction.

Returns the old setting on success.

set_elem/4

-spec set_elem(Socket, Tid, IKeypath, Value) -> ok | err()
                  when
                      Socket :: econfd:socket(),
                      Tid :: integer(),
                      IKeypath :: econfd:ikeypath(),
                      Value :: econfd:value().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Write an element.

set_elem2/4

-spec set_elem2(Socket, Tid, IKeypath, BinValue) -> ok | err()
                   when
                       Socket :: econfd:socket(),
                       Tid :: integer(),
                       IKeypath :: econfd:ikeypath(),
                       BinValue :: binary().

Related types: err(), econfd:ikeypath(), econfd:socket()

Write an element using the textual value representation.

set_flags/3

-spec set_flags(Socket, Tid, Flags) -> ok | err()
                   when
                       Socket :: econfd:socket(),
                       Tid :: integer(),
                       Flags :: non_neg_integer().

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

Change flag settings for a transaction.

See ?MAAPI_FLAG_XXX in econfd.hrl for the available flags, however ?MAAPI_FLAG_HIDE_INACTIVE ?MAAPI_FLAG_DELAYED_WHEN and ?MAAPI_FLAG_HIDE_ALL_HIDEGROUPS cannot be changed after transaction start (but see set_delayed_when/3).

set_label/3

-spec set_label(Socket, Tid, Label) -> ok | err()
                   when
                       Socket :: econfd:socket(),
                       Tid :: integer(),
                       Label :: binary().

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

Set the "Label" that is stored in the rollback file when a transaction towards running is committed.

set_object/4

-spec set_object(Socket, Tid, IKeypath, ValueList) -> ok | err()
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        IKeypath :: econfd:ikeypath(),
                        ValueList :: [econfd:value()].

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Write an entire object, i.e. YANG list entry or container.

set_readonly_mode/2

-spec set_readonly_mode(Socket, Mode) -> {ok, boolean()} | err()
                           when
                               Socket :: econfd:socket(),
                               Mode :: boolean().

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

Control if we can create rw transactions.

set_running_db_status/2

-spec set_running_db_status(Socket, Status) -> ok | err()
                               when
                                   Socket :: econfd:socket(),
                                   Status :: Valid | InValid.

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

Set the "running status".

set_user_session/2

-spec set_user_session(Socket, USid) -> ok | err()
                          when
                              Socket :: econfd:socket(),
                              USid :: integer().

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

Assign a user session.

set_values/4

-spec set_values(Socket, Tid, IKeypath, ValueList) -> ok | err()
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        IKeypath :: econfd:ikeypath(),
                        ValueList :: [econfd:tagval()].

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:tagval()

Write a list of tagged values.

This function is an alternative to set_object/4, and allows for writing more complex structures (e.g. multiple entries in a list).

shared_create/3

-spec shared_create(Socket, Tid, IKeypath) -> ok | err()
                       when
                           Socket :: econfd:socket(),
                           Tid :: integer(),
                           IKeypath :: econfd:ikeypath().

Related types: err(), econfd:ikeypath(), econfd:socket()

Create a new element, and also set an attribute indicating how many times this element has been created.

shared_set_elem/4

-spec shared_set_elem(Socket, Tid, IKeypath, Value) -> ok | err()
                         when
                             Socket :: econfd:socket(),
                             Tid :: integer(),
                             IKeypath :: econfd:ikeypath(),
                             Value :: econfd:value().

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:value()

Write an element from NCS FastMap.

shared_set_elem2/4

-spec shared_set_elem2(Socket, Tid, IKeypath, BinValue) -> ok | err()
                          when
                              Socket :: econfd:socket(),
                              Tid :: integer(),
                              IKeypath :: econfd:ikeypath(),
                              BinValue :: binary().

Related types: err(), econfd:ikeypath(), econfd:socket()

Write an element using the textual value representation from NCS fastmap.

shared_set_values/4

-spec shared_set_values(Socket, Tid, IKeypath, ValueList) -> ok | err()
                           when
                               Socket :: econfd:socket(),
                               Tid :: integer(),
                               IKeypath :: econfd:ikeypath(),
                               ValueList :: [econfd:tagval()].

Related types: err(), econfd:ikeypath(), econfd:socket(), econfd:tagval()

Write a list of tagged values from NCS FastMap.

snmpa_reload/2

-spec snmpa_reload(Socket, Synchronous) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          Synchronous :: boolean().

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

Tell ConfD to reload external SNMP Agent config data.

start_phase/3

-spec start_phase(Socket, Phase, Synchronous) -> ok | err()
                     when
                         Socket :: econfd:socket(),
                         Phase :: 1 | 2,
                         Synchronous :: boolean().

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

Tell ConfD to proceed to next start phase.

start_progress_span/6

-spec start_progress_span(Socket, Verbosity, Msg, SIKP, Attrs, Links) ->
                             Result
                             when
                                 Socket :: econfd:socket(),
                                 Verbosity :: verbosity(),
                                 Msg :: iolist(),
                                 SIKP :: econfd:ikeypath(),
                                 Attrs ::
                                     [{K :: binary(),
                                       V :: binary() | integer()}],
                                 Links ::
                                     [{TraceId :: binary() | undefined,
                                       SpanId1 :: binary() | undefined}],
                                 Result ::
                                     {ok,
                                      {SpanId2 :: binary() | undefined,
                                       TraceId :: binary() | undefined}}.

Related types: verbosity(), econfd:ikeypath(), econfd:socket()

start_progress_span_th/7

-spec start_progress_span_th(Socket, Tid, Verbosity, Msg, SIKP, Attrs,
                             Links) ->
                                Result
                                when
                                    Socket :: econfd:socket(),
                                    Tid :: integer(),
                                    Verbosity :: verbosity(),
                                    Msg :: iolist(),
                                    SIKP :: econfd:ikeypath(),
                                    Attrs ::
                                        [{K :: binary(),
                                          V :: binary() | integer()}],
                                    Links ::
                                        [{TraceId ::
                                              binary() | undefined,
                                          SpanId1 ::
                                              binary() | undefined}],
                                    Result ::
                                        {ok,
                                         {SpanId2 ::
                                              binary() | undefined,
                                          TraceId ::
                                              binary() | undefined}}.

Related types: verbosity(), econfd:ikeypath(), econfd:socket()

start_trans/3

-spec start_trans(Socket, DbName, RwMode) -> Result
                     when
                         Socket :: econfd:socket(),
                         DbName :: dbname(),
                         RwMode :: integer(),
                         Result :: {ok, integer()} | err().

Related types: dbname(), err(), econfd:socket()

Start a new transaction.

start_trans/4

-spec start_trans(Socket, DbName, RwMode, USid) -> Result
                     when
                         Socket :: econfd:socket(),
                         DbName :: dbname(),
                         RwMode :: integer(),
                         USid :: integer(),
                         Result :: {ok, integer()} | err().

Related types: dbname(), err(), econfd:socket()

Start a new transaction within an existing user session.

start_trans/5

-spec start_trans(Socket, DbName, RwMode, USid, Flags) -> Result
                     when
                         Socket :: econfd:socket(),
                         DbName :: dbname(),
                         RwMode :: integer(),
                         USid :: integer(),
                         Flags :: non_neg_integer(),
                         Result :: {ok, integer()} | err().

Related types: dbname(), err(), econfd:socket()

Start a new transaction within an existing user session and/or with flags.

See ?MAAPI_FLAG_XXX in econfd.hrl for the available flags. To use the existing user session of the socket, give Usid = 0.

start_trans/6

start_trans(Sock, DbName, RwMode, Usid, Flags, UId)

start_trans_in_trans/4

-spec start_trans_in_trans(Socket, RwMode, USid, Tid) -> Result
                              when
                                  Socket :: econfd:socket(),
                                  RwMode :: integer(),
                                  USid :: integer(),
                                  Tid :: integer(),
                                  Result :: {ok, integer()} | err().

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

Start a new transaction with an existing transaction as backend.

To use the existing user session of the socket, give Usid = 0.

start_trans_in_trans/5

-spec start_trans_in_trans(Socket, RwMode, USid, Tid, Flags) -> Result
                              when
                                  Socket :: econfd:socket(),
                                  RwMode :: integer(),
                                  USid :: integer(),
                                  Tid :: integer(),
                                  Flags :: non_neg_integer(),
                                  Result :: {ok, integer()} | err().

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

Start a new transaction with an existing transaction as backend.

To use the existing user session of the socket, give Usid = 0.

start_user_session/6

-spec start_user_session(Socket, UserName, Context, Groups, SrcIp,
                         Proto) ->
                            ok | err()
                            when
                                Socket :: econfd:socket(),
                                UserName :: binary(),
                                Context :: binary(),
                                Groups :: [binary()],
                                SrcIp :: econfd:ip(),
                                Proto :: proto().

Related types: err(), proto(), econfd:ip(), econfd:socket()

Equivalent to start_user_session(Socket, UserName, Context, Groups, SrcIp, 0, Proto).

start_user_session/7

-spec start_user_session(Socket, UserName, Context, Groups, SrcIp,
                         SrcPort, Proto) ->
                            ok | err()
                            when
                                Socket :: econfd:socket(),
                                UserName :: binary(),
                                Context :: binary(),
                                Groups :: [binary()],
                                SrcIp :: econfd:ip(),
                                SrcPort :: non_neg_integer(),
                                Proto :: proto().

Related types: err(), proto(), econfd:ip(), econfd:socket()

Equivalent to start_user_session(Socket, UserName, Context, Groups, SrcIp, 0, Proto, undefined).

start_user_session/8

-spec start_user_session(Socket, UserName, Context, Groups, SrcIp,
                         SrcPort, Proto, UId) ->
                            ok | err()
                            when
                                Socket :: econfd:socket(),
                                UserName :: binary(),
                                Context :: binary(),
                                Groups :: [binary()],
                                SrcIp :: econfd:ip(),
                                SrcPort :: non_neg_integer(),
                                Proto :: proto(),
                                UId ::
                                    confd_user_identification() |
                                    undefined.

Related types: confd_user_identification(), err(), proto(), econfd:ip(), econfd:socket()

Initiate a new maapi user session.

returns a maapi session id. Before we can execute any maapi functions we must always have an associated user session.

stop/1

-spec stop(Socket) -> ok when Socket :: econfd:socket().

Related types: econfd:socket()

Equivalent to stop(Sock, true).

Tell ConfD daemon to stop, returns when daemon has exited.

stop/2

-spec stop(Socket, Synchronous) -> ok
              when Socket :: econfd:socket(), Synchronous :: boolean().

Related types: econfd:socket()

Tell ConfD daemon to stop, if Synchronous is true won't return until daemon has come to a halt.

Note that the socket will most certainly not be possible to use again, since ConfD will close its end when it exits.

sys_message/3

-spec sys_message(Socket, To, Message) -> ok | err()
                     when
                         Socket :: econfd:socket(),
                         To :: binary(),
                         Message :: binary().

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

Write system message.

unhide_group/3

-spec unhide_group(Socket, Tid, GroupName) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          Tid :: integer(),
                          GroupName :: binary().

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

Do unhide a hide group.

Unhide all nodes belonging to a hide group in a transaction that started with flag FLAG_HIDE_ALL_HIDEGROUPS.

unlock/2

-spec unlock(Socket, DbName) -> ok | err()
                when Socket :: econfd:socket(), DbName :: dbname().

Related types: dbname(), err(), econfd:socket()

Unlock a database.

unlock_partial/2

-spec unlock_partial(Socket, LockId) -> ok | err()
                        when
                            Socket :: econfd:socket(),
                            LockId :: integer().

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

Remove the partial lock identified by LockId.

user_message/4

-spec user_message(Socket, To, From, Message) -> ok | err()
                      when
                          Socket :: econfd:socket(),
                          To :: binary(),
                          From :: binary(),
                          Message :: binary().

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

Write user message.

validate_trans/4

-spec validate_trans(Socket, Tid, UnLock, ForceValidation) -> ok | err()
                        when
                            Socket :: econfd:socket(),
                            Tid :: integer(),
                            UnLock :: boolean(),
                            ForceValidation :: boolean().

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

Validate the transaction.

wait_start/1

-spec wait_start(Socket) -> ok | err() when Socket :: econfd:socket().

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

Equivalent to wait_start(Socket, 2).

Wait until ConfD daemon has completely started.

wait_start/2

-spec wait_start(Socket, Phase) -> ok | err()
                    when Socket :: econfd:socket(), Phase :: 1 | 2.

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

Wait until ConfD daemon has reached a certain start phase.

xpath_eval/6

-spec xpath_eval(Socket, Tid, Expr, ResultFun, State, Options) -> Result
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        Expr :: binary() | {compiled, Source, Compiled},
                        ResultFun ::
                            fun((IKeypath, Value, State) -> {Ret, State}),
                        State :: term(),
                        Options ::
                            [xpath_eval_option() | {initstate, term()}],
                        Result :: {ok, State} | err().

Related types: err(), xpath_eval_option(), econfd:socket()

Evaluate the XPath expression Expr, invoking ResultFun for each node in the resulting node set.

The possible values for Ret in the return value for ResultFun are ?ITER_CONTINUE and ?ITER_STOP.

xpath_eval/7

-spec xpath_eval(Socket, Tid, Expr, ResultFun, TraceFun, State, Context) ->
                    Result
                    when
                        Socket :: econfd:socket(),
                        Tid :: integer(),
                        Expr :: binary(),
                        ResultFun ::
                            fun((IKeypath, Value, State) -> {Ret, State}),
                        TraceFun ::
                            fun((binary()) -> none()) | undefined,
                        State :: term(),
                        Context :: econfd:ikeypath() | [],
                        Result :: {ok, State} | {error, term()}.

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

Evaluate the XPath expression Expr, invoking ResultFun for each node in the resulting node set.

The possible values for Ret in the return value for ResultFun are ?ITER_CONTINUE and ?ITER_STOP.

xpath_eval_expr/4

-spec xpath_eval_expr(Socket, Tid, Expr, Options) -> Result
                         when
                             Socket :: econfd:socket(),
                             Tid :: integer(),
                             Expr ::
                                 binary() | {compiled, Source, Compiled},
                             Options :: [xpath_eval_option()],
                             Result :: {ok, binary()} | err().

Related types: err(), xpath_eval_option(), econfd:socket()

Evaluate the XPath expression Expr, returning the result as a string.

xpath_eval_expr/5

-spec xpath_eval_expr(Socket, Tid, Expr, TraceFun, Context) -> Result
                         when
                             Socket :: econfd:socket(),
                             Tid :: integer(),
                             Expr :: binary(),
                             TraceFun ::
                                 fun((binary()) -> none()) | undefined,
                             Context :: econfd:ikeypath() | [],
                             Result :: {ok, binary()} | err().

Related types: err(), econfd:ikeypath(), econfd:socket()

Evaluate the XPath expression Expr, returning the result as a string.

xpath_eval_expr_loop/2

xpath_eval_expr_loop(Sock, TraceFun)

xpath_eval_loop/4

xpath_eval_loop(Sock, ResultFun, TraceFun, State)

Last updated

Was this helpful?