This is an automated email from the ASF dual-hosted git repository.
xyuanlu pushed a commit to branch metaclient
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/metaclient by this push:
new 18daa5526 Fix typos and styles in metaclient (#2382)
18daa5526 is described below
commit 18daa5526c3e31341361f069e3389a7e4b6a0a80
Author: Qi (Quincy) Qu <[email protected]>
AuthorDate: Thu Feb 23 17:02:04 2023 -0500
Fix typos and styles in metaclient (#2382)
---
.../helix/metaclient/api/MetaClientInterface.java | 61 ++++++++++------------
.../helix/metaclient/impl/zk/ZkMetaClient.java | 16 +++---
2 files changed, 35 insertions(+), 42 deletions(-)
diff --git
a/meta-client/src/main/java/org/apache/helix/metaclient/api/MetaClientInterface.java
b/meta-client/src/main/java/org/apache/helix/metaclient/api/MetaClientInterface.java
index af9a170b4..e13c61bfb 100644
---
a/meta-client/src/main/java/org/apache/helix/metaclient/api/MetaClientInterface.java
+++
b/meta-client/src/main/java/org/apache/helix/metaclient/api/MetaClientInterface.java
@@ -77,8 +77,8 @@ public interface MetaClientInterface<T> {
* TODO: we will add session ID to entry stats in the future
*/
class Stat {
- private int _version;
- private EntryMode _entryMode;
+ private final int _version;
+ private final EntryMode _entryMode;
public EntryMode getEntryType() {
return _entryMode;
@@ -97,7 +97,7 @@ public interface MetaClientInterface<T> {
//synced CRUD API
/**
- * Create an persistent entry with given key and data. The entry will not be
created if there is
+ * Create a persistent entry with given key and data. The entry will not be
created if there is
* an existing entry with the same key.
* @param key key to identify the entry
* @param data value of the entry
@@ -129,7 +129,7 @@ public interface MetaClientInterface<T> {
* current data and apply updater upon the current data.
* @param key key to identify the entry
* @param updater An updater that modifies the entry value.
- * @return: the updated value.
+ * @return the updated value.
*/
T update(final String key, DataUpdater<T> updater);
@@ -161,7 +161,7 @@ public interface MetaClientInterface<T> {
* a parent key,
* For metadata storage that has non-hierarchical key space (e.g.
etcd), the key would
* be a prefix key.
- * @eturn Return a list of children keys. Return direct child name only for
hierarchical key
+ * @return Return a list of children keys. Return direct child name only for
hierarchical key
* space, return the whole sub key for non-hierarchical key space.
*/
List<String> getDirectChildrenKeys(final String key);
@@ -212,7 +212,7 @@ public interface MetaClientInterface<T> {
* @param key key to identify the entry
* @param data value of the entry
* @param mode EntryMode identifying if the entry will be deleted upon
client disconnect
- * @param cb An user defined VoidCallback implementation that will be
invoked when async create return.
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async create return.
* @see org.apache.helix.metaclient.api.AsyncCallback.VoidCallback
*/
void asyncCreate(final String key, final T data, final EntryMode mode,
@@ -223,7 +223,7 @@ public interface MetaClientInterface<T> {
* @param key key to identify the entry
* @param data new data of the entry
* @param version expected version if the entry. -1 matched any version
- * @param cb An user defined VoidCallback implementation that will be
invoked when async create return.
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async create return.
* @see org.apache.helix.metaclient.api.AsyncCallback.StatCallback
*/
void asyncSet(final String key, final T data, final int version,
AsyncCallback.StatCallback cb);
@@ -232,7 +232,7 @@ public interface MetaClientInterface<T> {
* The asynchronous version of update.
* @param key key to identify the entry
* @param updater An updater that modifies the entry value.
- * @param cb An user defined VoidCallback implementation that will be
invoked when async create return.
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async create return.
* It will contain the newly updated data if update succeeded.
* @see org.apache.helix.metaclient.api.AsyncCallback.DataCallback
*/
@@ -241,7 +241,7 @@ public interface MetaClientInterface<T> {
/**
* The asynchronous version of get.
* @param key key to identify the entry
- * @param cb An user defined VoidCallback implementation that will be
invoked when async get return.
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async get return.
* It will contain the entry data if get succeeded.
* @see org.apache.helix.metaclient.api.AsyncCallback.DataCallback
*/
@@ -250,7 +250,7 @@ public interface MetaClientInterface<T> {
/**
* The asynchronous version of get sub entries.
* @param key key to identify the entry
- * @param cb An user defined VoidCallback implementation that will be
invoked when async count child return.
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async count child return.
* It will contain the list of child keys if succeeded.
* @see org.apache.helix.metaclient.api.AsyncCallback.DataCallback
*/
@@ -259,7 +259,7 @@ public interface MetaClientInterface<T> {
/**
* The asynchronous version of get sub entries.
* @param key key to identify the entry
- * @param cb An user defined VoidCallback implementation that will be
invoked when async exist return.
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async exist return.
* It will contain the stats of the entry if succeeded.
* @see org.apache.helix.metaclient.api.AsyncCallback.StatCallback
*/
@@ -268,7 +268,7 @@ public interface MetaClientInterface<T> {
/**
* The asynchronous version of delete.
* @param key key to identify the entry
- * @param cb An user defined VoidCallback implementation that will be
invoked when async delete
+ * @param cb A user defined VoidCallback implementation that will be invoked
when async delete
* finish and return. @see
org.apache.helix.metaclient.api.AsyncCallback.DataCallback
*/
void asyncDelete(final String key, AsyncCallback.VoidCallback cb);
@@ -276,7 +276,7 @@ public interface MetaClientInterface<T> {
/**
* The asynchronous version of transaction operations.
* @param ops A list of operations
- * @param cb An user defined TransactionCallback implementation that will be
invoked when
+ * @param cb A user defined TransactionCallback implementation that will be
invoked when
* transaction operations finish and return. The
TransactionCallback will contain
* either a list of OpResult if transaction finish successfully,
or a return code
* indicating failure reason. @see
org.apache.helix.metaclient.api.AsyncCallback.TransactionCallback
@@ -381,11 +381,10 @@ public interface MetaClientInterface<T> {
* of the given key.
* The listener should be permanent until it's unsubscribed.
* @param key Key to identify the entry
- * @param listener An implementation of DataChangeListener
- * @see org.apache.helix.metaclient.api.DataChangeListener
- * @param skipWatchingNonExistNode Will not register lister to an non-exist
key if set to true.
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.DataChangeListener} to register
+ * @param skipWatchingNonExistNode Will not register lister to a non-exist
key if set to true.
* Please set to false if you are expecting
ENTRY_CREATED type.
- * @return Return an boolean indication if subscribe succeeded.
+ * @return Return a boolean indication if subscribe succeeded.
*/
boolean subscribeDataChange(String key, DataChangeListener listener, boolean
skipWatchingNonExistNode);
@@ -394,11 +393,10 @@ public interface MetaClientInterface<T> {
* of the given key.
* The implementation should use at-most-once delivery semantic.
* @param key Key to identify the entry
- * @param listener An implementation of DataChangeListener
- * @see org.apache.helix.metaclient.api.DataChangeListener
- * @param skipWatchingNonExistNode Will not register lister to an non-exist
key if set to true.
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.DataChangeListener} to register
+ * @param skipWatchingNonExistNode Will not register lister to a non-exist
key if set to true.
* Please set to false if you are expecting
ENTRY_CREATED type.
- * @return Return an boolean indication if subscribe succeeded.
+ * @return Return a boolean indication if subscribe succeeded.
*/
default boolean subscribeOneTimeDataChange(String key, DataChangeListener
listener,
boolean skipWatchingNonExistNode) {
@@ -412,11 +410,10 @@ public interface MetaClientInterface<T> {
* For hierarchy key spaces like zookeeper, it refers to an entry's direct
children nodes.
* For flat key spaces, it refers to keys that matches `prefix*separator`.
* @param key key to identify the entry.
- * @param listener An implementation of DirectSubEntryChangeListener.
- * @see
org.apache.helix.metaclient.api.DirectChildChangeListener
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.DirectChildChangeListener} to register
* @param skipWatchingNonExistNode If the passed in key does not exist, no
listener wil be registered.
*
- * @return Return an DirectSubEntrySubscribeResult. It will contain a list
of direct sub children if
+ * @return Return a DirectChildSubscribeResult. It will contain a list of
direct sub children if
* subscribe succeeded.
*/
DirectChildSubscribeResult subscribeDirectChildChange(String key,
@@ -430,11 +427,10 @@ public interface MetaClientInterface<T> {
* For flat key spaces, it refers to keys that matches `prefix*separator`.
*
* @param key key to identify the entry.
- * @param listener An implementation of DirectSubEntryChangeListener.
- * @see
org.apache.helix.metaclient.api.DirectChildChangeListener
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.DirectChildChangeListener} to register
* @param skipWatchingNonExistNode If the passed in key does not exist, no
listener wil be registered.
*
- * @return Return an DirectSubEntrySubscribeResult. It will contain a list
of direct sub children if
+ * @return Return a DirectChildSubscribeResult. It will contain a list of
direct sub children if
* subscribe succeeded.
*/
default DirectChildSubscribeResult subscribeOneTimeDirectChildChange(String
key,
@@ -445,10 +441,9 @@ public interface MetaClientInterface<T> {
/**
* Subscribe for connection state change.
* The listener should be permanent until it's unsubscribed.
- * @param listener An implementation of ConnectStateChangeListener.
- * @see
org.apache.helix.metaclient.api.ConnectStateChangeListener
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.ConnectStateChangeListener} to register
*
- * @return Return an boolean indication if subscribe succeeded.
+ * @return Return a boolean indication if subscribe succeeded.
*/
boolean subscribeStateChanges(ConnectStateChangeListener listener);
@@ -458,8 +453,7 @@ public interface MetaClientInterface<T> {
* For hierarchy key spaces like zookeeper, it would watch the whole tree
structure.
* For flat key spaces, it would watch for keys with certain prefix.
* @param key key to identify the entry.
- * @param listener An implementation of ChildChangeListener.
- * @see org.apache.helix.metaclient.api.ChildChangeListener
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.ChildChangeListener} to register
* @param skipWatchingNonExistNode If the passed in key does not exist, no
listener wil be registered.
*/
boolean subscribeChildChanges(String key, ChildChangeListener listener,
boolean skipWatchingNonExistNode);
@@ -470,8 +464,7 @@ public interface MetaClientInterface<T> {
* For hierarchy key spaces like zookeeper, it would watch the whole tree
structure.
* For flat key spaces, it would watch for keys with certain prefix.
* @param key key to identify the entry.
- * @param listener An implementation of ChildChangeListener.
- * @see org.apache.helix.metaclient.api.ChildChangeListener
+ * @param listener An implementation of {@link
org.apache.helix.metaclient.api.ChildChangeListener} to register
* @param skipWatchingNonExistNode If the passed in key does not exist, no
listener wil be registered.
*/
default boolean subscribeOneTimeChildChanges(String key, ChildChangeListener
listener,
diff --git
a/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClient.java
b/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClient.java
index f520e319b..42acc72c1 100644
---
a/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClient.java
+++
b/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClient.java
@@ -164,7 +164,7 @@ public class ZkMetaClient<T> implements
MetaClientInterface<T>, AutoCloseable {
// existing retry handling logic in zkClient. (defined in ZkAsyncCallbacks)
// ZkClient execute async callbacks at zkClient main thead, retry is handles
in a separate retry
// thread. In our first version of implementation, we will keep similar
behavior and have
- // callbacks executed in ZkClient event thread, and reuse zkclient retry
logic.
+ // callbacks executed in ZkClient event thread, and reuse zkClient retry
logic.
// It is highly recommended *NOT* to perform any blocking operation inside
the callbacks.
// If you block the thread the meta client won't process other events.
@@ -309,37 +309,37 @@ public class ZkMetaClient<T> implements
MetaClientInterface<T>, AutoCloseable {
}
@Override
- public boolean[] create(List key, List data, List mode) {
+ public boolean[] create(List<String> key, List<T> data, List<EntryMode>
mode) {
return new boolean[0];
}
@Override
- public boolean[] create(List key, List data) {
+ public boolean[] create(List<String> key, List<T> data) {
return new boolean[0];
}
@Override
- public boolean[] delete(List keys) {
+ public boolean[] delete(List<String> keys) {
return new boolean[0];
}
@Override
- public List<Stat> exists(List keys) {
+ public List<Stat> exists(List<String> keys) {
return null;
}
@Override
- public List get(List keys) {
+ public List<T> get(List<String> keys) {
return null;
}
@Override
- public List update(List keys, List updater) {
+ public List<T> update(List<String> keys, List<DataUpdater<T>> updater) {
return null;
}
@Override
- public boolean[] set(List keys, List values, List version) {
+ public boolean[] set(List<String> keys, List<T> datas, List<Integer>
version) {
return new boolean[0];
}