@SuppressWarnings("unchecked") public SimpleProtocol(int protocolId, Map<Integer, ReceiveHandler<MessageLite, MessageLite>> handlers, BufferAllocator allocator, String name) { super(); this.protocolId = protocolId; this.handlers = new ReceiveHandler[2048]; this.defaultResponseInstances = new MessageLite[2048]; this.defaultRequestInstances = new MessageLite[2048]; RpcConfigBuilder builder = RpcConfig.newBuilder() .name(name) .timeout(0); for(Entry<Integer, ReceiveHandler<MessageLite, MessageLite>> e : handlers.entrySet()) { final int id = e.getKey(); final ReceiveHandler<?,?> handler = e.getValue(); final EnumLite num = new PseudoEnum(id); builder.add(num, (Class<? extends MessageLite>) handler.getDefaultRequest().getClass(), num, (Class<? extends MessageLite>) handler.getDefaultResponse().getClass()); this.handlers[id] = e.getValue(); this.defaultResponseInstances[id] = e.getValue().getDefaultResponse(); this.defaultRequestInstances[id] = e.getValue().getDefaultRequest(); } this.config = builder.build(); this.allocator = allocator; }
private static RpcConfig getMapping(SabotConfig config) { return RpcConfig.newBuilder() .name("CoordToCoord") .timeout(config.getInt(RpcConstants.BIT_RPC_TIMEOUT)) .add(RpcType.REQ_QUERY_CANCEL, CoordRPC.JobCancelRequest.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_QUERY_PROFILE, ExternalId.class, RpcType.RESP_QUERY_PROFILE, QueryProfile.class) .build(); } }
private static RpcConfig getMapping(SabotConfig config) { return RpcConfig.newBuilder() .name("ReflectionExecToCoord") .timeout(config.getInt(BIT_RPC_TIMEOUT)) .add(ReflectionRPC.RpcType.REQ_REFLECTION_INFO, ReflectionRPC.ReflectionInfoReq.class, ReflectionRPC.RpcType.RESP_REFLECTION_INFO, ReflectionRPC.ReflectionInfoResp.class) .add(ReflectionRPC.RpcType.REQ_REFRESH_INFO, ReflectionRPC.RefreshInfoReq.class, ReflectionRPC.RpcType.RESP_REFRESH_INFO, ReflectionRPC.RefreshInfoResp.class) .build(); } }
private static RpcConfig getMapping(SabotConfig config) { return RpcConfig.newBuilder() .name("CatalogProtocol") .timeout(config.getInt(RpcConstants.BIT_RPC_TIMEOUT)) .add(RpcType.REQ_SOURCE_CONFIG, SourceWrapper.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_DEL_SOURCE, SourceWrapper.class, RpcType.ACK, Ack.class) .build(); }
public static RpcConfig getMapping(int rpcTimeout, Executor executor, Optional<SSLConfig> sslConfig) { return RpcConfig.newBuilder() .name("FABRIC") .executor(executor) .timeout(rpcTimeout) .sslConfig(sslConfig) .add(RpcType.HANDSHAKE, FabricHandshake.class, RpcType.HANDSHAKE, FabricHandshake.class) .add(RpcType.MESSAGE, FabricMessage.class, RpcType.MESSAGE, FabricMessage.class) .build(); }
private static RpcConfig getMapping(SabotConfig config) { return RpcConfig.newBuilder() .name("DATA") .timeout(config.getInt(RpcConstants.BIT_RPC_TIMEOUT)) .add(RpcType.REQ_RECORD_BATCH, FragmentRecordBatch.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_STREAM_COMPLETE, FragmentStreamComplete.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_RECEIVER_FINISHED, FinishedReceiver.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_OOB_MESSAGE, OOBMessage.class, RpcType.ACK, Ack.class) .build(); }
private static RpcConfig getMapping(SabotConfig config) { return RpcConfig.newBuilder() .name("CoordToExec") .timeout(config.getInt(RpcConstants.BIT_RPC_TIMEOUT)) .add(RpcType.REQ_START_FRAGMENTS, InitializeFragments.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_CANCEL_FRAGMENTS, FragmentHandle.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_FRAGMENT_STATUS, FragmentStatus.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_QUERY_DATA, QueryData.class, RpcType.ACK, Ack.class) .add(RpcType.REQ_NODE_QUERY_STATUS, NodeQueryStatus.class, RpcType.ACK, Ack.class) .build(); }
@Override public RpcConfig getConfig() { return RpcConfig.newBuilder().name("pdfs") .timeout(rpcTimeoutInSecs) .add(DFS.RpcType.GET_FILE_STATUS_REQUEST, DFS.GetFileStatusRequest.class, DFS.RpcType.GET_FILE_STATUS_RESPONSE, DFS.GetFileStatusResponse.class) .add(DFS.RpcType.GET_FILE_DATA_REQUEST, DFS.GetFileDataRequest.class, DFS.RpcType.GET_FILE_DATA_RESPONSE, DFS.GetFileDataResponse.class) .add(DFS.RpcType.LIST_STATUS_REQUEST, DFS.ListStatusRequest.class, DFS.RpcType.LIST_STATUS_RESPONSE, DFS.ListStatusResponse.class) .add(DFS.RpcType.MKDIRS_REQUEST, DFS.MkdirsRequest.class, DFS.RpcType.MKDIRS_RESPONSE, DFS.MkdirsResponse.class) .add(DFS.RpcType.RENAME_REQUEST, DFS.RenameRequest.class, DFS.RpcType.RENAME_RESPONSE, DFS.RenameResponse.class) .add(DFS.RpcType.DELETE_REQUEST, DFS.DeleteRequest.class, DFS.RpcType.DELETE_RESPONSE, DFS.DeleteResponse.class) .add(DFS.RpcType.WRITE_DATA_REQUEST, DFS.WriteDataRequest.class, DFS.RpcType.WRITE_DATA_RESPONSE, DFS.WriteDataResponse.class) .build(); }
@Override public RpcConfig getConfig() { return RpcConfig.newBuilder().name("test1").timeout(0) .add(new FakeEnum(1), QueryId.class, new FakeEnum(1), NodeEndpoint.class) .add(new FakeEnum(2), QueryId.class, new FakeEnum(2), NodeEndpoint.class) .build(); }
public static RpcConfig getMapping(SabotConfig config, Executor executor, Optional<SSLConfig> sslConfig) { return RpcConfig.newBuilder() .name("USER") .timeout(config.getInt(ExecConstants.USER_RPC_TIMEOUT)) .executor(executor) .sslConfig(sslConfig) .add(RpcType.HANDSHAKE, UserToBitHandshake.class, RpcType.HANDSHAKE, BitToUserHandshake.class) // user to bit .add(RpcType.RUN_QUERY, RunQuery.class, RpcType.QUERY_HANDLE, QueryId.class) // user to bit .add(RpcType.CANCEL_QUERY, QueryId.class, RpcType.ACK, Ack.class) // user to bit .add(RpcType.QUERY_DATA, QueryData.class, RpcType.ACK, Ack.class) // bit to user .add(RpcType.QUERY_RESULT, QueryResult.class, RpcType.ACK, Ack.class) // bit to user .add(RpcType.RESUME_PAUSED_QUERY, QueryId.class, RpcType.ACK, Ack.class) // user to bit .add(RpcType.GET_QUERY_PLAN_FRAGMENTS, GetQueryPlanFragments.class, RpcType.QUERY_PLAN_FRAGMENTS, QueryPlanFragments.class) // user to bit .add(RpcType.GET_CATALOGS, GetCatalogsReq.class, RpcType.CATALOGS, GetCatalogsResp.class) // user to bit .add(RpcType.GET_SCHEMAS, GetSchemasReq.class, RpcType.SCHEMAS, GetSchemasResp.class) // user to bit .add(RpcType.GET_TABLES, GetTablesReq.class, RpcType.TABLES, GetTablesResp.class) // user to bit .add(RpcType.GET_COLUMNS, GetColumnsReq.class, RpcType.COLUMNS, GetColumnsResp.class) // user to bit .add(RpcType.CREATE_PREPARED_STATEMENT, CreatePreparedStatementReq.class, RpcType.PREPARED_STATEMENT, CreatePreparedStatementResp.class) // user to bit .add(RpcType.GET_SERVER_META, GetServerMetaReq.class, RpcType.SERVER_META, GetServerMetaResp.class) // user to bit .build(); }