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

public Class DfsReftable

extends BlockBasedFile
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.pack.PackExt.REFTABLE

A reftable stored in org.eclipse.jgit.internal.storage.dfs.DfsBlockCache.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Inherited from org.eclipse.jgit.internal.storage.dfs.BlockBasedFile:
blockSizecachedescextinvalidinvalidatingCausekeylength

Constructor Summary

AccessConstructor and Description
public
DfsReftable(DfsPackDescription
description of the reftable within the DFS.
desc
)

Construct a reader for an existing reftable.

public
DfsReftable(DfsBlockCache
cache that will store the reftable data.
cache
,
DfsPackDescription
description of the reftable within the DFS.
desc
)

Construct a reader for an existing reftable.

Method Summary

Modifier and TypeMethod and Description
public DfsPackDescription

Returns:

description that was originally used to configure this file.
getPackDescription
()

Get description that was originally used to configure this file.

public ReftableReader

Returns:

cursor to read the table; caller must close.
open
(DfsReader
reader to access the DFS storage.
ctx
)

Open reader on the reftable.

Inherited from org.eclipse.jgit.internal.storage.dfs.BlockBasedFile:
alignToBlockblockSizeelapsedMicrosgetFileNamegetOrLoadBlockinvalidreadreadOneBlocksetBlockSizesetInvalid

Constructor Detail

DfsReftableback to summary
public DfsReftable(DfsPackDescription desc)

Construct a reader for an existing reftable.

Parameters
desc:DfsPackDescription

description of the reftable within the DFS.

DfsReftableback to summary
public DfsReftable(DfsBlockCache cache, DfsPackDescription desc)

Construct a reader for an existing reftable.

Parameters
cache:DfsBlockCache

cache that will store the reftable data.

desc:DfsPackDescription

description of the reftable within the DFS.

Method Detail

getPackDescriptionback to summary
public DfsPackDescription getPackDescription()

Get description that was originally used to configure this file.

Returns:DfsPackDescription

description that was originally used to configure this file.

openback to summary
public ReftableReader open(DfsReader ctx) throws IOException

Open reader on the reftable.

The returned reader is not thread safe.

Parameters
ctx:DfsReader

reader to access the DFS storage.

Returns:ReftableReader

cursor to read the table; caller must close.

Exceptions
IOException:
table cannot be opened.
org.eclipse.jgit.internal.storage.dfs back to summary

private final Class DfsReftable.CacheSource

extends BlockSource
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final DfsBlockCache
private ReadableChannel
private final DfsReader
private final DfsReftable
private int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
adviseSequentialRead(long
starting position.
start
,
long
ending position.
end
)

Overrides org.eclipse.jgit.internal.storage.io.BlockSource.adviseSequentialRead.

Advise the BlockSource a sequential scan is starting.

public void
close()

Implements abstract org.eclipse.jgit.internal.storage.io.BlockSource.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

private boolean
notInCache(long pos)

private ReadableChannel
open()

public ByteBuffer
read(long
position of the block in the file, specified in bytes from the beginning of the file.
pos
,
int
size to read.
cnt
)

Implements abstract org.eclipse.jgit.internal.storage.io.BlockSource.read.

Read a block from the file.

public long
size()

Implements abstract org.eclipse.jgit.internal.storage.io.BlockSource.size.

Determine the size of the file.

Inherited from org.eclipse.jgit.internal.storage.io.BlockSource:
fromfromfrom

Field Detail

cacheback to summary
private final DfsBlockCache cache
chback to summary
private ReadableChannel ch
ctxback to summary
private final DfsReader ctx
fileback to summary
private final DfsReftable file
readAheadback to summary
private int readAhead

Constructor Detail

CacheSourceback to summary
pack-priv CacheSource(DfsReftable file, DfsBlockCache cache, DfsReader ctx)

Method Detail

adviseSequentialReadback to summary
public void adviseSequentialRead(long start, long end)

Overrides org.eclipse.jgit.internal.storage.io.BlockSource.adviseSequentialRead.

Doc from org.eclipse.jgit.internal.storage.io.BlockSource.adviseSequentialRead.

Advise the BlockSource a sequential scan is starting.

Parameters
start:long

starting position.

end:long

ending position.

Annotations
@Override
closeback to summary
public void close()

Implements abstract org.eclipse.jgit.internal.storage.io.BlockSource.close.

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
notInCacheback to summary
private boolean notInCache(long pos)
openback to summary
private ReadableChannel open() throws IOException
readback to summary
public ByteBuffer read(long pos, int cnt) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.io.BlockSource.read.

Doc from org.eclipse.jgit.internal.storage.io.BlockSource.read.

Read a block from the file.

To reduce copying, the returned ByteBuffer should have an accessible array and arrayOffset() == 0. The caller will discard the ByteBuffer and directly use the backing array.

Parameters
pos:long

position of the block in the file, specified in bytes from the beginning of the file.

cnt:int

size to read.

Returns:ByteBuffer

buffer containing the block content.

Annotations
@Override
Exceptions
IOException:
if block cannot be read.
sizeback to summary
public long size() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.io.BlockSource.size.

Doc from org.eclipse.jgit.internal.storage.io.BlockSource.size.

Determine the size of the file.

Returns:long

total number of bytes in the file.

Annotations
@Override
Exceptions
IOException:
if size cannot be obtained.