Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
Merge branch 'thrift-0.11.0-inlined' into shade
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu Tao authored Nov 14, 2019
2 parents b170156 + d078730 commit 261aae9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/com/xiaomi/infra/pegasus/client/PegasusTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public Future<Void> asyncSet(
promise.setFailure(new PException("Invalid parameter: value should not be null"));
return promise;
}
if (ttlSeconds < 0) {
promise.setFailure(new PException("Invalid parameter: ttlSeconds should be no less than 0"));
return promise;
}

blob k = new blob(PegasusClient.generateKey(hashKey, sortKey));
blob v = new blob(value);
Expand Down Expand Up @@ -398,6 +402,10 @@ public Future<Void> asyncMultiSet(
promise.setFailure(new PException("Invalid parameter: values should not be null or empty"));
return promise;
}
if (ttlSeconds < 0) {
promise.setFailure(new PException("Invalid parameter: ttlSeconds should be no less than 0"));
return promise;
}

blob hash_key_blob = new blob(hashKey);
List<key_value> values_blob = new ArrayList<key_value>();
Expand Down Expand Up @@ -769,6 +777,10 @@ public Future<CompareExchangeResult> asyncCompareExchange(
new PException("Invalid parameter: hashKey length should be less than UINT16_MAX"));
return promise;
}
if (ttlSeconds < 0) {
promise.setFailure(new PException("Invalid parameter: ttlSeconds should be no less than 0"));
return promise;
}

blob hashKeyBlob = new blob(hashKey);
blob sortKeyBlob = (sortKey == null ? null : new blob(sortKey));
Expand Down Expand Up @@ -1244,6 +1256,9 @@ public void batchMultiSet(List<HashKeyData> items, int ttlSeconds, int timeout)
if (items == null || items.size() == 0) {
throw new PException("Invalid parameter: items should not be null or empty");
}
if (ttlSeconds < 0) {
throw new PException("Invalid parameter: ttlSeconds should be no less than 0");
}
List<Future<Void>> futures = new ArrayList<Future<Void>>();
for (HashKeyData item : items) {
futures.add(asyncMultiSet(item.hashKey, item.values, ttlSeconds, timeout));
Expand All @@ -1269,6 +1284,9 @@ public int batchMultiSet2(
if (results == null) {
throw new PException("Invalid parameter: results should not be null");
}
if (ttlSeconds < 0) {
throw new PException("Invalid parameter: ttlSeconds should be no less than 0");
}
results.clear();
List<Future<Void>> futures = new ArrayList<Future<Void>>();
for (HashKeyData item : items) {
Expand Down

0 comments on commit 261aae9

Please sign in to comment.