-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
- Loading branch information
1 parent
4bdc6f3
commit 0d5f9f6
Showing
6 changed files
with
127 additions
and
8 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/transport/GrpcMessagingProxy.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.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 GrpcMessagingProxy { | ||
private Map<Address, Address> mProxyConf; | ||
|
||
/** | ||
* Creates new proxy configuration. | ||
*/ | ||
public GrpcMessagingProxy() { | ||
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 GrpcMessagingProxy 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