Class BlockBasedFile
java.lang.Object
org.eclipse.jgit.internal.storage.dfs.BlockBasedFile
- Direct Known Subclasses:
DfsPackFile
,DfsReftable
Block based file stored in
DfsBlockCache
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
A supplier of readable channel that opens the channel lazily. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
Preferred alignment for loading blocks from the backing file.(package private) final DfsBlockCache
Cache that owns this file and its data.(package private) final DfsPackDescription
Description of the associated pack file's storage.(package private) final PackExt
(package private) boolean
True once corruption has been detected that cannot be worked around.protected Exception
Exception that caused the packfile to be flagged as invalid(package private) final DfsStreamKey
Unique identity of this file while in-memory.(package private) long
Total number of bytes in this pack file. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) long
alignToBlock
(long pos) (package private) int
(package private) static long
elapsedMicros
(long start) (package private) String
(package private) DfsBlock
getOrLoadBlock
(long pos, DfsReader ctx) (package private) boolean
invalid()
(package private) static int
read
(ReadableChannel rc, ByteBuffer buf) (package private) DfsBlock
readOneBlock
(long pos, DfsReader ctx, ReadableChannel rc) (package private) void
setBlockSize
(int newSize) (package private) void
-
Field Details
-
cache
Cache that owns this file and its data. -
key
Unique identity of this file while in-memory. -
desc
Description of the associated pack file's storage. -
ext
-
blockSize
volatile int blockSizePreferred 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 lengthTotal number of bytes in this pack file.This field initializes to -1 and gets populated when a block is loaded.
-
invalid
volatile boolean invalidTrue once corruption has been detected that cannot be worked around. -
invalidatingCause
Exception that caused the packfile to be flagged as invalid
-
-
Constructor Details
-
BlockBasedFile
BlockBasedFile(DfsBlockCache cache, DfsPackDescription desc, PackExt ext)
-
-
Method Details
-
getFileName
String getFileName() -
invalid
boolean invalid() -
setInvalid
void setInvalid() -
setBlockSize
void setBlockSize(int newSize) -
alignToBlock
long alignToBlock(long pos) -
blockSize
-
getOrLoadBlock
- Throws:
IOException
-
readOneBlock
- Throws:
IOException
-
read
- Throws:
IOException
-
elapsedMicros
static long elapsedMicros(long start)
-