Skip to content

Commit 260e82b

Browse files
dfa1claude
andcommitted
refactor: rename EncodingId to CodecId
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 140105a commit 260e82b

23 files changed

Lines changed: 67 additions & 67 deletions

core/src/main/java/io/github/dfa1/vortex/encoding/AlpCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ private static PType ptypeFromProto(DTypeProtos.PType proto) {
7676
}
7777

7878
@Override
79-
public EncodingId encodingId() {
80-
return EncodingId.VORTEX_ALP;
79+
public CodecId encodingId() {
80+
return CodecId.VORTEX_ALP;
8181
}
8282

8383
// ── F32 ───────────────────────────────────────────────────────────────────

core/src/main/java/io/github/dfa1/vortex/encoding/ArrayNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/// Encoded array node as stored in a Flat layout segment.
88
/// In-file representation before decoding; mirrors the Go ArrayNode struct.
99
record ArrayNode(
10-
EncodingId encodingId,
10+
CodecId encodingId,
1111
ByteBuffer metadata,
1212
ArrayNode[] children,
1313
int[] bufferIndices,

core/src/main/java/io/github/dfa1/vortex/encoding/BitpackedCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ private static boolean isUnsigned(PType ptype) {
488488
// ── Type conversion ───────────────────────────────────────────────────────
489489

490490
@Override
491-
public EncodingId encodingId() {
492-
return EncodingId.FASTLANES_BITPACKED;
491+
public CodecId encodingId() {
492+
return CodecId.FASTLANES_BITPACKED;
493493
}
494494

495495
// ── Misc helpers ──────────────────────────────────────────────────────────

core/src/main/java/io/github/dfa1/vortex/encoding/BoolCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ private static ByteBuffer encodeBool(boolean[] data) {
2121
}
2222

2323
@Override
24-
public EncodingId encodingId() {
25-
return EncodingId.VORTEX_BOOL;
24+
public CodecId encodingId() {
25+
return CodecId.VORTEX_BOOL;
2626
}
2727

2828
@Override

core/src/main/java/io/github/dfa1/vortex/encoding/Codec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/// Register via [CodecRegistry] — implementations are discoverable via ServiceLoader.
88
public interface Codec {
99
/// Return the encoding id for this codec.
10-
EncodingId encodingId();
10+
CodecId encodingId();
1111

1212
/// Decode an array node from the file using the provided context.
1313
Array decode(DecodeContext ctx);

core/src/main/java/io/github/dfa1/vortex/encoding/EncodingId.java renamed to core/src/main/java/io/github/dfa1/vortex/encoding/CodecId.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.stream.Stream;
77

88
/// Strongly-typed encoding identifier used in place of raw strings.
9-
public enum EncodingId {
9+
public enum CodecId {
1010
VORTEX_PRIMITIVE("vortex.primitive"),
1111
VORTEX_BOOL("vortex.bool"),
1212
VORTEX_DICT("vortex.dict"),
@@ -29,17 +29,17 @@ public enum EncodingId {
2929
FASTLANES_FOR("fastlanes.for"),
3030
FASTLANES_DELTA("fastlanes.delta");
3131

32-
// O(1) access to EncodingId by its string representation
33-
private static final Map<String, EncodingId> LOOKUP = Stream.of(EncodingId.values())
34-
.collect(Collectors.toUnmodifiableMap(EncodingId::id, Function.identity()));
32+
// O(1) access to CodecId by its string representation
33+
private static final Map<String, CodecId> LOOKUP = Stream.of(CodecId.values())
34+
.collect(Collectors.toUnmodifiableMap(CodecId::id, Function.identity()));
3535
private final String id;
3636

37-
EncodingId(String id) {
37+
CodecId(String id) {
3838
this.id = id;
3939
}
4040

41-
public static EncodingId from(String id) {
42-
EncodingId result = LOOKUP.get(id);
41+
public static CodecId from(String id) {
42+
CodecId result = LOOKUP.get(id);
4343
if (result == null) {
4444
throw new IllegalArgumentException("unknown encoding id: " + id);
4545
}

core/src/main/java/io/github/dfa1/vortex/encoding/CodecRegistry.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/// Registry mapping encoding IDs to [Codec] implementations.
1818
public final class CodecRegistry {
1919

20-
private final Map<EncodingId, Codec> codecs = new HashMap<>();
20+
private final Map<CodecId, Codec> codecs = new HashMap<>();
2121

2222
private CodecRegistry() {
2323
}
@@ -40,7 +40,7 @@ private static ArrayNode convertArrayNode(
4040
List<String> encodingSpecs
4141
) {
4242
String encodingId = encodingSpecs.get(fbs.encoding());
43-
EncodingId encId = EncodingId.from(encodingId);
43+
CodecId encId = CodecId.from(encodingId);
4444

4545
ArrayNode[] children = new ArrayNode[fbs.childrenLength()];
4646
for (int i = 0; i < children.length; i++) {
@@ -91,7 +91,7 @@ public Array decodeSegment(MemorySegment seg, List<String> encodingSpecs,
9191
}
9292

9393
Array decode(DecodeContext ctx) {
94-
EncodingId id = ctx.node().encodingId();
94+
CodecId id = ctx.node().encodingId();
9595
Codec c = codecs.get(id);
9696
if (c == null) {
9797
throw new IllegalArgumentException("no codec for encoding: " + id);

core/src/main/java/io/github/dfa1/vortex/encoding/ConstantCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ private static void writeRaw(ByteBuffer buf, PType ptype, long rawBits) {
4545
// ── Helpers ───────────────────────────────────────────────────────────────
4646

4747
@Override
48-
public EncodingId encodingId() {
49-
return EncodingId.VORTEX_CONSTANT;
48+
public CodecId encodingId() {
49+
return CodecId.VORTEX_CONSTANT;
5050
}
5151

5252
@Override

core/src/main/java/io/github/dfa1/vortex/encoding/DeltaCodec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ private static boolean isUnsigned(PType ptype) {
151151
// ── Type conversion ───────────────────────────────────────────────────────
152152

153153
@Override
154-
public EncodingId encodingId() {
155-
return EncodingId.FASTLANES_DELTA;
154+
public CodecId encodingId() {
155+
return CodecId.FASTLANES_DELTA;
156156
}
157157

158158
@Override

core/src/main/java/io/github/dfa1/vortex/encoding/DictCodec.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ private static long readCode(MemorySegment buf, PType codePType, long i) {
175175
}
176176

177177
@Override
178-
public EncodingId encodingId() {
179-
return EncodingId.VORTEX_DICT;
178+
public CodecId encodingId() {
179+
return CodecId.VORTEX_DICT;
180180
}
181181

182182
@Override
@@ -220,10 +220,10 @@ public EncodeResult encode(DType dtype, Object data) {
220220
// Metadata: code PType ordinal
221221
ByteBuffer meta = ByteBuffer.allocate(1).put(0, (byte) codePType.ordinal());
222222

223-
EncodeNode valuesNode = EncodeNode.leaf(EncodingId.VORTEX_PRIMITIVE, 0);
224-
EncodeNode codesNode = EncodeNode.leaf(EncodingId.VORTEX_PRIMITIVE, 1);
223+
EncodeNode valuesNode = EncodeNode.leaf(CodecId.VORTEX_PRIMITIVE, 0);
224+
EncodeNode codesNode = EncodeNode.leaf(CodecId.VORTEX_PRIMITIVE, 1);
225225
EncodeNode rootNode = new EncodeNode(
226-
EncodingId.VORTEX_DICT, meta,
226+
CodecId.VORTEX_DICT, meta,
227227
new EncodeNode[]{valuesNode, codesNode},
228228
new int[0]);
229229

0 commit comments

Comments
 (0)