ConfD User Community

Implement a hook in erlang


#1

hi every one, i am an Erlang dev
i have a container like this


i want to write a hook which invoked whenever an element in ls1 is created, the hook will add an item with same name in ls2 and auto-increase id, but i cant find any examples for implementing hook in erlang ? Would you give me an example ? thanks so much


#2

There is an example of a transform as an embedded Erlang application in examples.confd/internal_econfd/embedded_applications/transform in the release. A hook is implementation-wise basically a subset of a transform (no “read” callbacks, only the “write” callbacks that you actually want), plus a different annotation in the YANG module, of course.


#3

thanks for your reply i will try it !