Package xyz.cofe.cbuffer.page
Class CCachePagedData.State
- java.lang.Object
-
- xyz.cofe.cbuffer.page.CCachePagedData.State
-
- All Implemented Interfaces:
CachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
- Enclosing class:
- CCachePagedData
public static class CCachePagedData.State extends Object implements CachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface xyz.cofe.cbuffer.page.CachePagedState
CachePagedState.NonThreadSafe
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]cache2prstReadWriteLockcacheLockprotected ReadWriteLock[]cachePageLocksprotected DirtyPagedDataSafecachePagesprotected booleanclosedprotected ResizablePages<UsedPagesInfo>persistentPagesprotected Map<Integer,Integer>prst2cacheprotected AtomicLongstatCacheHitprotected AtomicLongstatCacheMiss
-
Constructor Summary
Constructors Constructor Description State()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Rcache2prst_read(Function<IntArrayReadOnly,R> code)Отображение кеша страниц на основную память.voidcache2prst_replace(Function<IntArrayReadOnly,int[]> code)voidcache2prst_write(Consumer<IntArrayMutable> code)<R> RcachePageReadLock(int cache_page, Supplier<R> code)Optional<ReadWriteLock>cachePageRWLock(int cache_page)DirtyPagedDataSafecachePages()Кеш страниц (быстрая)voidcachePages(DirtyPagedDataSafe pages)<R> RcachePageWriteLock(int cache_page, Supplier<R> code)voidclose()<R> RglobalCacheLock(boolean write, Supplier<R> code)booleanisClosed()ResizablePages<UsedPagesInfo>persistentPages()Основная|Постоянная память (медленная)voidpersistentPages(ResizablePages<UsedPagesInfo> pages)Map<Integer,Integer>prst2cache()отображение страниц основной памяти на кешvoidprst2cache(Map<Integer,Integer> map)xyz.cofe.fn.Tuple2<Long,Long>statCacheHitMiss()voidstatCacheHitMiss(boolean hit)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface xyz.cofe.cbuffer.page.CachePagedState
prst2cache_read, prst2cache_write
-
-
-
-
Field Detail
-
cachePages
protected DirtyPagedDataSafe cachePages
-
persistentPages
protected ResizablePages<UsedPagesInfo> persistentPages
-
cache2prst
protected volatile int[] cache2prst
-
closed
protected volatile boolean closed
-
cachePageLocks
protected volatile ReadWriteLock[] cachePageLocks
-
statCacheHit
protected final AtomicLong statCacheHit
-
statCacheMiss
protected final AtomicLong statCacheMiss
-
cacheLock
public final ReadWriteLock cacheLock
-
-
Method Detail
-
statCacheHitMiss
public void statCacheHitMiss(boolean hit)
- Specified by:
statCacheHitMissin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
statCacheHitMiss
public xyz.cofe.fn.Tuple2<Long,Long> statCacheHitMiss()
- Specified by:
statCacheHitMissin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
cachePageRWLock
public Optional<ReadWriteLock> cachePageRWLock(int cache_page)
-
cachePageReadLock
public <R> R cachePageReadLock(int cache_page, Supplier<R> code)
-
cachePageWriteLock
public <R> R cachePageWriteLock(int cache_page, Supplier<R> code)
-
cachePages
public DirtyPagedDataSafe cachePages()
Description copied from interface:CachePagedStateКеш страниц (быстрая)- Specified by:
cachePagesin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
cachePages
public void cachePages(DirtyPagedDataSafe pages)
- Specified by:
cachePagesin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
persistentPages
public ResizablePages<UsedPagesInfo> persistentPages()
Description copied from interface:CachePagedStateОсновная|Постоянная память (медленная)- Specified by:
persistentPagesin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
persistentPages
public void persistentPages(ResizablePages<UsedPagesInfo> pages)
- Specified by:
persistentPagesin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
cache2prst_read
public <R> R cache2prst_read(Function<IntArrayReadOnly,R> code)
Description copied from interface:CachePagedStateОтображение кеша страниц на основную память.Семантика:
cache2prst[ cache_page_index ] = hard_pages_indexЗначение (hard_pages_index):
- -1 или меньше - нет отображения
-
0 или больше - отображение есть
страница может быть чистой или грязной:
DirtyPagedDataBase.dirty(int)- где аргумент hard_pages_index
- Specified by:
cache2prst_readin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
cache2prst_write
public void cache2prst_write(Consumer<IntArrayMutable> code)
- Specified by:
cache2prst_writein interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
cache2prst_replace
public void cache2prst_replace(Function<IntArrayReadOnly,int[]> code)
- Specified by:
cache2prst_replacein interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
prst2cache
public Map<Integer,Integer> prst2cache()
Description copied from interface:CachePagedStateотображение страниц основной памяти на кеш- Specified by:
prst2cachein interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
prst2cache
public void prst2cache(Map<Integer,Integer> map)
- Specified by:
prst2cachein interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
close
public void close()
- Specified by:
closein interfaceCachePagedState<UsedPagesInfo,DirtyPagedDataSafe>
-
globalCacheLock
public <R> R globalCacheLock(boolean write, Supplier<R> code)
-
-