Class BlockBasedFile
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.dfs.BlockBasedFile
-
- Direct Known Subclasses:
DfsPackFile,DfsReftable
abstract class BlockBasedFile extends java.lang.ObjectBlock based file stored inDfsBlockCache.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBlockBasedFile.LazyChannelA supplier of readable channel that opens the channel lazily.
-
Field Summary
Fields Modifier and Type Field Description (package private) intblockSizePreferred alignment for loading blocks from the backing file.(package private) DfsBlockCachecacheCache that owns this file and its data.(package private) DfsPackDescriptiondescDescription of the associated pack file's storage.(package private) PackExtext(package private) booleaninvalidTrue once corruption has been detected that cannot be worked around.protected java.lang.ExceptioninvalidatingCauseException that caused the packfile to be flagged as invalid(package private) DfsStreamKeykeyUnique identity of this file while in-memory.(package private) longlengthTotal number of bytes in this pack file.
-
Constructor Summary
Constructors Constructor Description BlockBasedFile(DfsBlockCache cache, DfsPackDescription desc, PackExt ext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) longalignToBlock(long pos)(package private) intblockSize(ReadableChannel rc)(package private) static longelapsedMicros(long start)(package private) java.lang.StringgetFileName()(package private) DfsBlockgetOrLoadBlock(long pos, DfsReader ctx)(package private) booleaninvalid()(package private) static intread(ReadableChannel rc, java.nio.ByteBuffer buf)(package private) DfsBlockreadOneBlock(long pos, DfsReader ctx, ReadableChannel rc)(package private) voidsetBlockSize(int newSize)(package private) voidsetInvalid()
-
-
-
Field Detail
-
cache
final DfsBlockCache cache
Cache that owns this file and its data.
-
key
final DfsStreamKey key
Unique identity of this file while in-memory.
-
desc
final DfsPackDescription desc
Description of the associated pack file's storage.
-
ext
final PackExt ext
-
blockSize
volatile int blockSize
Preferred alignment for loading blocks from the backing file.It is initialized to 0 and filled in on the first read made from the file. Block sizes may be odd, e.g. 4091, caused by the underling DFS storing 4091 user bytes and 5 bytes block metadata into a lower level 4096 byte block on disk.
-
length
volatile long length
Total number of bytes in this pack file.This field initializes to -1 and gets populated when a block is loaded.
-
invalid
volatile boolean invalid
True once corruption has been detected that cannot be worked around.
-
invalidatingCause
protected volatile java.lang.Exception invalidatingCause
Exception that caused the packfile to be flagged as invalid
-
-
Constructor Detail
-
BlockBasedFile
BlockBasedFile(DfsBlockCache cache, DfsPackDescription desc, PackExt ext)
-
-
Method Detail
-
getFileName
java.lang.String getFileName()
-
invalid
boolean invalid()
-
setInvalid
void setInvalid()
-
setBlockSize
void setBlockSize(int newSize)
-
alignToBlock
long alignToBlock(long pos)
-
blockSize
int blockSize(ReadableChannel rc)
-
getOrLoadBlock
DfsBlock getOrLoadBlock(long pos, DfsReader ctx) throws java.io.IOException
- Throws:
java.io.IOException
-
readOneBlock
DfsBlock readOneBlock(long pos, DfsReader ctx, ReadableChannel rc) throws java.io.IOException
- Throws:
java.io.IOException
-
read
static int read(ReadableChannel rc, java.nio.ByteBuffer buf) throws java.io.IOException
- Throws:
java.io.IOException
-
elapsedMicros
static long elapsedMicros(long start)
-
-