-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use local operation shortcut in DistributingDownstream
- Loading branch information
1 parent
aa22f8b
commit 420e429
Showing
11 changed files
with
317 additions
and
685 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
151 changes: 0 additions & 151 deletions
151
sql/src/main/java/io/crate/executor/transport/DistributedResultRequestHandler.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
sql/src/main/java/io/crate/executor/transport/NodeAction.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,33 @@ | ||
/* | ||
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor | ||
* license agreements. See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. Crate 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. | ||
* | ||
* However, if you have executed another commercial license agreement | ||
* with Crate these terms will supersede the license and you may use the | ||
* software solely pursuant to the terms of the relevant commercial agreement. | ||
*/ | ||
|
||
package io.crate.executor.transport; | ||
|
||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.transport.TransportRequest; | ||
import org.elasticsearch.transport.TransportResponse; | ||
|
||
public interface NodeAction<TRequest extends TransportRequest, TResponse extends TransportResponse> { | ||
|
||
String actionName(); | ||
String executorName(); | ||
void nodeOperation(TRequest request, ActionListener<TResponse> listener); | ||
} |
54 changes: 54 additions & 0 deletions
54
sql/src/main/java/io/crate/executor/transport/NodeActionRequestHandler.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,54 @@ | ||
/* | ||
* Licensed to CRATE Technology GmbH ("Crate") under one or more contributor | ||
* license agreements. See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. Crate 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. | ||
* | ||
* However, if you have executed another commercial license agreement | ||
* with Crate these terms will supersede the license and you may use the | ||
* software solely pursuant to the terms of the relevant commercial agreement. | ||
*/ | ||
|
||
package io.crate.executor.transport; | ||
|
||
import org.elasticsearch.action.ActionListener; | ||
import org.elasticsearch.transport.TransportChannel; | ||
import org.elasticsearch.transport.TransportRequest; | ||
import org.elasticsearch.transport.TransportRequestHandler; | ||
import org.elasticsearch.transport.TransportResponse; | ||
|
||
public abstract class NodeActionRequestHandler<TRequest extends TransportRequest, TResponse extends TransportResponse> | ||
implements TransportRequestHandler<TRequest> { | ||
|
||
private final NodeAction<TRequest, TResponse> nodeAction; | ||
|
||
public NodeActionRequestHandler(NodeAction<TRequest, TResponse> nodeAction) { | ||
this.nodeAction = nodeAction; | ||
} | ||
|
||
@Override | ||
public void messageReceived(TRequest request, TransportChannel channel) throws Exception { | ||
ActionListener<TResponse> actionListener = ResponseForwarder.forwardTo(channel); | ||
nodeAction.nodeOperation(request, actionListener); | ||
} | ||
|
||
@Override | ||
public String executor() { | ||
return nodeAction.executorName(); | ||
} | ||
|
||
@Override | ||
public boolean isForceExecution() { | ||
return false; | ||
} | ||
} |
Oops, something went wrong.