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

public Interface DfsBlockCacheTable

Known Direct Implementers
org.eclipse.jgit.internal.storage.dfs.PackExtBlockCacheTable, org.eclipse.jgit.internal.storage.dfs.ClockBlockCacheTable
Imports
java.io.IOException, java.util.List

Block cache table.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
DfsBlockCacheTable.BlockCacheStats

Provides methods used with Block Cache statistics.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

if the block cache contains the object identified by (key, position).
contains
(DfsStreamKey
the stream key of the pack.
key
,
long
the position in the key.
position
)

Check if the block cache contains an object identified by (key, position).

public <T> T

Returns:

the object identified by (key, position).
get
(DfsStreamKey
the stream key of the pack.
key
,
long
the position in the key.
position
)

Get the object identified by (key, position) from the block cache.

public List<DfsBlockCacheTable.BlockCacheStats>

Returns:

the list of BlockCacheStats held by this cache.
getBlockCacheStats
()

Get the list of BlockCacheStats held by this cache.

public String

Returns:

this table's name.
getName
()

Get the name of the table.

public DfsBlock

Returns:

the object reference.
getOrLoad
(BlockBasedFile
the pack that "contains" the cached object.
file
,
long
offset within pack of the object.
position
,
DfsReader
current thread's reader.
dfsReader
,
DfsBlockCache.ReadableChannelSupplier
supplier for channel to read pack.
fileChannel
)

Look up a cached object, creating and loading it if it doesn't exist.

public <T> DfsBlockCache.Ref<T>

Returns:

the object reference.
getOrLoadRef
(DfsStreamKey
the stream key of the pack.
key
,
long
the position in the key. The default should be 0.
position
,
DfsBlockCache.RefLoader<T>
the function to load the reference.
loader
)

Look up a cached object, creating and loading it if it doesn't exist.

public boolean

Returns:

true if block 0 (the first block) is in the cache.
hasBlock0
(DfsStreamKey
the file to check.
key
)

Quickly check if the cache contains block 0 of the given stream.

public void
put(DfsBlock
the block to put in the cache.
v
)

Put a block in the block cache.

public <T> DfsBlockCache.Ref<T>

Returns:

the object reference.
put
(DfsStreamKey
the stream key of the pack.
key
,
long
the position in the key.
pos
,
long
the size of the object.
size
,
T
the object to put in the block cache.
v
)

Put a block in the block cache.

public <T> DfsBlockCache.Ref<T>

Returns:

the object reference.
putRef
(DfsStreamKey
the stream key of the pack.
key
,
long
the size of the object.
size
,
T
the object to put in the block cache.
v
)

Put an object in the block cache.

Method Detail

containsback to summary
public boolean contains(DfsStreamKey key, long position)

Check if the block cache contains an object identified by (key, position).

Parameters
key:DfsStreamKey

the stream key of the pack.

position:long

the position in the key.

Returns:boolean

if the block cache contains the object identified by (key, position).

getback to summary
public <T> T get(DfsStreamKey key, long position)

Get the object identified by (key, position) from the block cache.

Parameters
key:DfsStreamKey

the stream key of the pack.

position:long

the position in the key.

Returns:T

the object identified by (key, position).

getBlockCacheStatsback to summary
public List<DfsBlockCacheTable.BlockCacheStats> getBlockCacheStats()

Get the list of BlockCacheStats held by this cache.

The returned list has a BlockCacheStats per configured cache table, with a minimum of 1 BlockCacheStats object returned. Use AggregatedBlockCacheStats to combine the results of the stats in the list for an aggregated view of the cache's stats.

Returns:List<DfsBlockCacheTable.BlockCacheStats>

the list of BlockCacheStats held by this cache.

getNameback to summary
public String getName()

Get the name of the table.

Returns:String

this table's name.

getOrLoadback to summary
public DfsBlock getOrLoad(BlockBasedFile file, long position, DfsReader dfsReader, DfsBlockCache.ReadableChannelSupplier fileChannel) throws IOException

Look up a cached object, creating and loading it if it doesn't exist.

Parameters
file:BlockBasedFile

the pack that "contains" the cached object.

position:long

offset within pack of the object.

dfsReader:DfsReader

current thread's reader.

fileChannel:DfsBlockCache.ReadableChannelSupplier

supplier for channel to read pack.

Returns:DfsBlock

the object reference.

Exceptions
IOException:
the reference was not in the cache and could not be loaded.
getOrLoadRefback to summary
public <T> DfsBlockCache.Ref<T> getOrLoadRef(DfsStreamKey key, long position, DfsBlockCache.RefLoader<T> loader) throws IOException

Look up a cached object, creating and loading it if it doesn't exist.

Parameters
key:DfsStreamKey

the stream key of the pack.

position:long

the position in the key. The default should be 0.

loader:DfsBlockCache.RefLoader<T>

the function to load the reference.

Returns:DfsBlockCache.Ref<T>

the object reference.

Exceptions
IOException:
the reference was not in the cache and could not be loaded.
hasBlock0back to summary
public boolean hasBlock0(DfsStreamKey key)

Quickly check if the cache contains block 0 of the given stream.

This can be useful for sophisticated pre-read algorithms to quickly determine if a file is likely already in cache, especially small reftables which may be smaller than a typical DFS block size.

Parameters
key:DfsStreamKey

the file to check.

Returns:boolean

true if block 0 (the first block) is in the cache.

putback to summary
public void put(DfsBlock v)

Put a block in the block cache.

Parameters
v:DfsBlock

the block to put in the cache.

putback to summary
public <T> DfsBlockCache.Ref<T> put(DfsStreamKey key, long pos, long size, T v)

Put a block in the block cache.

Parameters
key:DfsStreamKey

the stream key of the pack.

pos:long

the position in the key.

size:long

the size of the object.

v:T

the object to put in the block cache.

Returns:DfsBlockCache.Ref<T>

the object reference.

putRefback to summary
public <T> DfsBlockCache.Ref<T> putRef(DfsStreamKey key, long size, T v)

Put an object in the block cache.

Parameters
key:DfsStreamKey

the stream key of the pack.

size:long

the size of the object.

v:T

the object to put in the block cache.

Returns:DfsBlockCache.Ref<T>

the object reference.

org.eclipse.jgit.internal.storage.dfs back to summary

public Interface DfsBlockCacheTable.BlockCacheStats

Known Direct Implementers
org.eclipse.jgit.internal.storage.dfs.AggregatedBlockCacheStats, org.eclipse.jgit.internal.storage.dfs.DfsBlockCacheStats

Provides methods used with Block Cache statistics.

Method Summary

Modifier and TypeMethod and Description
public long[]

Returns:

total number of bytes in the cache, per pack file extension.
getCurrentSize
()

Get total number of bytes in the cache, per pack file extension.

public long[]

Returns:

the number of evictions performed due to cache being full, per pack file extension.
getEvictions
()

Get number of evictions performed due to cache being full, per pack file extension.

public long[]

Returns:

the number of requests for items in the cache, per pack file extension.
getHitCount
()

Get number of requests for items in the cache, per pack file extension.

public long[]

Returns:

hit ratios.
getHitRatio
()

Get hit ratios.

public long[]

Returns:

the number of requests for items not in the cache, per pack file extension.
getMissCount
()

Get number of requests for items not in the cache, per pack file extension.

public String

Returns:

this cache's name.
getName
()

Get the name of the block cache generating this instance.

public long[]

Returns:

total number of requests (hit + miss), per pack file extension.
getTotalRequestCount
()

Get total number of requests (hit + miss), per pack file extension.

Method Detail

getCurrentSizeback to summary
public long[] getCurrentSize()

Get total number of bytes in the cache, per pack file extension.

Returns:long[]

total number of bytes in the cache, per pack file extension.

getEvictionsback to summary
public long[] getEvictions()

Get number of evictions performed due to cache being full, per pack file extension.

Returns:long[]

the number of evictions performed due to cache being full, per pack file extension.

getHitCountback to summary
public long[] getHitCount()

Get number of requests for items in the cache, per pack file extension.

Returns:long[]

the number of requests for items in the cache, per pack file extension.

getHitRatioback to summary
public long[] getHitRatio()

Get hit ratios.

Returns:long[]

hit ratios.

getMissCountback to summary
public long[] getMissCount()

Get number of requests for items not in the cache, per pack file extension.

Returns:long[]

the number of requests for items not in the cache, per pack file extension.

getNameback to summary
public String getName()

Get the name of the block cache generating this instance.

Returns:String

this cache's name.

getTotalRequestCountback to summary
public long[] getTotalRequestCount()

Get total number of requests (hit + miss), per pack file extension.

Returns:long[]

total number of requests (hit + miss), per pack file extension.