@Test public void serializes_multiple_ip_addresses() { byte[] nodeWithMultipleIps = createNodeJson("node4.yahoo.tld", "127.0.0.4", "::4"); Node deserializedNode = nodeSerializer.fromJson(State.provisioned, nodeWithMultipleIps); assertEquals(ImmutableSet.of("127.0.0.4", "::4"), deserializedNode.ipConfig().primary()); }
public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } NodeSerializer(NodeFlavors flavors, long cacheSize); }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } NodeSerializer(NodeFlavors flavors, long cacheSize); byte[] toJson(Node node); CacheStats cacheStats(); Node fromJson(Node.State state, byte[] data); }
NodeSerializer { public Node fromJson(Node.State state, byte[] data) { var key = Hashing.sipHash24().newHasher() .putString(state.name(), StandardCharsets.UTF_8) .putBytes(data).hash() .asLong(); try { return cache.get(key, () -> nodeFromSlime(state, SlimeUtils.jsonToSlime(data).get())); } catch (ExecutionException e) { throw new UncheckedExecutionException(e); } } NodeSerializer(NodeFlavors flavors, long cacheSize); byte[] toJson(Node node); CacheStats cacheStats(); Node fromJson(Node.State state, byte[] data);  }