Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add listening address for embedded journal
Cherry-pick of existing commit. orig-pr: #10706 orig-commit: 0d5f9f6 orig-commit-author: Göktürk Gezer <gokturk@alluxio.com> pr-link: #10773 change-id: cid-b47ba2b295b64f17b60dbf862974dba5f48ff274
- Loading branch information
1 parent
95a3414
commit 5952a18
Showing
6 changed files
with
128 additions
and
9 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
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
59 changes: 59 additions & 0 deletions
59
core/server/common/src/main/java/alluxio/master/journal/raft/transport/CopycatGrpcProxy.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,59 @@ | ||
/* | ||
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0 | ||
* (the "License"). You may not use this work except in compliance with the License, which is | ||
* available at www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied, as more fully set forth in the License. | ||
* | ||
* See the NOTICE file distributed with this work for information regarding copyright ownership. | ||
*/ | ||
|
||
package alluxio.master.journal.raft.transport; | ||
|
||
import io.atomix.catalyst.transport.Address; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Used to provide external proxy configuration to messaging servers/clients. | ||
*/ | ||
public class CopycatGrpcProxy { | ||
private Map<Address, Address> mProxyConf; | ||
|
||
/** | ||
* Creates new proxy configuration. | ||
*/ | ||
public CopycatGrpcProxy() { | ||
mProxyConf = new HashMap<>(); | ||
} | ||
|
||
/** | ||
* Adds a new proxy mapping. | ||
* | ||
* @param address source address that has been proxied | ||
* @param proxy proxy address for source address | ||
* @return the updated proxy configuration | ||
*/ | ||
public CopycatGrpcProxy addProxy(Address address, Address proxy) { | ||
mProxyConf.put(address, proxy); | ||
return this; | ||
} | ||
|
||
/** | ||
* @param address address to check for proxy configuration | ||
* @return {@code true} if given address has proxy configuration | ||
*/ | ||
public boolean hasProxyFor(Address address) { | ||
return mProxyConf.containsKey(address); | ||
} | ||
|
||
/** | ||
* @param address source address | ||
* @return proxy address for given address | ||
*/ | ||
public Address getProxyFor(Address address) { | ||
return mProxyConf.get(address); | ||
} | ||
} |
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