Disable write with if match so that opendal will not send write request with if match headers.
- *For example, Ceph RADOS S3 doesn't support write with if matched.
+ *Deprecated: S3 write with If-Match capability is enabled by default.
+ * + * @deprecated S3 write with If-Match capability is enabled by default and this option is no longer needed. */ public final Boolean disableWriteWithIfMatch; /** @@ -2926,7 +2927,9 @@ class S3 implements ServiceConfig { */ public final Boolean enableRequestPayer; /** - *is bucket versioning enabled for this bucket
+ *Deprecated: S3 versioning capability is enabled by default.
+ * + * @deprecated S3 versioning capability is enabled by default and this option is no longer needed. */ public final Boolean enableVersioning; /** @@ -2939,7 +2942,9 @@ class S3 implements ServiceConfig { */ public final Boolean enableVirtualHostStyle; /** - *Enable write with append so that opendal will send write request with append headers.
+ *Deprecated: S3 append capability is enabled by default.
+ * + * @deprecated S3 append capability is enabled by default and this option is no longer needed. */ public final Boolean enableWriteWithAppend; /** diff --git a/bindings/java/src/main/java/org/apache/opendal/layer/CapabilityOverrideLayer.java b/bindings/java/src/main/java/org/apache/opendal/layer/CapabilityOverrideLayer.java new file mode 100644 index 000000000000..ace54af04028 --- /dev/null +++ b/bindings/java/src/main/java/org/apache/opendal/layer/CapabilityOverrideLayer.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.opendal.layer; + +import org.apache.opendal.Layer; + +/** + * Layer that overrides the full capability exposed by an operator. + */ +public class CapabilityOverrideLayer extends Layer { + + private final String overrides; + + public CapabilityOverrideLayer(String overrides) { + this.overrides = overrides; + } + + @Override + protected long layer(long nativeOp) { + return doLayer(nativeOp, overrides); + } + + private static native long doLayer(long nativeHandle, String overrides); +} diff --git a/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java b/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java index 367e79c66715..3ad216a6acf9 100644 --- a/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java +++ b/bindings/java/src/test/java/org/apache/opendal/test/behavior/BehaviorExtension.java @@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.opendal.AsyncOperator; import org.apache.opendal.Operator; +import org.apache.opendal.layer.CapabilityOverrideLayer; import org.apache.opendal.layer.RetryLayer; import org.junit.jupiter.api.extension.AfterAllCallback; import org.junit.jupiter.api.extension.BeforeAllCallback; @@ -67,6 +68,10 @@ public void beforeAll(ExtensionContext context) { @Cleanup final AsyncOperator op = AsyncOperator.of(scheme.toLowerCase().replace('_', '-'), config); this.asyncOperator = op.layer(RetryLayer.builder().build()); + final String capabilityOverrides = dotenv.get("OPENDAL_TEST_CAPABILITY_OVERRIDES"); + if (capabilityOverrides != null && !capabilityOverrides.trim().isEmpty()) { + this.asyncOperator = this.asyncOperator.layer(new CapabilityOverrideLayer(capabilityOverrides)); + } this.operator = this.asyncOperator.blocking(); this.scheme = scheme; diff --git a/bindings/nodejs/generated.d.ts b/bindings/nodejs/generated.d.ts index 999bb81471b7..8ac5619d1bac 100644 --- a/bindings/nodejs/generated.d.ts +++ b/bindings/nodejs/generated.d.ts @@ -207,6 +207,17 @@ export declare class Capability { get shared(): boolean } +/** + * Capability override layer + * + * Override the full capability exposed by an operator. + */ +export declare class CapabilityOverrideLayer { + /** Create a new CapabilityOverrideLayer from capability override entries. */ + constructor(overrides: string) + build(): ExternalObject