Package com._1c.g5.v8.xmdb.impl
Interface ITreeCache
-
- All Known Implementing Classes:
TreeCacheInMemory
,TreeCacheReal
public interface ITreeCache
Cache for BTree
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
clone(long cLink)
Clone element by cLink (new element should not be cached by default).void
dropCaches()
Drop all cachevoid
dropCaches(int segment)
Drop cache entry with specified segment idvoid
evict()
Evict (usually - write to disk, but not sync) all cache entry (from write node cache).void
evict(int segmentId)
Evict (usually - write to disk, but no sync) all cache entry (from write node cache) with specified segmentId.BNode
get(long cLink, boolean storeValuesInLeaf, int t, int segment)
Read BNode from cache.Engine
getEngine()
Get underlying db enginebyte[]
getObject(long cLink, int segment)
Read object from cache.long
put(long oldPos, BNode val, int segment, boolean valInLeaf, int preallocFreeSpace)
Put (insert or update) BNode into cache.long
putObject(byte[] value, int segment)
Put object (value) into cachelong
putObject(ByteBuffer value, int segment)
Put object (value) into cachebyte[]
removeObject(long cLink, int segment)
Removes object from cache.void
sync()
Sync all write node cache entry and syncvoid
sync(int segmentId)
Write to disk (and sync) all cache entry (from write node cache) with specified segmentId.
-
-
-
Method Detail
-
put
long put(long oldPos, BNode val, int segment, boolean valInLeaf, int preallocFreeSpace)
Put (insert or update) BNode into cache. Cache return new adress of BNode (can be the same if BNode fit into allocated block)- Parameters:
oldPos
- old cLink address of BNode or CompactLink.EMPTY_LINK if its first time save to current BNodeval
- BNode to savesegment
- segment idvalInLeaf
- store value in leaf flagpreallocFreeSpace
- default prealloc space for current BTree- Returns:
- actual cLink to stored BNode
-
putObject
long putObject(ByteBuffer value, int segment)
Put object (value) into cache- Parameters:
value
- value to storesegment
- segment id- Returns:
- actual cLink to stored object
-
putObject
long putObject(byte[] value, int segment)
Put object (value) into cache- Parameters:
value
- value to storesegment
- segment id- Returns:
- actual cLink to stored object
-
get
BNode get(long cLink, boolean storeValuesInLeaf, int t, int segment)
Read BNode from cache. If BNode won't be found in read/write node caches - it will be load from disk into read cache before return- Parameters:
cLink
- BNode address (cLink)storeValuesInLeaf
- value in leaf flag (for deserialization, if node on disk)t
- node width, t (for deserialization, if node on disk)segment
- segment id- Returns:
- readed BNode
-
getObject
byte[] getObject(long cLink, int segment)
Read object from cache. If object won't be found in object cache - it will be load from disk into object cache before return- Parameters:
cLink
- object address (cLink)segment
- segmentId- Returns:
- readed object
-
removeObject
byte[] removeObject(long cLink, int segment)
Removes object from cache.- Parameters:
cLink
- object address (cLink)segment
- segmentId- Returns:
- removed object
-
dropCaches
void dropCaches(int segment)
Drop cache entry with specified segment id- Parameters:
segment
- segment id to drop
-
dropCaches
void dropCaches()
Drop all cache
-
sync
void sync(int segmentId)
Write to disk (and sync) all cache entry (from write node cache) with specified segmentId. Writed segments will be moved to read cache.- Parameters:
segmentId
- segment to write
-
sync
void sync()
Sync all write node cache entry and sync
-
evict
void evict(int segmentId)
Evict (usually - write to disk, but no sync) all cache entry (from write node cache) with specified segmentId. Writed segments will be removed from cache. Remove all cache entry with specified segmentId from read/object caches.- Parameters:
segmentId
- segment to evict
-
evict
void evict()
Evict (usually - write to disk, but not sync) all cache entry (from write node cache). Remove all cache entry from read/object caches.
-
getEngine
Engine getEngine()
Get underlying db engine- Returns:
- engine
-
clone
long clone(long cLink)
Clone element by cLink (new element should not be cached by default). Not for value body objects.- Parameters:
cLink
- link to original element to clone- Returns:
- link to clone of original element
-
-