Subscriber reading from socket granularity

Hello,

What’s do the socket read APIs in confd_lib_cdb read?

For an edit-config message, I was wondering if cdb_read_subscription_socket() (or cdb_read_subscription_socket2()) reads the entire edit-config message into buffer?

Does cdb_diff_iterate() also read from the socket, or does it merely iterate through the buffer that cdb_read_subscription_socket*() read to? If cdb_diff_iterate() also reads from the socket, then what are the contents read by cdb_read_subscription_socket*() and cdb_diff_iterate() ?

Thanks,
Helen

Helen,
If you want to look at the interaction between the application and the ConfD daemon process, you can set the debug level in confd_init() to CONFD_PROTO_TRACE. There you will see an API trace, so that is the interaction between your application and the ConfD library, and then some message exchanges between the library and the ConfD daemon process. The trace may be a bit confusing but I think you will be able to see the message exchange happening between your application and the ConfD daemon process.

When you call cdb_read_subscription_socket() you are finding out which of your subscriptions may have been triggered. Remember you can have multiple subscriptions, and if they are at the same priority level, and the transaction modifies something in each subscription, then ConfD is telling you that one or more of your subscriptions have been triggered. At this point no data has been sent to your application because ConfD doesn’t know how you will process the change. Your application could decide to just read the data from CDB, in which each cdb_get_* call would trigger an exchange between your application and ConfD.

If you call cdb_diff_iterate(), then each iteration will read from the socket. There may be more exchanges, again depending on how you have coded your application. But ConfD is not passing the entire set of changes back to your application at once and then your application just processes it change by change, each request for a change by calling cdb_diff_iterate, will result in data coming from ConfD.