I have implemented the get_next_object callback but my list contains a choice statement (something like the example below):
list adjacency {
key "index";
leaf index {
type uint8;
}
choice adj-type {
mandatory "true";
case simple {
leaf interface {
type string;
}
leaf gateway {
type string;
}
leaf uptime {
type string;
}
}
case special {
leaf special-type {
type enumeration {
enum blackhole {}
enum unreachable {}
}
}
}
}
}
After the call to get_next_object
, there is a call to get_case
to resolve the case of the list entry. The problem is that this operation can be quite expensive since the mapping is between a keyed list (shown above) and a keyless list which is slowing down our performance.
Is there a way to avoid the additional call to get_case
and return the case in the get_next_object
return?
I have tried returning the case value in the Object return but I get the following error:
get_next_object_cb(T, KP, Prev) ->
...
{ok,
[{exml,
[{'index', Index},
{'adj-type', AdjCase},
{'interface', Interface},
{'gateway', Gateway},
{'uptime', Uptime},
{'special-type', SpecialType}]}, ...
]}.
<ERR> ... : devel-c bad get_next_object() return value: .../adjacency{1}: adj-type is not a child element
Which makes sense since it is not part of the schema technically. But, either way, we are retrieving 200 of these objects at a time which should increase efficiency but since we have to call get_case for each one we are losing a lot of potential performance increases.
Is there a way to avoid that call (using econfd)?