Renkai commented on a change in pull request #9202:
URL: https://github.com/apache/pulsar/pull/9202#discussion_r569181435
##########
File path:
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPolicies.java
##########
@@ -96,6 +95,56 @@ public String getValue() {
}
}
+ @InterfaceAudience.Public
+ @InterfaceStability.Stable
+ public enum OffloadMethod {
+ /**
+ * Ledger based offload, one offload segment corresponding to a ledger
+ */
+ LEDGER_BASED("ledger-based"),
+ /**
+ * Streaming offload, offload segments are divided by time or size
+ */
+ STREAMING_BASED("streaming-based"),
+ /**
+ * Disable offload
+ */
+ NONE("none");
Review comment:
This can be used to reduce boilerplate code in usage, for example this
method return NONE when offload policies is null.
```java
public OffloadMethod getOffloadMethod() {
if (config.getLedgerOffloader() == null) {
return OffloadMethod.NONE;
}
if (config.getLedgerOffloader().getOffloadPolicies() == null) {
return OffloadMethod.NONE;
}
return
config.getLedgerOffloader().getOffloadPolicies().getOffloadMethod();
}
```
so the caller can simply do a switch rather than have a complex if check
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]