summaryrefslogtreecommitdiffstats
path: root/aconf/model/node.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/model/node.lua')
-rw-r--r--aconf/model/node.lua26
1 files changed, 22 insertions, 4 deletions
diff --git a/aconf/model/node.lua b/aconf/model/node.lua
index 7296446..70aa4fc 100644
--- a/aconf/model/node.lua
+++ b/aconf/model/node.lua
@@ -43,6 +43,10 @@ function M.BoundMember:init(parent, name, field)
self.addr = pth.to_absolute(self.addr, pmt.addr)
end
+ --- get parent object of an object.
+ -- @function node.parent
+ -- @tparam node.TreeNode node object
+ -- @treturn node.TreeNode parent object
local context = {
txn=pmt.txn,
privileged=pmt.privileged,
@@ -71,7 +75,9 @@ end
-- assign a structure of Lua tables as the value. This results in
-- replacing the entire subtree with the provided sturcture. Providing
-- a string in lieu of a complex value is handled by interpreting the
--- string as a path and copying the subtree it refers to.
+-- string as a path and copying the subtree it refers to. Comparison
+-- of these instances with the == operator returns true if the
+-- instances represent the same object.
-- @klass node.TreeNode
M.TreeNode = class()
@@ -83,7 +89,13 @@ function M.TreeNode:init(context, params)
local mt = getmetatable(self)
update(mt, context)
+ --- get the name of the object, i.e. the last component of its
+ -- absolute path.
+ -- @function node.name
+ -- @tparam node.TreeNode node object
+ -- @treturn string name
mt.name = pth.name(mt.path)
+
mt.__eq = equal_tns
mt.__pairs = M.pairs
@@ -260,6 +272,12 @@ function M.TreeNode:init(context, params)
end
+--- collection object, inherits @{node.TreeNode}. An instance of this class
+-- represents a collection object in the data model, in the context of
+-- a specific transaction. The path of a collection member is that of
+-- the collection augmented by the respective key. The size of the
+-- collection can be queried using the # operator.
+-- @klass node.Collection
M.Collection = class(M.TreeNode)
function M.Collection:init(context, params)
@@ -362,9 +380,9 @@ function M.Collection:init(context, params)
end
---- list object, inherits @{node.TreeNode}. An instance of this class
--- represents a list object in the data model, in the context of a
--- specific transaction. A list is an ordered collection of
+--- list object, inherits @{node.Collection}. An instance of this
+-- class represents a list object in the data model, in the context of
+-- a specific transaction. A list is an ordered collection of
-- members. The path of a list member is that of the list augmented by
-- the index of the member.
-- @klass node.List