forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3.0-li' into tlin-patch5
- Loading branch information
Showing
21 changed files
with
519 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
clients/src/main/java/org/apache/kafka/clients/admin/DeleteFederatedTopicZnodesOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.kafka.clients.admin; | ||
|
||
import java.util.Map; | ||
import org.apache.kafka.common.annotation.InterfaceStability; | ||
|
||
|
||
/** | ||
* Options for {@link Admin#deleteFederatedTopicZnodes(Map, DeleteFederatedTopicZnodesOptions)} (Collection)}. | ||
* | ||
* The API of this class is evolving, see {@link Admin} for details. | ||
*/ | ||
@InterfaceStability.Evolving | ||
public class DeleteFederatedTopicZnodesOptions extends AbstractOptions<DeleteFederatedTopicZnodesOptions> { | ||
private boolean retryOnQuotaViolation = true; | ||
|
||
/** | ||
* Set the timeout in milliseconds for this operation or {@code null} if the default api timeout for the | ||
* AdminClient should be used. | ||
* | ||
*/ | ||
// This method is retained to keep binary compatibility with 0.11 | ||
public DeleteFederatedTopicZnodesOptions timeoutMs(Integer timeoutMs) { | ||
this.timeoutMs = timeoutMs; | ||
return this; | ||
} | ||
|
||
/** | ||
* Set to true if quota violation should be automatically retried. | ||
*/ | ||
public DeleteFederatedTopicZnodesOptions retryOnQuotaViolation(boolean retryOnQuotaViolation) { | ||
this.retryOnQuotaViolation = retryOnQuotaViolation; | ||
return this; | ||
} | ||
|
||
/** | ||
* Returns true if quota violation should be automatically retried. | ||
*/ | ||
public boolean shouldRetryOnQuotaViolation() { | ||
return retryOnQuotaViolation; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...s/src/main/java/org/apache/kafka/common/requests/LiDeleteFederatedTopicZnodesRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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.kafka.common.requests; | ||
|
||
import java.nio.ByteBuffer; | ||
import org.apache.kafka.common.message.LiDeleteFederatedTopicZnodesRequestData; | ||
import org.apache.kafka.common.message.LiDeleteFederatedTopicZnodesResponseData; | ||
import org.apache.kafka.common.protocol.ApiKeys; | ||
import org.apache.kafka.common.protocol.ByteBufferAccessor; | ||
import org.apache.kafka.common.protocol.Errors; | ||
|
||
|
||
public class LiDeleteFederatedTopicZnodesRequest extends AbstractRequest { | ||
public static class Builder extends AbstractRequest.Builder<LiDeleteFederatedTopicZnodesRequest> { | ||
private final LiDeleteFederatedTopicZnodesRequestData data; | ||
|
||
public Builder(LiDeleteFederatedTopicZnodesRequestData data, short allowedVersion) { | ||
super(ApiKeys.LI_DELETE_FEDERATED_TOPIC_ZNODES, allowedVersion); | ||
this.data = data; | ||
} | ||
|
||
@Override | ||
public LiDeleteFederatedTopicZnodesRequest build(short version) { | ||
return new LiDeleteFederatedTopicZnodesRequest(data, version); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return data.toString(); | ||
} | ||
} | ||
|
||
private final LiDeleteFederatedTopicZnodesRequestData data; | ||
|
||
LiDeleteFederatedTopicZnodesRequest(LiDeleteFederatedTopicZnodesRequestData data, short version) { | ||
super(ApiKeys.LI_DELETE_FEDERATED_TOPIC_ZNODES, version); | ||
this.data = data; | ||
} | ||
|
||
public static LiDeleteFederatedTopicZnodesRequest parse(ByteBuffer buffer, short version) { | ||
return new LiDeleteFederatedTopicZnodesRequest(new LiDeleteFederatedTopicZnodesRequestData(new ByteBufferAccessor(buffer), version), version); | ||
} | ||
|
||
@Override | ||
public AbstractResponse getErrorResponse(int throttleTimeMs, Throwable e) { | ||
LiDeleteFederatedTopicZnodesResponseData data = new LiDeleteFederatedTopicZnodesResponseData() | ||
.setErrorCode(Errors.forException(e).code()); | ||
return new LiDeleteFederatedTopicZnodesResponse(data, version()); | ||
} | ||
|
||
@Override | ||
public LiDeleteFederatedTopicZnodesRequestData data() { | ||
return data; | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
.../src/main/java/org/apache/kafka/common/requests/LiDeleteFederatedTopicZnodesResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* 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.kafka.common.requests; | ||
|
||
import java.nio.ByteBuffer; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import org.apache.kafka.common.message.LiDeleteFederatedTopicZnodesResponseData; | ||
import org.apache.kafka.common.protocol.ApiKeys; | ||
import org.apache.kafka.common.protocol.ByteBufferAccessor; | ||
import org.apache.kafka.common.protocol.Errors; | ||
|
||
|
||
public class LiDeleteFederatedTopicZnodesResponse extends AbstractResponse { | ||
private final LiDeleteFederatedTopicZnodesResponseData data; | ||
private final short version; | ||
|
||
public LiDeleteFederatedTopicZnodesResponse(LiDeleteFederatedTopicZnodesResponseData data, short version) { | ||
super(ApiKeys.LI_DELETE_FEDERATED_TOPIC_ZNODES); | ||
this.data = data; | ||
this.version = version; | ||
} | ||
|
||
public Errors error() { | ||
return Errors.forCode(data.errorCode()); | ||
} | ||
|
||
@Override | ||
public Map<Errors, Integer> errorCounts() { | ||
return Collections.singletonMap(error(), 1); | ||
} | ||
|
||
@Override | ||
public LiDeleteFederatedTopicZnodesResponseData data() { | ||
return data; | ||
} | ||
|
||
public static LiDeleteFederatedTopicZnodesResponse prepareResponse(Errors error, int throttleTimeMs, short version) { | ||
LiDeleteFederatedTopicZnodesResponseData data = new LiDeleteFederatedTopicZnodesResponseData(); | ||
data.setErrorCode(error.code()); | ||
data.setThrottleTimeMs(throttleTimeMs); | ||
return new LiDeleteFederatedTopicZnodesResponse(data, version); | ||
} | ||
|
||
public static LiDeleteFederatedTopicZnodesResponse parse(ByteBuffer buffer, short version) { | ||
return new LiDeleteFederatedTopicZnodesResponse(new LiDeleteFederatedTopicZnodesResponseData(new ByteBufferAccessor(buffer), version), version); | ||
} | ||
|
||
@Override | ||
public int throttleTimeMs() { | ||
return data.throttleTimeMs(); | ||
} | ||
|
||
public short version() { | ||
return version; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return data.toString(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
clients/src/main/resources/common/message/LiDeleteFederatedTopicZnodesRequest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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. | ||
|
||
{ | ||
"apiKey": 1004, | ||
"type": "request", | ||
"listeners": ["zkBroker", "broker", "controller"], | ||
"name": "LiDeleteFederatedTopicZnodesRequest", | ||
"validVersions": "0-1", | ||
"flexibleVersions": "0+", | ||
"fields": [ | ||
{ "name": "Topics", "type": "[]FederatedTopics", "versions": "0+", "about": "The name and namespace of the federated topic", | ||
"fields": [ | ||
{"name": "Name", "type": "string", "versions": "0+", "about": "The topic name"}, | ||
{"name": "Namespace", "type": "string", "versions": "0+", "about": "The namespace of the topic"} | ||
]}, | ||
{ "name": "TimeoutMs", "type": "int32", "versions": "0+", | ||
"about": "The length of time in milliseconds to wait for the deletions to complete." } | ||
] | ||
} |
Oops, something went wrong.