[
https://issues.apache.org/jira/browse/ZOOKEEPER-781?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Qian Ye updated ZOOKEEPER-781:
------------------------------
Attachment: ZOOKEEPER-781.patch
add a draft patch for c client. Here, I add two function prototypes to support
the strategy pattern. The conn_chooser_fn is used to initialize the hosts list,
before the prime connection, and the conn_picker_fn is used to descide which
hosts will be used in the next connection.
typedef int (*conn_chooser_fn)(int addrs_count, int *connect_index,
struct sockaddr_storage *addrs);
typedef int (*conn_picker_fn)(int addrs_count, int *connect_index,
struct sockaddr_storage *addrs);
the patch provide two build-in strategies, which support ordered round robin
and randomized round robin like the previous version. Programmers can set their
own chooser and piccker when they initalize the zookeeper handler.
> provide a generalized "connection strategy" for ZooKeeper clients
> -----------------------------------------------------------------
>
> Key: ZOOKEEPER-781
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-781
> Project: ZooKeeper
> Issue Type: New Feature
> Components: c client, java client
> Reporter: Patrick Hunt
> Fix For: 3.4.0
>
> Attachments: ZOOKEEPER-781.patch
>
>
> A connection strategy allows control over the way that ZooKeeper clients (we
> would implement this for both c and java apis) connect to a serving ensemble.
> Today we have two strategies, randomized round robin (default) and ordered
> round robin, both of which are hard coded into the client implementation. We
> would generalize this interface and allow users to create their own.
> See this page for more detail:
> http://wiki.apache.org/hadoop/ZooKeeper/ConnectionStrategy
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.