Skip to content

Commit

Permalink
perf(s3stream): not create primitive ComparableItem for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
lifepuzzlefun committed Jan 29, 2024
1 parent 3bbd770 commit 67b1d08
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
package com.automq.stream.s3.model;

import com.automq.stream.s3.StreamRecordBatchCodec;
import com.automq.stream.utils.biniarysearch.primitive.LongComparableItem;
import com.automq.stream.utils.biniarysearch.ComparableItem;
import io.netty.buffer.ByteBuf;

public class StreamRecordBatch implements Comparable<StreamRecordBatch>, LongComparableItem {
public class StreamRecordBatch implements Comparable<StreamRecordBatch>, ComparableItem<Long> {
private final long streamId;
private final long epoch;
private final long baseOffset;
Expand Down Expand Up @@ -116,12 +116,12 @@ public String toString() {
}

@Override
public boolean isLessThan(long value) {
public boolean isLessThan(Long value) {
return getLastOffset() <= value;
}

@Override
public boolean isGreaterThan(long value) {
public boolean isGreaterThan(Long value) {
return getBaseOffset() > value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
package com.automq.stream.utils.biniarysearch;

import com.automq.stream.s3.model.StreamRecordBatch;
import com.automq.stream.utils.biniarysearch.primitive.LongComparableItem;
import com.automq.stream.utils.biniarysearch.primitive.LongOrderedCollection;

import java.util.List;

public class StreamRecordBatchList extends LongOrderedCollection {
public class StreamRecordBatchList extends AbstractOrderedCollection<Long> {

private final List<StreamRecordBatch> records;
private final int size;
Expand All @@ -39,7 +37,7 @@ public int size() {
}

@Override
protected LongComparableItem get(int index) {
protected ComparableItem<Long> get(int index) {
return records.get(index);
}

Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 67b1d08

Please sign in to comment.