@Override public void makeHostAlive(UUID hostId) { State.HostState hostState = newBuilder().setHostId(toProto(hostId)).build(); backend .stateStore() .addValue(Host.class, hostId, AliveKey(), hostState.toString()) .toBlocking() .first(); }
@Override public void createHost(UUID hostId, String name, InetAddress[] addresses) { Host h = Host.newBuilder().setId(toProto(hostId)).setName(name).build(); backend.store().create(h); try { Await.result(backend.store().get(h.getClass(), hostId), TIMEOUT); backend .stateStore() .addValue(Host.class, hostId, HostKey(), State.HostState.getDefaultInstance().toString()) .toBlocking() .first(); } catch (Exception e) { throw new RuntimeException("Could not create host", e); } }