-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gateway service - service structure dummy class (#2840)
Gateway service - service structure dummy class
- Loading branch information
Showing
13 changed files
with
216 additions
and
69 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
helix-gateway/src/main/java/org/apache/helix/gateway/HelixGatewayMain.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,15 @@ | ||
package org.apache.helix.gateway; | ||
|
||
/** | ||
* Main class for Helix Gateway. | ||
* It starts the Helix Gateway grpc service. | ||
*/ | ||
public final class HelixGatewayMain { | ||
|
||
private HelixGatewayMain() { | ||
} | ||
|
||
public static void main(String[] args) throws InterruptedException { | ||
|
||
} | ||
} |
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
33 changes: 0 additions & 33 deletions
33
helix-gateway/src/main/java/org/apache/helix/gateway/service/ClusterManager.java
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
helix-gateway/src/main/java/org/apache/helix/gateway/service/GatewayServiceManager.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,65 @@ | ||
package org.apache.helix.gateway.service; | ||
|
||
import java.util.Map; | ||
|
||
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.atomic.AtomicBoolean; | ||
import org.apache.helix.gateway.grpcservice.HelixGatewayServiceService; | ||
|
||
|
||
/** | ||
* A top layer class that send/receive messages from Grpc end point, and dispatch them to corrsponding gateway services. | ||
* 1. get event from Grpc service | ||
* 2. Maintain a gateway service registry, one gateway service maps to one Helix cluster | ||
* 3. On init connect, create the participant manager | ||
* 4. For ST reply message, update the tracker | ||
*/ | ||
|
||
public class GatewayServiceManager { | ||
|
||
HelixGatewayServiceService _helixGatewayServiceService; | ||
|
||
HelixGatewayServiceProcessor _helixGatewayServiceProcessor; | ||
|
||
Map<String, HelixGatewayService> _helixGatewayServiceMap; | ||
|
||
// TODO: add thread pool for init | ||
// single thread tp for update | ||
|
||
public enum EventType { | ||
CONNECT, // init connection to gateway service | ||
UPDATE, // update state transition result | ||
DISCONNECT // shutdown connection to gateway service. | ||
} | ||
|
||
public class GateWayServiceEvent { | ||
// event type | ||
EventType eventType; | ||
// event data | ||
String clusterName; | ||
String participantName; | ||
|
||
// todo: add more fields | ||
} | ||
|
||
public GatewayServiceManager() { | ||
_helixGatewayServiceMap = new ConcurrentHashMap<>(); | ||
} | ||
|
||
public AtomicBoolean sendTransitionRequestToApplicationInstance() { | ||
|
||
return null; | ||
} | ||
|
||
public void updateShardState() { | ||
|
||
} | ||
|
||
public void newParticipantConnecting() { | ||
|
||
} | ||
|
||
public void participantDisconnected() { | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...-gateway/src/main/java/org/apache/helix/gateway/service/GatewayServiceManagerFactory.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,11 @@ | ||
package org.apache.helix.gateway.service; | ||
|
||
/** | ||
* Factory class to create GatewayServiceManager | ||
*/ | ||
public class GatewayServiceManagerFactory { | ||
|
||
public GatewayServiceManager createGatewayServiceManager() { | ||
return new GatewayServiceManager(); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
...-gateway/src/main/java/org/apache/helix/gateway/service/HelixGatewayServiceProcessor.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,11 @@ | ||
package org.apache.helix.gateway.service; | ||
|
||
/** | ||
* Translate from/to GRPC function call to Helix Gateway Service event. | ||
*/ | ||
public interface HelixGatewayServiceProcessor { | ||
|
||
public boolean sendStateTransitionMessage(String instanceName); | ||
|
||
public void sendEventToManager(GatewayServiceManager.GateWayServiceEvent event); | ||
} |
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
4 changes: 0 additions & 4 deletions
4
...eway/src/main/java/org/apache/helix/gateway/service/StateTransitionMessageTranslator.java
This file was deleted.
Oops, something went wrong.
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
7 changes: 4 additions & 3 deletions
7
.../java/org/apache/helix/gateway/statemodel/HelixGatewayOnlineOfflineStateModelFactory.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
17 changes: 17 additions & 0 deletions
17
...eway/src/main/java/org/apache/helix/gateway/util/StateTransitionMessageTranslateUtil.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,17 @@ | ||
package org.apache.helix.gateway.util; | ||
|
||
import org.apache.helix.gateway.service.GatewayServiceManager; | ||
import proto.org.apache.helix.gateway.HelixGatewayServiceOuterClass.TransitionMessage; | ||
import proto.org.apache.helix.gateway.HelixGatewayServiceOuterClass.ShardStateMessage; | ||
|
||
|
||
public final class StateTransitionMessageTranslateUtil { | ||
|
||
public static TransitionMessage translateSTMsgToProto() { | ||
return null; | ||
} | ||
|
||
public static GatewayServiceManager.GateWayServiceEvent translateProtoToSTMsg(ShardStateMessage message) { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.