Skip to content

Commit

Permalink
fix: implement InMemoryLogStorage.append
Browse files Browse the repository at this point in the history
This method was newly added to LogStorage to support appends of
unserialized application data.

The implementation of the test class ListLogStorage seemed like a
reasonable solution for zeebe-process-test. It simply writes the
contents of the writer into a buffer and appends it as usual.

See:
https://github.com/camunda/zeebe/blob/4dd1025f3f3ba86b5aec10d380b9db8550ed0967/logstreams/src/test/java/io/camunda/zeebe/logstreams/util/ListLogStorage.java#L77-L79
  • Loading branch information
korthout committed Dec 16, 2022
1 parent f6d6bc3 commit 1368ba5
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.camunda.zeebe.logstreams.storage.LogStorage;
import io.camunda.zeebe.logstreams.storage.LogStorageReader;
import io.camunda.zeebe.util.buffer.BufferWriter;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashSet;
Expand All @@ -33,6 +34,17 @@ public LogStorageReader newReader() {
return new ListLogStorageReader();
}

@Override
public void append(
final long lowestPosition,
final long highestPosition,
final BufferWriter bufferWriter,
final AppendListener listener) {
final var buffer = ByteBuffer.allocate(bufferWriter.getLength());
bufferWriter.write(new UnsafeBuffer(buffer), 0);
append(lowestPosition, highestPosition, buffer, listener);
}

@Override
public void append(
final long lowestPosition,
Expand Down

0 comments on commit 1368ba5

Please sign in to comment.