Skip to content

Commit

Permalink
Catalog Handler interface to support AWS Glue Compression (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitk-me authored Jun 5, 2024
1 parent aef4202 commit 18a992f
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ public int encode(
}

@Override
public int encodePadding()
public int encodePadding(
int length)
{
return MAX_PADDING_LENGTH;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void shouldVerifyMaxPadding()
{
ApicurioCatalogHandler catalog = new ApicurioCatalogHandler(config, context, 0L);

assertEquals(9, catalog.encodePadding());
assertEquals(9, catalog.encodePadding(0));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ public int encode(
}

@Override
public int encodePadding()
public int encodePadding(
int length)
{
return MAX_PADDING_LENGTH;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void shouldVerifyMaxPadding()
{
KarapaceCatalogHandler catalog = new KarapaceCatalogHandler(config, context, 0L);

assertEquals(5, catalog.encodePadding());
assertEquals(5, catalog.encodePadding(0));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,16 @@ default int encode(
return encoder.accept(traceId, bindingId, schemaId, data, index, length, next);
}

default int encodePadding()
default int encodePadding(
int length)
{
return 0;
}

default int decodePadding(
DirectBuffer data,
int index,
int length)
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public int padding(
int index,
int length)
{
return handler.encodePadding();
return handler.encodePadding(length);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public int padding(
int index,
int length)
{
int padding = 0;
int padding = handler.decodePadding(data, index, length);
if (VIEW_JSON.equals(view))
{
int schemaId = handler.resolve(data, index, length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public int padding(
int index,
int length)
{
return handler.encodePadding();
return handler.encodePadding(length);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ public JsonReadConverterHandler(
super(config, context);
}

@Override
public int padding(
DirectBuffer data,
int index,
int length)
{
return handler.decodePadding(data, index, length);
}

@Override
public int convert(
long traceId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public int padding(
int index,
int length)
{
return handler.encodePadding();
return handler.encodePadding(length);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public int padding(
int index,
int length)
{
int padding = 0;
int padding = handler.decodePadding(data, index, length);
if (VIEW_JSON.equals(view))
{
int schemaId = handler.resolve(data, index, length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public int padding(
? catalog.id
: handler.resolve(subject, catalog.version);

return handler.encodePadding() + supplyIndexPadding(schemaId);
return handler.encodePadding(length) + supplyIndexPadding(schemaId);
}

@Override
Expand Down

0 comments on commit 18a992f

Please sign in to comment.