Actor system implementation draft
This commit is contained in:
parent
d3278f05bb
commit
3d42a4ca04
@ -78,6 +78,10 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM
|
|||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void process(CalculatedFieldStateRestoreMsg msg) {
|
||||||
|
states.put(msg.getId().cfId(), msg.getState());
|
||||||
|
}
|
||||||
|
|
||||||
public void process(EntityCalculatedFieldTelemetryMsg msg) {
|
public void process(EntityCalculatedFieldTelemetryMsg msg) {
|
||||||
var proto = msg.getProto();
|
var proto = msg.getProto();
|
||||||
var numberOfCallbacks = CALLBACKS_PER_CF * (msg.getEntityIdFields().size() + msg.getProfileIdFields().size());
|
var numberOfCallbacks = CALLBACKS_PER_CF * (msg.getEntityIdFields().size() + msg.getProfileIdFields().size());
|
||||||
@ -192,8 +196,4 @@ public class CalculatedFieldEntityMessageProcessor extends AbstractContextAwareM
|
|||||||
}
|
}
|
||||||
return cfIds;
|
return cfIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(CalculatedFieldStateRestoreMsg msg) {
|
|
||||||
states.put(msg.getId().cfId(), msg.getState());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -837,8 +837,10 @@ public class DefaultCalculatedFieldExecutionService extends AbstractPartitionBas
|
|||||||
telemetryMsg.setEntityIdMSB(entityId.getId().getMostSignificantBits());
|
telemetryMsg.setEntityIdMSB(entityId.getId().getMostSignificantBits());
|
||||||
telemetryMsg.setEntityIdLSB(entityId.getId().getLeastSignificantBits());
|
telemetryMsg.setEntityIdLSB(entityId.getId().getLeastSignificantBits());
|
||||||
|
|
||||||
for (CalculatedFieldId cfId : calculatedFieldIds) {
|
if(calculatedFieldIds != null) {
|
||||||
telemetryMsg.addPreviousCalculatedFields(toProto(cfId));
|
for (CalculatedFieldId cfId : calculatedFieldIds) {
|
||||||
|
telemetryMsg.addPreviousCalculatedFields(toProto(cfId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return telemetryMsg;
|
return telemetryMsg;
|
||||||
|
|||||||
@ -44,5 +44,6 @@ public interface CalculatedFieldState {
|
|||||||
|
|
||||||
ListenableFuture<CalculatedFieldResult> performCalculation(CalculatedFieldCtx ctx);
|
ListenableFuture<CalculatedFieldResult> performCalculation(CalculatedFieldCtx ctx);
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
boolean isReady();
|
boolean isReady();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -644,11 +644,13 @@ public class ProtoUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TransportProtos.TsKvProto toTsKvProto(TsKvEntry tsKvEntry) {
|
public static TransportProtos.TsKvProto toTsKvProto(TsKvEntry tsKvEntry) {
|
||||||
return TransportProtos.TsKvProto.newBuilder()
|
var builder = TransportProtos.TsKvProto.newBuilder()
|
||||||
.setTs(tsKvEntry.getTs())
|
.setTs(tsKvEntry.getTs())
|
||||||
.setKv(toKeyValueProto(tsKvEntry))
|
.setKv(toKeyValueProto(tsKvEntry));
|
||||||
.setVersion(tsKvEntry.getVersion())
|
if (tsKvEntry.getVersion() != null) {
|
||||||
.build();
|
builder.setVersion(tsKvEntry.getVersion());
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TransportProtos.KeyValueProto toKeyValueProto(KvEntry kvEntry) {
|
public static TransportProtos.KeyValueProto toKeyValueProto(KvEntry kvEntry) {
|
||||||
|
|||||||
@ -77,7 +77,7 @@ public class DefaultNativeCalculatedFieldRepository implements NativeCalculatedF
|
|||||||
String name = (String) row.get("name");
|
String name = (String) row.get("name");
|
||||||
int configurationVersion = (int) row.get("configuration_version");
|
int configurationVersion = (int) row.get("configuration_version");
|
||||||
JsonNode configuration = JacksonUtil.toJsonNode((String) row.get("configuration"));
|
JsonNode configuration = JacksonUtil.toJsonNode((String) row.get("configuration"));
|
||||||
long version = (long) row.get("version");
|
long version = row.get("version") != null ? (long) row.get("version") : 0;
|
||||||
Object externalIdObj = row.get("external_id");
|
Object externalIdObj = row.get("external_id");
|
||||||
|
|
||||||
CalculatedField calculatedField = new CalculatedField();
|
CalculatedField calculatedField = new CalculatedField();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user