Class ControllerGrpcHelper
java.lang.Object
com.illumon.iris.controller.utils.ControllerGrpcHelper
This class contains utilities for packing and unpacking objects for gRPC communication.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intgetReplicaNum(@NotNull ReplicaSpecifier specifier) makeControllerConfigMessage(@NotNull UserContext userContext, @NotNull IrisGroupProvider groupProvider, @NotNull PersistentQueryControllerConfiguration serverConfiguration, @NotNull Predicate<ConsoleConfigurationType> configTypePredicate, @NotNull Predicate<WorkerKind> workerKindPredicate) Serialize aPersistentQueryControllerConfigurationfor gRPCmakeDbServerConfig(PQDBServerConfigMessage configMessage) Deserialize aPersistentQueryDbServerConfigfrom gRPC.static ExportedObjectInfoDeserialize anExportedObjectInfofrom gRPC.static ExportedObjectInfoMessagemakeExportedObjectInfoMessage(@NotNull String name, @NotNull ExportedObjectInfo type) Make anExportedObjectInfoMessagefrom a name andExportedObjectInfostatic NamedStringListmakeNamedStringList(@NotNull String name, @Nullable String[] list) Create aNamedStringListobject from a string array and name.static @NotNull NamedStringListmakeNamedStringList(@NotNull String name, @Nullable Collection<String> list) Create aNamedStringListobject from a collection of strings and name.makePersistentQueryControllerConfiguration(@NotNull ControllerConfigurationMessage response) Deserialize aPersistentQueryControllerConfigurationfrom gRPCstatic PQDBServerConfigMessagemakePQDBServerConfigMessage(@NotNull UserContext userContext, @NotNull IrisGroupProvider groupProvider, @NotNull PersistentQueryControllerConfiguration serverConfiguration, @NotNull PersistentQueryDbServerConfig config) Serialize aPersistentQueryDbServerConfigobject for gRPCstatic PersistentQueryConfigurationmakeQueryConfig(PersistentQueryConfigMessage configMessage) Deserialize aPersistentQueryConfigurationfrom gRPC.static PersistentQueryConfigMessagemakeQueryConfigMessage(@NotNull PersistentQueryConfiguration config) Serialize aPersistentQueryConfigurationobject for gRPC.static PersistentQueryInfomakeQueryInfo(@NotNull PersistentQueryInfoMessage infoMessage) Deserialize aPersistentQueryInfofrom gRPC.static PersistentQueryInfoMessagemakeQueryInfoMessage(@NotNull PersistentQueryInfo info, @Nullable UserContext forUser, @Nullable IrisGroupProvider groupProvider, int designatedSlot) Serialize aPersistentQueryInfoobject for gRPC.static PersistentQueryStatemakeQueryState(@NotNull PersistentQueryStateMessage stateMessage) static PersistentQueryStateMessagemakeStateMessageForPresenceKv(@NotNull PersistentQueryState state) Creates a PersistetQueryStateMessage with the PersistentQueryState provided.static PersistentQueryState.StatusmakeStatus(@NotNull PersistentQueryStatusEnum grpcStatus) Deserialize aPersistentQueryState.Statusfrom gRPC.static TableDefinitionmakeTableDefinition(@NotNull ExportedObjectInfoMessage message) Deserialize aTableDefinitionfrom gRPC.static WorkerProtocolmakeWorkerProtocol(@NotNull WorkerProtocolMessage protocolMessage) Deserialize aWorkerProtocolfrom gRPC.
-
Method Details
-
makeQueryInfoMessage
public static PersistentQueryInfoMessage makeQueryInfoMessage(@NotNull @NotNull PersistentQueryInfo info, @Nullable @Nullable UserContext forUser, @Nullable @Nullable IrisGroupProvider groupProvider, int designatedSlot) throws ControllerSerializationException Serialize aPersistentQueryInfoobject for gRPC.- Parameters:
info- the object to serializeforUser- the user this is destined forgroupProvider- the group provider for determining filters and access.designatedSlot- the worker slot the user will be assigned to.- Returns:
- the serialized
PersistentQueryInfoMessage - Throws:
ControllerSerializationException- if a problem occurred converting the message to gRPC
-
makeQueryConfigMessage
public static PersistentQueryConfigMessage makeQueryConfigMessage(@NotNull @NotNull PersistentQueryConfiguration config) throws ControllerSerializationException Serialize aPersistentQueryConfigurationobject for gRPC.- Parameters:
config- the object to serialize- Returns:
- the serialized
PersistentQueryConfigMessage - Throws:
ControllerSerializationException- if a problem occurred converting the message to gRPC
-
makeStateMessageForPresenceKv
public static PersistentQueryStateMessage makeStateMessageForPresenceKv(@NotNull @NotNull PersistentQueryState state) throws ControllerSerializationException Creates a PersistetQueryStateMessage with the PersistentQueryState provided.- Parameters:
state- the state to use as data to populate the returned message- Returns:
- a new state message matching the supplied data
- Throws:
ControllerSerializationException- if there are any errors during serialization
-
makeNamedStringList
public static NamedStringList makeNamedStringList(@NotNull @NotNull String name, @Nullable @Nullable String[] list) Create aNamedStringListobject from a string array and name.- Parameters:
name- the name to uselist- the array of values- Returns:
- a new
NamedStringList
-
makeNamedStringList
@NotNull public static @NotNull NamedStringList makeNamedStringList(@NotNull @NotNull String name, @Nullable @Nullable Collection<String> list) Create aNamedStringListobject from a collection of strings and name.- Parameters:
name- the name to uselist- the collection of values- Returns:
- a new
NamedStringList
-
makeExportedObjectInfoMessage
public static ExportedObjectInfoMessage makeExportedObjectInfoMessage(@NotNull @NotNull String name, @NotNull @NotNull ExportedObjectInfo type) throws ControllerSerializationException Make anExportedObjectInfoMessagefrom a name andExportedObjectInfo- Parameters:
name- the name of the objecttype- theExportedObjectInfo- Returns:
- a new
ExportedObjectInfoMessage - Throws:
ControllerSerializationException- if a problem occurred converting the message to gRPC
-
makePQDBServerConfigMessage
public static PQDBServerConfigMessage makePQDBServerConfigMessage(@NotNull @NotNull UserContext userContext, @NotNull @NotNull IrisGroupProvider groupProvider, @NotNull @NotNull PersistentQueryControllerConfiguration serverConfiguration, @NotNull @NotNull PersistentQueryDbServerConfig config) throws ControllerSerializationException Serialize aPersistentQueryDbServerConfigobject for gRPC- Parameters:
config- the configuration to serialize- Returns:
- a new
PersistentQueryDbServerConfig - Throws:
ControllerSerializationException- if a problem occurred converting the message to gRPC
-
makeControllerConfigMessage
public static ControllerConfigurationMessage makeControllerConfigMessage(@NotNull @NotNull UserContext userContext, @NotNull @NotNull IrisGroupProvider groupProvider, @NotNull @NotNull PersistentQueryControllerConfiguration serverConfiguration, @NotNull @NotNull Predicate<ConsoleConfigurationType> configTypePredicate, @NotNull @NotNull Predicate<WorkerKind> workerKindPredicate) throws ControllerSerializationException Serialize aPersistentQueryControllerConfigurationfor gRPC- Parameters:
serverConfiguration- the configuration to serialize- Returns:
- a new
ControllerConfigurationMessage - Throws:
ControllerSerializationException- if a problem occurred converting the message to gRPC
-
makeQueryInfo
public static PersistentQueryInfo makeQueryInfo(@NotNull @NotNull PersistentQueryInfoMessage infoMessage) throws ControllerSerializationException Deserialize aPersistentQueryInfofrom gRPC.- Parameters:
infoMessage- the message to deserialize- Returns:
- a new
PersistentQueryInfo - Throws:
ControllerSerializationException- if a problem occurred deserializing gRPC message
-
makeQueryState
public static PersistentQueryState makeQueryState(@NotNull @NotNull PersistentQueryStateMessage stateMessage) throws ControllerSerializationException - Throws:
ControllerSerializationException
-
makeWorkerProtocol
public static WorkerProtocol makeWorkerProtocol(@NotNull @NotNull WorkerProtocolMessage protocolMessage) Deserialize aWorkerProtocolfrom gRPC.- Parameters:
protocolMessage- the message to deserialize- Returns:
- a new
WorkerProtocol
-
makeQueryConfig
public static PersistentQueryConfiguration makeQueryConfig(PersistentQueryConfigMessage configMessage) throws ControllerSerializationException Deserialize aPersistentQueryConfigurationfrom gRPC.- Parameters:
configMessage- the message to deserialize- Returns:
- a new
PersistentQueryConfiguration - Throws:
ControllerSerializationException- if a problem occurred deserializing gRPC message
-
makeStatus
public static PersistentQueryState.Status makeStatus(@NotNull @NotNull PersistentQueryStatusEnum grpcStatus) throws ControllerSerializationException Deserialize aPersistentQueryState.Statusfrom gRPC.- Parameters:
grpcStatus- the message to deserialize- Returns:
- a new
PersistentQueryState.Status. - Throws:
ControllerSerializationException- if a problem occurred deserializing gRPC message
-
makeDbServerConfig
public static PersistentQueryDbServerConfig makeDbServerConfig(PQDBServerConfigMessage configMessage) throws ControllerSerializationException Deserialize aPersistentQueryDbServerConfigfrom gRPC.- Parameters:
configMessage- the message to deserialize- Returns:
- a new
PersistentQueryDbServerConfig - Throws:
ControllerSerializationException- if a problem occurred deserializing gRPC message
-
makePersistentQueryControllerConfiguration
public static PersistentQueryControllerConfiguration makePersistentQueryControllerConfiguration(@NotNull @NotNull ControllerConfigurationMessage response) throws ControllerSerializationException Deserialize aPersistentQueryControllerConfigurationfrom gRPC- Parameters:
response- the message to deserialize- Returns:
- a new
PersistentQueryControllerConfiguration - Throws:
ControllerSerializationException- if a problem occurred deserializing gRPC message
-
makeExportedObjectInfo
public static ExportedObjectInfo makeExportedObjectInfo(ExportedObjectInfoMessage eo) throws ControllerSerializationException Deserialize anExportedObjectInfofrom gRPC.- Parameters:
eo- the message to deserialize- Returns:
- a new
ExportedObjectInfo - Throws:
ControllerSerializationException- if a problem occurred deserializing gRPC message
-
makeTableDefinition
public static TableDefinition makeTableDefinition(@NotNull @NotNull ExportedObjectInfoMessage message) Deserialize aTableDefinitionfrom gRPC.- Parameters:
message- the message to deserialize- Returns:
- a new
TableDefinitionor null if the message does not contain a table definition, or the table definition cannot be deserialized (for example a missing custom class)
-
getReplicaNum
-