Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.storage.dfs

pack-priv abstract Class BlockBasedFile

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.dfs.DfsPackFile, org.eclipse.jgit.internal.storage.dfs.DfsReftable
Imports
java.io.EOFException, .IOException, java.nio.ByteBuffer, java.text.MessageFormat, org.eclipse.jgit.errors.PackInvalidException, org.eclipse.jgit.internal.storage.pack.PackExt

Block based file stored in DfsBlockCache.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
BlockBasedFile.LazyChannel

A supplier of readable channel that opens the channel lazily.

Field Summary

Modifier and TypeField and Description
pack-priv volatile int
blockSize

Preferred alignment for loading blocks from the backing file.

pack-priv final DfsBlockCache
cache

Cache that owns this file and its data.

pack-priv final DfsPackDescription
desc

Description of the associated pack file's storage.

pack-priv final PackExt
pack-priv volatile boolean
invalid

True once corruption has been detected that cannot be worked around.

protected volatile Exception
invalidatingCause

Exception that caused the packfile to be flagged as invalid

pack-priv final DfsStreamKey
key

Unique identity of this file while in-memory.

pack-priv volatile long
length

Total number of bytes in this pack file.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv long
alignToBlock(long pos)

pack-priv int
pack-priv static long
elapsedMicros(long start)

pack-priv String
pack-priv DfsBlock
getOrLoadBlock(long pos, DfsReader ctx)

pack-priv boolean
pack-priv static int
pack-priv DfsBlock
pack-priv void
setBlockSize(int newSize)

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockSizeback to summary
pack-priv 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.

cacheback to summary
pack-priv final DfsBlockCache cache

Cache that owns this file and its data.

descback to summary
pack-priv final DfsPackDescription desc

Description of the associated pack file's storage.

extback to summary
pack-priv final PackExt ext
invalidback to summary
pack-priv volatile boolean invalid

True once corruption has been detected that cannot be worked around.

invalidatingCauseback to summary
protected volatile Exception invalidatingCause

Exception that caused the packfile to be flagged as invalid

keyback to summary
pack-priv final DfsStreamKey key

Unique identity of this file while in-memory.

lengthback to summary
pack-priv volatile long length

Total number of bytes in this pack file.

This field initializes to -1 and gets populated when a block is loaded.

Constructor Detail

BlockBasedFileback to summary
pack-priv BlockBasedFile(DfsBlockCache cache, DfsPackDescription desc, PackExt ext)

Method Detail

alignToBlockback to summary
pack-priv long alignToBlock(long pos)
blockSizeback to summary
pack-priv int blockSize(ReadableChannel rc)
elapsedMicrosback to summary
pack-priv static long elapsedMicros(long start)
getFileNameback to summary
pack-priv String getFileName()
getOrLoadBlockback to summary
pack-priv DfsBlock getOrLoadBlock(long pos, DfsReader ctx) throws IOException
invalidback to summary
pack-priv boolean invalid()
readback to summary
pack-priv static int read(ReadableChannel rc, ByteBuffer buf) throws IOException
readOneBlockback to summary
pack-priv DfsBlock readOneBlock(long pos, DfsReader ctx, ReadableChannel rc) throws IOException
setBlockSizeback to summary
pack-priv void setBlockSize(int newSize)
setInvalidback to summary
pack-priv void setInvalid()
org.eclipse.jgit.internal.storage.dfs back to summary

private Class BlockBasedFile.LazyChannel

extends Object
implements AutoCloseable, ReadableChannelSupplier
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.dfs.BlockBasedFile.LazyChannel
All Implemented Interfaces
org.eclipse.jgit.internal.storage.dfs.DfsBlockCache.ReadableChannelSupplier, java.lang.AutoCloseable

A supplier of readable channel that opens the channel lazily.

Field Summary

Modifier and TypeField and Description
private final DfsReader
private final DfsPackDescription
private final PackExt
private ReadableChannel

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public ReadableChannel
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ctxback to summary
private final DfsReader ctx
descback to summary
private final DfsPackDescription desc
extback to summary
private final PackExt ext
rcback to summary
private ReadableChannel rc

Constructor Detail

LazyChannelback to summary
pack-priv LazyChannel(DfsReader ctx, DfsPackDescription desc, PackExt ext)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
getback to summary
public ReadableChannel get() throws IOException

Implements org.eclipse.jgit.internal.storage.dfs.DfsBlockCache.ReadableChannelSupplier.get.

Doc from org.eclipse.jgit.internal.storage.dfs.DfsBlockCache.ReadableChannelSupplier.get.

Get ReadableChannel

Returns:ReadableChannel

ReadableChannel

Annotations
@Override
Exceptions
IOException:
if an IO error occurred