@Override public byte[] serialize(ServiceInstance<DrillbitEndpoint> i) throws Exception { DrillServiceInstance.Builder b = DrillServiceInstance.newBuilder(); b.setId(i.getId()); b.setRegistrationTimeUTC(i.getRegistrationTimeUTC()); b.setEndpoint(i.getPayload()); return b.build().toByteArray(); }
@Override public ServiceInstance<DrillbitEndpoint> deserialize(byte[] bytes) throws Exception { DrillServiceInstance i = DrillServiceInstance.parseFrom(bytes); ServiceInstanceBuilder<DrillbitEndpoint> b = ServiceInstance.<DrillbitEndpoint>builder(); b.id(i.getId()); b.name(ExecConstants.SERVICE_NAME); b.registrationTimeUTC(i.getRegistrationTimeUTC()); b.payload(i.getEndpoint()); return b.build(); }