Skip to content

Commit f986406

Browse files
committed
Breaking change: Rename Stage to Volume
1 parent 47a989e commit f986406

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/VolumeFileManager.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,27 @@ public void shutdownGracefully() {
149149
}
150150

151151
private void initValidator(Pair<List<String>, Long> localPathPair) {
152-
if (localPathPair.getValue() > applyVolumeResponse.getCondition().getMaxContentLength()) {
153-
String msg = String.format("localFileTotalSize %s exceeds the maximum contentLength limit %s defined in the condition. If you want to upload larger files, please contact us to lift the restriction", localPathPair.getValue(), applyVolumeResponse.getCondition().getMaxContentLength());
152+
Long maxContentLength = applyVolumeResponse.getCondition().getMaxContentLength();
153+
Long uploadFileContentLength = localPathPair.getValue();
154+
if (uploadFileContentLength > maxContentLength) {
155+
String msg = String.format("localFileTotalSize %s exceeds the maximum contentLength limit %s defined in the condition. If you are using the free tier, you may switch to the pay-as-you-go volume plan to support uploading larger files.",
156+
uploadFileContentLength, maxContentLength);
154157
logger.error(msg);
155158
throw new ParamException(msg);
156159
}
160+
161+
Long maxFileNumber = applyVolumeResponse.getCondition().getMaxFileNumber();
162+
int uploadFileNumber = localPathPair.getKey().size();
163+
if (maxFileNumber != null) {
164+
if (uploadFileNumber > maxFileNumber) {
165+
String msg = String.format(
166+
"localFileTotalNumber %s exceeds the maximum fileNumber limit %s defined in the condition. If you are using the free tier, you may switch to the pay-as-you-go volume plan to support uploading more files.",
167+
uploadFileNumber, maxFileNumber
168+
);
169+
logger.error(msg);
170+
throw new ParamException(msg);
171+
}
172+
}
157173
}
158174

159175
private void refreshVolumeAndClient(String path) {

sdk-bulkwriter/src/main/java/io/milvus/bulkwriter/response/ApplyVolumeResponse.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ public Credentials build() {
316316
public static class Condition implements Serializable {
317317
private static final long serialVersionUID = -2613029991242322109L;
318318
private Long maxContentLength;
319+
private Long maxFileNumber;
319320

320321
public Condition() {
321322
}
@@ -332,6 +333,10 @@ public Long getMaxContentLength() {
332333
return maxContentLength;
333334
}
334335

336+
public Long getMaxFileNumber() {
337+
return maxFileNumber;
338+
}
339+
335340
public void setMaxContentLength(Long maxContentLength) {
336341
this.maxContentLength = maxContentLength;
337342
}
@@ -340,6 +345,7 @@ public void setMaxContentLength(Long maxContentLength) {
340345
public String toString() {
341346
return "Condition{" +
342347
", maxContentLength=" + maxContentLength +
348+
", maxFileNumber=" + maxFileNumber +
343349
'}';
344350
}
345351

0 commit comments

Comments
 (0)