mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 21:55:39 +00:00
added shard impl
This commit is contained in:
+1
-1
@@ -132,5 +132,5 @@ extends ApplicationReplicaSet<ShardingKey, MetricsT, ProcessT> {
|
||||
|
||||
public String getShardName();
|
||||
|
||||
public Map<Integer, TargetGroup<ShardingKey>> getShards();
|
||||
public Map<Integer, AwsShard<ShardingKey>> getShards();
|
||||
}
|
||||
|
||||
@@ -25,4 +25,5 @@ public interface AwsShard<ShardingKey> extends Shard<ShardingKey> {
|
||||
TargetGroup<ShardingKey> getTargetGroup();
|
||||
|
||||
AwsAutoScalingGroup getAutoScalingGroup();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.sap.sse.landscape.aws.impl;
|
||||
|
||||
import com.sap.sse.landscape.aws.AwsAutoScalingGroup;
|
||||
import com.sap.sse.landscape.aws.AwsShard;
|
||||
import com.sap.sse.landscape.aws.TargetGroup;
|
||||
|
||||
public class AwsShardImpl<ShardingKey> implements AwsShard<ShardingKey> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
final private Iterable<ShardingKey> keys;
|
||||
final private TargetGroup<ShardingKey> targetgroup;
|
||||
final private String name;
|
||||
private AwsAutoScalingGroup autoscalinggroup;
|
||||
public AwsShardImpl(String name,Iterable<ShardingKey> keys, TargetGroup<ShardingKey> targetgroup){
|
||||
this.keys = keys;
|
||||
this.targetgroup =targetgroup;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setAutoscalingGroup(AwsAutoScalingGroup asg) {
|
||||
if(autoscalinggroup == null) {
|
||||
autoscalinggroup =asg;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<ShardingKey> getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetGroup<ShardingKey> getTargetGroup() {
|
||||
return targetgroup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AwsAutoScalingGroup getAutoScalingGroup() {
|
||||
return autoscalinggroup;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,10 @@ import com.sap.sse.common.Named;
|
||||
public interface Shard<ShardingKey> extends Named {
|
||||
/**
|
||||
* @return the keys handled by this shard
|
||||
*
|
||||
*/
|
||||
Iterable<ShardingKey> getKeys();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user