Remove FSTReader.size() (#12802)

* Move size() to FSTStore

* Remove size() completely

---------

Co-authored-by: Michael McCandless <mikemccand@apache.org>
This commit is contained in:
Dzung Bui 2023-11-21 22:05:41 +09:00 committed by GitHub
parent d0e0f6090e
commit 4309917215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 23 deletions

View File

@ -308,11 +308,6 @@ class BytesStore extends DataOutput implements FSTReader {
return ((long) blocks.size() - 1) * blockSize + nextWrite;
}
@Override
public long size() {
return getPosition();
}
/** Set the position of this BytesStore, truncating or expanding if needed */
public void setPosition(long newLen) {
assert newLen >= 0;

View File

@ -827,7 +827,7 @@ public class FSTCompiler<T> {
}
void finish(long newStartNode) {
assert newStartNode <= bytes.size();
assert newStartNode <= bytes.getPosition();
if (fst.metadata.startNode != -1) {
throw new IllegalStateException("already finished");
}

View File

@ -23,13 +23,6 @@ import org.apache.lucene.util.Accountable;
/** Abstraction for reading bytes necessary for FST. */
public interface FSTReader extends Accountable {
/**
* The raw size in bytes of the FST
*
* @return the FST size
*/
long size();
/**
* Get the reverse BytesReader for this FST
*

View File

@ -56,7 +56,6 @@ public final class OffHeapFSTStore implements FSTStore {
return BASE_RAM_BYTES_USED;
}
@Override
public long size() {
return numBytes;
}

View File

@ -64,15 +64,6 @@ public final class OnHeapFSTStore implements FSTStore {
return this;
}
@Override
public long size() {
if (bytesArray != null) {
return bytesArray.length;
} else {
return bytes.getPosition();
}
}
@Override
public long ramBytesUsed() {
long size = BASE_RAM_BYTES_USED;