Skip to content

Commit

Permalink
Added methods to Buffer and InMemoryBuffer for batch fetching
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Gonzalez Mayedo <[email protected]>
  • Loading branch information
Marcos Gonzalez Mayedo committed Jul 11, 2023
1 parent 1a24f1a commit c7f1e86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

package org.opensearch.dataprepper.plugins.sink.buffer;

import java.util.ArrayList;

/**
* Buffer that handles the temporary storage of
* events. It isolates the implementation of system storage.
Expand All @@ -28,4 +30,8 @@ public interface Buffer {
void writeEvent(byte[] event);

byte[] popEvent();

ArrayList<byte[]> getBufferedData();

void clearBuffer();
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,15 @@ public byte[] popEvent() {
bufferSize -= eventsBuffered.get(0).length;
return eventsBuffered.remove(0);
}

@Override
public ArrayList<byte[]> getBufferedData() {
return eventsBuffered;
}

@Override
public void clearBuffer() {
bufferSize = 0;
eventsBuffered.clear();
}
}

0 comments on commit c7f1e86

Please sign in to comment.