econfd_schema Module
Support for using schema information in the Erlang API.
Keeps schema info in a set of ets tables named by the toplevel namespace.
Types
confd_cs_choice/0
-type confd_cs_choice() :: #confd_cs_choice{}.confd_cs_node/0
-type confd_cs_node() :: #confd_cs_node{}.confd_nsinfo/0
-type confd_nsinfo() :: #confd_nsinfo{}.confd_type_cbs/0
-type confd_type_cbs() :: #confd_type_cbs{}.Functions
choice_children/1
-spec choice_children(Node) -> Children
when
Node ::
confd_cs_node() |
[econfd:qtag() | confd_cs_choice()],
Children :: [econfd:qtag()].Related types: confd_cs_choice(), confd_cs_node(), econfd:qtag()
Get a flat list of children for a confd_cs_node(), with any choice/case structure(s) removed.
get_builtin_type/1
get_builtin_type(_)get_cs/2
-spec get_cs(Ns, Tagpath) -> Result
when
Ns :: econfd:namespace(),
Tagpath :: econfd:tagpath(),
Result :: confd_cs_node() | not_found.Related types: confd_cs_node(), econfd:namespace(), econfd:tagpath()
Find schema node by namespace and tagpath.
get_nslist/0
-spec get_nslist() -> [confd_nsinfo()].Related types: confd_nsinfo()
Get a list of loaded namespaces with info.
get_type/1
-spec get_type(TypeName) -> Result
when
TypeName :: atom(),
Result :: econfd:type() | not_found.Related types: econfd:type()
Get schema type definition identifier for built-in type.
get_type/2
-spec get_type(Ns, TypeName) -> econfd:type()
when Ns :: econfd:namespace(), TypeName :: atom().Related types: econfd:namespace(), econfd:type()
Get schema type definition identifier for type defined in namespace.
ikeypath2cs/1
-spec ikeypath2cs(IKeypath) -> Result
when
IKeypath :: econfd:ikeypath(),
Result :: confd_cs_node() | not_found.Related types: confd_cs_node(), econfd:ikeypath()
Find schema node by ikeypath.
ikeypath2nstagpath/1
ikeypath2nstagpath(IKeypath)ikeypath2nstagpath/2
ikeypath2nstagpath(T, Acc)load/1
-spec load(Path) -> Result
when
Path :: string(),
Result :: ok | {error, econfd:error_reason()}.Related types: econfd:error_reason()
Load schema info from ConfD.
load/2
-spec load(Address, Port) -> Result
when
Address :: econfd:ip(),
Port :: non_neg_integer(),
Result :: ok | {error, econfd:error_reason()}.Related types: econfd:error_reason(), econfd:ip()
register_type_cbs/1
-spec register_type_cbs(TypeCbs) -> ok when TypeCbs :: confd_type_cbs().Related types: confd_type_cbs()
Register callbacks for a user-defined type. For an application running in its own Erlang VM, this function registers the callbacks in the loaded schema information, similar to confd_register_node_type() in the C API. For an application running inside ConfD, this function registers the callbacks in ConfD's internal schema information, similar to using a shared object with confd_type_cb_init() in the C API.
str2val/2
-spec str2val(TypeId, Lexical) -> Result
when
TypeId :: confd_cs_node() | econfd:type(),
Lexical :: binary(),
Result ::
{ok, Value :: econfd:value()} |
{error, econfd:error_reason()}.Related types: confd_cs_node(), econfd:error_reason(), econfd:type(), econfd:value()
Convert string to value based on schema type.
Note: For type identityref below a mount point (device data in NSO), TypeId must be confd_cs_node().
val2str/2
-spec val2str(TypeId, Value) -> Result
when
TypeId :: confd_cs_node() | econfd:type(),
Value :: econfd:value(),
Result ::
{ok, string()} | {error, econfd:error_reason()}.Related types: confd_cs_node(), econfd:error_reason(), econfd:type(), econfd:value()
Convert value to string based on schema type.
Last updated
Was this helpful?

