-
-
Notifications
You must be signed in to change notification settings - Fork 0
Code Review Comments
Mehul Prajapati edited this page Sep 11, 2018
·
1 revision
Please follow the naming convention. This function operates on LogQueueRedis, its name should represent that. For example log_queue_redis_new.
A little information about new, free, init, deinit,
- new should allocate the memory, and set default values in the structure. (set virtual functions).
- free should as its name suggest deallocate memory. (Everything connected to the structure, in some case deallocation means calling unref, if the used structure is reference counted).
- init it should operate on structures created by new, and it should make the structure operational: opening files, starting threads, timers anything that is needed for the working object. The init might be called twice or more, without deinit, and it should be handle it.
- deinit it should not deallocate, but rather stop those items that have been started with init or later with other functions.
The creation of the redis queue should be in the acquire queue function.
- attach this tasks is to attach the current plugin to the DestinationDriver, by attach I mean adding its own hooks to the DD functions.
- detach should undo all the things are done in attach (like reverting the virtual function change, but in this case it can be ignored and do nothing)
- The release and acquire actually the DD functions, which we want to change, when a destination driver wants to initialize it has to get a queue, and the DD internal init shall handle if there is no queue to get. The acquire queue should return with NULL, if it cannot connect to redis.
- The free shall be called from the release queue, and not from detach.