ConfD User Community

Could ConfD add two callbacks in struct confd_data_cbs?


#1

I found it is really difficult to manage the resources of the operational data.

  1. As the previous post described, it’s difficult to get all leafs in one container in one swoop.
  2. As described In ConfD User Guide and examples, all data is allocated in trans init function, but I don’t think it is the suitable place to initialize the resources, because I couldn’t init all of them if I have a large amount of data could be shown. Suppose we have hundreds of show commands, a user logs in and type only one command, and then exit, but we actually init another hundreds of resources for vain.
  3. If the resource should be allocated dynamically when each show command executes, we have to allocate the resource at the beginning of the command, and release the resource at the end of the command. Currently there is no way to implement this.

start() invoked at the beginning when each show command executes, while end() invoked at when the show command has been finished.

struct confd_data_cbs {
    void *user;
    int (*start)(void *user);
    int (*end)(void *user);
    ...
}

#2

One way to address your resource issues is to divide up your operational data into multiple daemons and register your multiple callpoints accordingly. Only the corresponding transaction init calls will be invoked when that portion of the operational data model that pertains to its callpoint is being displayed by using the show command.


#3

Well, thanks for suggestion, but I don’t think dividing up operational data into multiple daemons is suitable for us.
First of all, there are too many show commands in one logic module, eg. 100 show commands, suppose 10 callpoints a daemon, we’ll have 10 daemons which will be as many as 10 * 10 = 100 callpoints.
Second, all the resources, such as list, memory pool, trees, and any other data structure needed to perform some tasks have to be together in one logic module, if we show them in different daemons, we must add interfaces to fetch the show data.
And last, as the picture(in section 6.7 of confd user guide) of even sequence showing the transactions finish() calls won’t be invoked util user exit the CLI, If we execute all the show commands, but don’t exit the cli, we’ll occupy large memories.


#4

If the concern is in the significant amount of cached data due to a lot of CLI ‘show’ commands having been executed in one CLI session", you can either

- implement your own timeouts for the caches, freeing them when they haven't
  been accessed "for a while", or

- use /confdConfig/cli/reallocateOperTrans.

The addition of the end_of_command( ) “data callback” in a future release is a possibility.


#5

This is helpful currently, I thanks very much. I’m looking forward to the future release.