diff --git a/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfs/files/objects/ChunkDataProtoSerializer.java b/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfs/files/objects/ChunkDataProtoSerializer.java index 1c50efcd..9e83c980 100644 --- a/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfs/files/objects/ChunkDataProtoSerializer.java +++ b/dhfs-parent/dhfs-fs/src/main/java/com/usatiuk/dhfs/files/objects/ChunkDataProtoSerializer.java @@ -19,7 +19,7 @@ public class ChunkDataProtoSerializer implements ProtoSerializer JObjectKeyMin MIN = new JObjectKeyMin(); JObjectKeyMax MAX = new JObjectKeyMax(); - static JObjectKey of(String name) { - return new JObjectKeyImpl(name); + static JObjectKey of(String value) { + return new JObjectKeyImpl(value); } static JObjectKey random() { @@ -43,5 +43,5 @@ public sealed interface JObjectKey extends Serializable, Comparable ByteBuffer toByteBuffer(); - String name(); + String value(); } diff --git a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyImpl.java b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyImpl.java index 0b368cec..6ebd94f2 100644 --- a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyImpl.java +++ b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyImpl.java @@ -5,12 +5,12 @@ import com.usatiuk.dhfs.supportlib.UninitializedByteBuffer; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -public record JObjectKeyImpl(String name) implements JObjectKey { +public record JObjectKeyImpl(String value) implements JObjectKey { @Override public int compareTo(JObjectKey o) { switch (o) { case JObjectKeyImpl jObjectKeyImpl -> { - return name.compareTo(jObjectKeyImpl.name()); + return value.compareTo(jObjectKeyImpl.value()); } case JObjectKeyMax jObjectKeyMax -> { return -1; @@ -23,17 +23,17 @@ public record JObjectKeyImpl(String name) implements JObjectKey { @Override public String toString() { - return name; + return value; } @Override public byte[] bytes() { - return name.getBytes(StandardCharsets.UTF_8); + return value.getBytes(StandardCharsets.UTF_8); } @Override public ByteBuffer toByteBuffer() { - var heapBb = StandardCharsets.UTF_8.encode(name); + var heapBb = StandardCharsets.UTF_8.encode(value); if (heapBb.isDirect()) return heapBb; var directBb = UninitializedByteBuffer.allocateUninitialized(heapBb.remaining()); directBb.put(heapBb); diff --git a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMax.java b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMax.java index 478fd2de..9dc5ed85 100644 --- a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMax.java +++ b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMax.java @@ -29,7 +29,7 @@ public record JObjectKeyMax() implements JObjectKey { } @Override - public String name() { + public String value() { throw new UnsupportedOperationException(); } } diff --git a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMin.java b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMin.java index f331b18c..82e1091e 100644 --- a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMin.java +++ b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/JObjectKeyMin.java @@ -29,7 +29,7 @@ public record JObjectKeyMin() implements JObjectKey { } @Override - public String name() { + public String value() { throw new UnsupportedOperationException(); } } diff --git a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/stores/LmdbObjectPersistentStore.java b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/stores/LmdbObjectPersistentStore.java index 2d76febd..a724c008 100644 --- a/dhfs-parent/objects/src/main/java/com/usatiuk/objects/stores/LmdbObjectPersistentStore.java +++ b/dhfs-parent/objects/src/main/java/com/usatiuk/objects/stores/LmdbObjectPersistentStore.java @@ -2,7 +2,6 @@ package com.usatiuk.objects.stores; import com.google.protobuf.ByteString; import com.usatiuk.objects.JObjectKey; -import com.usatiuk.objects.JObjectKeyImpl; import com.usatiuk.objects.JObjectKeyMax; import com.usatiuk.objects.JObjectKeyMin; import com.usatiuk.objects.iterators.CloseableKvIterator; @@ -121,7 +120,7 @@ public class LmdbObjectPersistentStore implements ObjectPersistentStore { @Override public CloseableKvIterator getIterator(IteratorStart start, JObjectKey key) { assert !_closed; - return new KeyPredicateKvIterator<>(new LmdbKvIterator(_txn.ref(), start, key), start, key, (k) -> !Arrays.equals(k.name().getBytes(StandardCharsets.UTF_8), DB_VER_OBJ_NAME)); + return new KeyPredicateKvIterator<>(new LmdbKvIterator(_txn.ref(), start, key), start, key, (k) -> !Arrays.equals(k.value().getBytes(StandardCharsets.UTF_8), DB_VER_OBJ_NAME)); } @Nonnull diff --git a/dhfs-parent/objects/src/test/java/com/usatiuk/objects/ObjectsTestImpl.java b/dhfs-parent/objects/src/test/java/com/usatiuk/objects/ObjectsTestImpl.java index f8c309af..58068d5f 100644 --- a/dhfs-parent/objects/src/test/java/com/usatiuk/objects/ObjectsTestImpl.java +++ b/dhfs-parent/objects/src/test/java/com/usatiuk/objects/ObjectsTestImpl.java @@ -595,13 +595,13 @@ public abstract class ObjectsTestImpl { txm.run(() -> { var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key)); var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key3, got.getKey().name()); + Assertions.assertEquals(key3, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); iter.close(); }); } @@ -623,25 +623,25 @@ public abstract class ObjectsTestImpl { txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key3, got.getKey().name()); + Assertions.assertEquals(key3, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } }); txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.LT, JObjectKey.of(key + "_5"))) { var got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); Assertions.assertTrue(iter.hasPrev()); got = iter.prev(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); Assertions.assertTrue(iter.hasNext()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } }); txm.run(() -> { @@ -653,7 +653,7 @@ public abstract class ObjectsTestImpl { }); txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { - Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().name().startsWith(key)); + Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().value().startsWith(key)); } }); } @@ -695,9 +695,9 @@ public abstract class ObjectsTestImpl { barrier2.await(); try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } } catch (Exception e) { throw new RuntimeException(e); @@ -710,13 +710,13 @@ public abstract class ObjectsTestImpl { txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key3, got.getKey().name()); + Assertions.assertEquals(key3, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } }); txm.run(() -> { @@ -728,7 +728,7 @@ public abstract class ObjectsTestImpl { }); txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { - Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().name().startsWith(key)); + Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().value().startsWith(key)); } }); } @@ -771,12 +771,12 @@ public abstract class ObjectsTestImpl { barrier2.await(); try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); Assertions.assertEquals("John2", ((Parent) got.getValue()).name()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } } catch (Exception e) { throw new RuntimeException(e); @@ -789,14 +789,14 @@ public abstract class ObjectsTestImpl { txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); Assertions.assertEquals("John5", ((Parent) got.getValue()).name()); got = iter.next(); - Assertions.assertEquals(key3, got.getKey().name()); + Assertions.assertEquals(key3, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } }); txm.run(() -> { @@ -808,7 +808,7 @@ public abstract class ObjectsTestImpl { }); txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { - Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().name().startsWith(key)); + Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().value().startsWith(key)); } }); } @@ -851,38 +851,38 @@ public abstract class ObjectsTestImpl { barrier2.await(); try (var iter = curTx.getIterator(IteratorStart.LE, JObjectKey.of(key3))) { var got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); Assertions.assertEquals("John2", ((Parent) got.getValue()).name()); Assertions.assertTrue(iter.hasNext()); Assertions.assertTrue(iter.hasPrev()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); Assertions.assertTrue(iter.hasPrev()); got = iter.prev(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); Assertions.assertTrue(iter.hasPrev()); got = iter.prev(); Assertions.assertEquals("John2", ((Parent) got.getValue()).name()); Assertions.assertTrue(iter.hasPrev()); got = iter.prev(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); Assertions.assertTrue(iter.hasNext()); got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); Assertions.assertEquals("John2", ((Parent) got.getValue()).name()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key2, got.getKey().name()); + Assertions.assertEquals(key2, got.getKey().value()); Assertions.assertEquals("John2", ((Parent) got.getValue()).name()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } } catch (Exception e) { throw new RuntimeException(e); @@ -895,11 +895,11 @@ public abstract class ObjectsTestImpl { txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { var got = iter.next(); - Assertions.assertEquals(key1, got.getKey().name()); + Assertions.assertEquals(key1, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key3, got.getKey().name()); + Assertions.assertEquals(key3, got.getKey().value()); got = iter.next(); - Assertions.assertEquals(key4, got.getKey().name()); + Assertions.assertEquals(key4, got.getKey().value()); } }); txm.run(() -> { @@ -910,7 +910,7 @@ public abstract class ObjectsTestImpl { }); txm.run(() -> { try (var iter = curTx.getIterator(IteratorStart.GT, JObjectKey.of(key))) { - Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().name().startsWith(key)); + Assertions.assertTrue(!iter.hasNext() || !iter.next().getKey().value().startsWith(key)); } }); } diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/JObjectKeyProtoSerializer.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/JObjectKeyProtoSerializer.java index 28e8197c..5a0c85df 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/JObjectKeyProtoSerializer.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/JObjectKeyProtoSerializer.java @@ -13,6 +13,6 @@ public class JObjectKeyProtoSerializer implements ProtoSerializer refsFrom, boolean frozen, } public static JObjectKey ofDataKey(JObjectKey key) { - return JObjectKey.of("data_" + key.name()); + return JObjectKey.of("data_" + key.value()); } @Override diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/JKleppmannTreeManager.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/JKleppmannTreeManager.java index 66229f50..0c0a0871 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/JKleppmannTreeManager.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/JKleppmannTreeManager.java @@ -6,7 +6,6 @@ import com.usatiuk.dhfs.jkleppmanntree.structs.*; import com.usatiuk.dhfs.repository.PersistentPeerDataService; import com.usatiuk.dhfs.repository.invalidation.Op; import com.usatiuk.dhfs.repository.peersync.PeerInfoService; -import com.usatiuk.objects.JObjectKeyImpl; import com.usatiuk.objects.transaction.LockingStrategy; import com.usatiuk.objects.transaction.Transaction; import com.usatiuk.objects.transaction.TransactionManager; @@ -50,11 +49,11 @@ public class JKleppmannTreeManager { TreePMap.empty() ); curTx.put(data); - var rootNode = new JKleppmannTreeNode(JObjectKey.of(name.name() + "_jt_root"), null, new JKleppmannTreeNodeMetaDirectory("")); + var rootNode = new JKleppmannTreeNode(JObjectKey.of(name.value() + "_jt_root"), null, new JKleppmannTreeNodeMetaDirectory("")); curTx.put(rootNode); - var trashNode = new JKleppmannTreeNode(JObjectKey.of(name.name() + "_jt_trash"), null, new JKleppmannTreeNodeMetaDirectory("")); + var trashNode = new JKleppmannTreeNode(JObjectKey.of(name.value() + "_jt_trash"), null, new JKleppmannTreeNodeMetaDirectory("")); curTx.put(trashNode); - var lf_node = new JKleppmannTreeNode(JObjectKey.of(name.name() + "_jt_lf"), null, new JKleppmannTreeNodeMetaDirectory("")); + var lf_node = new JKleppmannTreeNode(JObjectKey.of(name.value() + "_jt_lf"), null, new JKleppmannTreeNodeMetaDirectory("")); curTx.put(lf_node); } return new JKleppmannTree(data); @@ -259,17 +258,17 @@ public class JKleppmannTreeManager { @Override public JObjectKey getRootId() { - return JObjectKey.of(_treeName.name() + "_jt_root"); + return JObjectKey.of(_treeName.value() + "_jt_root"); } @Override public JObjectKey getTrashId() { - return JObjectKey.of(_treeName.name() + "_jt_trash"); + return JObjectKey.of(_treeName.value() + "_jt_trash"); } @Override public JObjectKey getLostFoundId() { - return JObjectKey.of(_treeName.name() + "_jt_lf"); + return JObjectKey.of(_treeName.value() + "_jt_lf"); } @Override diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/structs/JKleppmannTreePersistentData.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/structs/JKleppmannTreePersistentData.java index 38c1a252..d3b41e04 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/structs/JKleppmannTreePersistentData.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jkleppmanntree/structs/JKleppmannTreePersistentData.java @@ -7,7 +7,6 @@ import com.usatiuk.dhfs.PeerId; import com.usatiuk.kleppmanntree.CombinedTimestamp; import com.usatiuk.kleppmanntree.LogRecord; import com.usatiuk.kleppmanntree.OpMove; -import com.usatiuk.objects.JObjectKeyImpl; import org.pcollections.PCollection; import org.pcollections.PMap; import org.pcollections.PSortedMap; @@ -50,6 +49,6 @@ public record JKleppmannTreePersistentData( @Override public Collection collectRefsTo() { - return List.of(JObjectKey.of(key().name() + "_jt_trash"), JObjectKey.of(key().name() + "_jt_root"), JObjectKey.of(key().name() + "_jt_lf")); + return List.of(JObjectKey.of(key().value() + "_jt_trash"), JObjectKey.of(key().value() + "_jt_root"), JObjectKey.of(key().value() + "_jt_lf")); } } diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapHelper.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapHelper.java index a05055f3..a3d6e75b 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapHelper.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapHelper.java @@ -17,19 +17,19 @@ public class JMapHelper { Transaction curTx; static JObjectKey makePrefix(JObjectKey holder) { - return JObjectKey.of(holder.name() + "="); + return JObjectKey.of(holder.value() + "="); } static JObjectKey makeKeyFirst(JObjectKey holder) { - return JObjectKey.of(holder.name() + "<"); + return JObjectKey.of(holder.value() + "<"); } static JObjectKey makeKey(JObjectKey holder, K key) { - return JObjectKey.of(makePrefix(holder).name() + key.toString()); + return JObjectKey.of(makePrefix(holder).value() + key.toString()); } static JObjectKey makeKeyLast(JObjectKey holder) { - return JObjectKey.of(holder.name() + ">"); + return JObjectKey.of(holder.value() + ">"); } public CloseableKvIterator> getIterator(JMapHolder holder, IteratorStart start, K key) { diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapIterator.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapIterator.java index 4389ba80..c881a81c 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapIterator.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/jmap/JMapIterator.java @@ -23,16 +23,16 @@ public class JMapIterator implements CloseableKvIterator implements CloseableKvIterator) next.getValue()); } diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/PeerInfoService.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/PeerInfoService.java index b173c1f1..e67e037d 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/PeerInfoService.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/PeerInfoService.java @@ -51,7 +51,7 @@ public class PeerInfoService { public boolean existsPeer(PeerId peer) { return jObjectTxManager.run(() -> { - var gotKey = getTreeR().traverse(List.of(JKleppmannTreeNodeMetaPeer.peerIdToNodeId(peer).name())); + var gotKey = getTreeR().traverse(List.of(JKleppmannTreeNodeMetaPeer.peerIdToNodeId(peer).value())); if (gotKey == null) { return false; } @@ -61,7 +61,7 @@ public class PeerInfoService { public Optional getPeerInfo(PeerId peer) { return jObjectTxManager.run(() -> { - var gotKey = getTreeR().traverse(List.of(JKleppmannTreeNodeMetaPeer.peerIdToNodeId(peer).name())); + var gotKey = getTreeR().traverse(List.of(JKleppmannTreeNodeMetaPeer.peerIdToNodeId(peer).value())); if (gotKey == null) { return Optional.empty(); } @@ -114,7 +114,7 @@ public class PeerInfoService { public void removePeer(PeerId id) { jObjectTxManager.run(() -> { - var gotKey = getTreeR().traverse(List.of(JKleppmannTreeNodeMetaPeer.peerIdToNodeId(id).name())); + var gotKey = getTreeR().traverse(List.of(JKleppmannTreeNodeMetaPeer.peerIdToNodeId(id).value())); if (gotKey == null) { return; } diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/structs/JKleppmannTreeNodeMetaPeer.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/structs/JKleppmannTreeNodeMetaPeer.java index 27f1bcb8..4e36f609 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/structs/JKleppmannTreeNodeMetaPeer.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peersync/structs/JKleppmannTreeNodeMetaPeer.java @@ -11,19 +11,19 @@ public class JKleppmannTreeNodeMetaPeer extends JKleppmannTreeNodeMeta { private final JObjectKey _peerId; public JKleppmannTreeNodeMetaPeer(PeerId id) { - super(peerIdToNodeId(id).name()); + super(peerIdToNodeId(id).value()); _peerId = id.toJObjectKey(); } public static JObjectKey peerIdToNodeId(PeerId id) { - return JObjectKey.of(id.toJObjectKey().name() + "_tree_node"); + return JObjectKey.of(id.toJObjectKey().value() + "_tree_node"); } public static PeerId nodeIdToPeerId(JObjectKey id) { - if (!id.name().endsWith("_tree_node")) { + if (!id.value().endsWith("_tree_node")) { throw new IllegalArgumentException("Not a tree node key: " + id); } - return PeerId.of(id.name().substring(0, id.name().length() - "_tree_node".length())); + return PeerId.of(id.value().substring(0, id.value().length() - "_tree_node".length())); } public JObjectKey getPeerId() { @@ -32,7 +32,7 @@ public class JKleppmannTreeNodeMetaPeer extends JKleppmannTreeNodeMeta { @Override public JKleppmannTreeNodeMeta withName(String name) { - assert name.equals(peerIdToNodeId(PeerId.of(getPeerId().name())).toString()); + assert name.equals(peerIdToNodeId(PeerId.of(getPeerId().value())).toString()); assert getName().equals(name); return this; } diff --git a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peertrust/PeerInfoCertUpdateTxHook.java b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peertrust/PeerInfoCertUpdateTxHook.java index f6af060a..84815791 100644 --- a/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peertrust/PeerInfoCertUpdateTxHook.java +++ b/dhfs-parent/sync-base/src/main/java/com/usatiuk/dhfs/repository/peertrust/PeerInfoCertUpdateTxHook.java @@ -30,7 +30,7 @@ public class PeerInfoCertUpdateTxHook implements PreCommitTxHook { // connecting two other nodes // TODO: Can there be a prettier way to do this? (e.g. more general proxying of ops?) if (cur instanceof JKleppmannTreeNode n) { - if (n.key().name().equals("peers_jt_root")) { + if (n.key().value().equals("peers_jt_root")) { // TODO: This is kinda sucky Log.infov("Changed peer tree root: {0} to {1}", key, cur);