|
|
@ -19,7 +19,7 @@ import org.hyperledger.besu.plugin.services.storage.SegmentIdentifier; |
|
|
|
import org.bouncycastle.util.Arrays; |
|
|
|
import org.bouncycastle.util.Arrays; |
|
|
|
|
|
|
|
|
|
|
|
public enum KeyValueSegmentIdentifier implements SegmentIdentifier { |
|
|
|
public enum KeyValueSegmentIdentifier implements SegmentIdentifier { |
|
|
|
BLOCKCHAIN(new byte[] {1}), |
|
|
|
BLOCKCHAIN(new byte[] {1}, true), |
|
|
|
WORLD_STATE(new byte[] {2}, new int[] {0, 1}), |
|
|
|
WORLD_STATE(new byte[] {2}, new int[] {0, 1}), |
|
|
|
PRIVATE_TRANSACTIONS(new byte[] {3}), |
|
|
|
PRIVATE_TRANSACTIONS(new byte[] {3}), |
|
|
|
PRIVATE_STATE(new byte[] {4}), |
|
|
|
PRIVATE_STATE(new byte[] {4}), |
|
|
@ -44,14 +44,25 @@ public enum KeyValueSegmentIdentifier implements SegmentIdentifier { |
|
|
|
|
|
|
|
|
|
|
|
private final byte[] id; |
|
|
|
private final byte[] id; |
|
|
|
private final int[] versionList; |
|
|
|
private final int[] versionList; |
|
|
|
|
|
|
|
private final boolean containsStaticData; |
|
|
|
|
|
|
|
|
|
|
|
KeyValueSegmentIdentifier(final byte[] id) { |
|
|
|
KeyValueSegmentIdentifier(final byte[] id) { |
|
|
|
this(id, new int[] {0, 1, 2}); |
|
|
|
this(id, new int[] {0, 1, 2}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeyValueSegmentIdentifier(final byte[] id, final boolean containsStaticData) { |
|
|
|
|
|
|
|
this(id, new int[] {0, 1, 2}, containsStaticData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
KeyValueSegmentIdentifier(final byte[] id, final int[] versionList) { |
|
|
|
KeyValueSegmentIdentifier(final byte[] id, final int[] versionList) { |
|
|
|
|
|
|
|
this(id, versionList, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeyValueSegmentIdentifier( |
|
|
|
|
|
|
|
final byte[] id, final int[] versionList, final boolean containsStaticData) { |
|
|
|
this.id = id; |
|
|
|
this.id = id; |
|
|
|
this.versionList = versionList; |
|
|
|
this.versionList = versionList; |
|
|
|
|
|
|
|
this.containsStaticData = containsStaticData; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -64,6 +75,11 @@ public enum KeyValueSegmentIdentifier implements SegmentIdentifier { |
|
|
|
return id; |
|
|
|
return id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean containsStaticData() { |
|
|
|
|
|
|
|
return containsStaticData; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean includeInDatabaseVersion(final int version) { |
|
|
|
public boolean includeInDatabaseVersion(final int version) { |
|
|
|
return Arrays.contains(versionList, version); |
|
|
|
return Arrays.contains(versionList, version); |
|
|
|