On Tue, 2009-08-18 at 18:09 +0200, Jan Friesse wrote:
> This feature should allow app to get cpg groups and members. It's
> modeled like ckpt section iteration, so:
>
> Data types:
>
> /* Handle to cpg_iteration instance */
> typedef uint64_t cpg_iteration_handle_t;
>
> /* Type of iteration */
> typedef enum {
> CPG_ITERATION_NAME_ONLY = 1, /* We will return only group names,
> and nodeid + pid will be set to 0*/
> CPG_ITERATION_ONE_GROUP = 2, /* Return only members of one
> specified group*/
> CPG_ITERATION_ALL = 3, /* Return everything*/
> } cpg_iteration_type_t;
>
> /* Result of calling cpg_iteration_next */
> struct cpg_iteration_description_t {
> struct cpg_name group; /* Group name, always set */
> uint32_t nodeid;
> uint32_t pid;
> };
>
> Functions:
> /* Initialize iteration. in case
> iteration_type == CPG_ITERATION_ONE_GROUP -> group must be set,
> otherwise it must be NULL.
> */
> cs_error_t cpg_iteration_initialize(
> cpg_handle_t handle,
> cpg_iteration_type_t iteration_type,
> const struct cpg_name *group,
> cpg_iteration_handle_t *cpg_iteration_handle);
>
> /* Return ONE cpg_iteration_description_t item*/
> cs_error_t cpg_iteration_next(
> cpg_iteration_handle_t handle,
> struct cpg_iteration_description_t *description);
>
> /* No comment */
> cs_error_t cpg_iteration_finalize (
> cpg_iteration_handle_t handle);
>
>
> This scheme should be very scalable. In corosync service part, snapshot
> of process_info is created in time of cpg_iteration_initialize call and
> cpg_iteration_nex will return items from this snapshot. Snapshot is
> "GROUPED BY" group_name so this should make displaying group with all
> members easier, and reduce number of calls, because without this featur
> it will mean to.
> foreach grp_name in (get group names);do
> foreach grp_member in (get group items in group grp_name);do
> print grp_member_info
> done
> done
>
looks good
> what is not only more ugly, but there can be potentially risk of delete
> of group before displaying content.
>
> One part, where I'm not so sure is cpg_iteration_type_t data type. It
> can be:
> - enum as it is
use enums
> - or bit-field, with bits for NAME_ONLY and GROUP_SPECIFIED. This will
> make fourth case (both bits set), which isn't very useful from practical
> point of view, but it's possible (return name of group which user will
> enter).
>
don't use bit fields
> Comments (like better, more self-explaining names, ...) are highly welcomed.
>
names look good
comments should follow coding style. Specifically one line comments are
not allowed and should use
/*
* comment
*/
> Regards,
> Honza
>
Good work Honza. The api looks solid. Let us know when you have an
implementation.
Regards
-steve
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais