Zookeeper c api common variable comments

Source: Internet
Author: User
Tags zookeeper client

See include/zookeeper. h

Watches
1) all read operations of zookeeper -- getdata (), getchildren (), and exists () can be set to watch. monitoring events can be considered as one-time triggers.
2) only after the client first sees the monitoring event will it perceive that the znode it sets to monitor has changed
3) data monitoring and subnode monitoring (Data watches and child watches) getdata () and exists () set data monitoring and getchildren () set sub-node monitoring
Therefore, setdata () triggers the data monitoring settings set on a node (assuming that the data settings are successful), and a successful create () the Operation will start the data monitoring set on the current node and the child node monitoring of the parent node. A successful Delete () operation triggers the data monitoring and child node monitoring events of the current node, and also triggers the Child Watch of the parent node of the node.
========================================================== ========================================================== ========================================================
Constants related to znode Access Permissions

• Const int zoo_perm_read; // allows the client to read the znode value and subnode list.

• Const int zoo_perm_write; // allows the client to set the znode value.

• Const int zoo_perm_create; // allows the client to create a subnode under the znode node.

• Const int zoo_perm_delete; // allows the client to delete subnodes.

• Const int zoo_perm_admin; // allows the client to execute set_acl ().

• Const int zoo_perm_all; // allows the client to perform all the operations, which is equivalent to the OR (OR) of all the preceding flags ).

Constants related to ACL IDS

• Struct ID zoo_anyone_id_unsafe; // ('World', 'anyone ')

• Struct ID zoo_auth_ids; // ('auth ','')

Three standard ACLs

• Struct acl_vector zoo_open_acl_unsafe; // (zoo_perm_all, zoo_anyone_id_unsafe)

• Struct acl_vector zoo_read_acl_unsafe; // (zoo_perm_read, zoo_anyone_id_unsafe)

• Struct acl_vector zoo_creator_all_acl; // (zoo_perm_all, zoo_auth_ids)

Zoo_create function flag. zoo_ephemeral is used to identify the creation of a temporary node, and zoo_sequence is used to identify the node name with an incremental suffix serial number

========================================================== ========================================================== ========================================================
Common zookeeper C return values

Zok normal return
 
Zconnectionloss zookeeper client and server lost connection
 
Node does not exist)
 
Znoauth is not authorized (not authenticated)
 
Znochildrenforephemerals temporary nodes cannot have subnodes (ephemeral nodes may not have children)
 
Znodeexists node already exists (the node already exists)
 
Znotempty this node has its own subnode (the node has children)
 
Zsessionexpired session expiration (the session has been expired by the server)
 
Invalid zinvalidcallback callback function (invalid callback specified)
 
Invalid zinvalidacl ACL (invalid ACL specified)
 
Zauthfailed client Authorization failed (client authentication failed)
 
Zclosing zookeeper Connection closed (zookeeper is closing)
========================================================== ========================================================== ========================================================
Constant related to the monitoring type (watch types)
The following constants identify the types of monitoring events, which are usually used as the first parameter of the monitor callback function.
• Zoo_created_event; // The node is created (this node does not exist before) and is monitored through zoo_exists.
• Zoo_deleted_event; // The node is deleted and monitored through zoo_exists () and zoo_get.
• Zoo_changed_event; // The Node changes and is monitored through zoo_exists () and zoo_get.
• Zoo_child_event; // subnode events are monitored through zoo_get_children () and zoo_get_children2.
• Zoo_session_event; // session loss
• Zoo_notwatching_event; // monitoring is removed.
========================================================== ========================================================== ========================================================
Constants related to the connection status stat
The following constants are related to the zookeeper connection status. They are usually used as parameters of the monitor callback function.
Zooapi const int zoo_expired_session_state
Zooapi const int zoo_auth_failed_state
Zooapi const int zoo_connecting_state
Zooapi const int zoo_associating_state
Zooapi const int zoo_connected_state
========================================================== ========================================================== ========================================================
Typedef void (* watcher_fn) (zhandle_t * zh, int type, int state, const char * path, void * watcherctx );
Parameters of the monitoring function prototype are described as follows:
Zh zookeeper handle (handle)
Type event type. * _ One of the event constants.
State connection state (connection state). The State value is one of the * _ state constants.
Path: the path of the znode node that triggers the monitoring event. If it is null, the event type is zoo_session_event.
Watcherctx monitor context (watcher context ).

========================================================== ========================================================== ========================================================
Note:
Zoo_init is an asynchronous function. If a non-zero stat parameter is required next to it, Initialization is required.
Generally, two or more watcher types are defined. One watcher is used to monitor initialization and shutdown.
The synchronous and asynchronous interfaces need to be used according to the situation. The synchronization efficiency is not highly asynchronous, but the result is guaranteed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.