Package com._1c.g5.v8.xmdb.impl
Class TransactionalKVSImpl<K,V> 
java.lang.Object
com._1c.g5.v8.xmdb.impl.TransactionalKVSImpl<K,V> 
- All Implemented Interfaces:
- KeyValueStorage<K,,- V> - TransactionalKVS<K,- V> 
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionTransactionalKVSImpl(KeyValueStorage primaryKVS, Database database, String name) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()Remove all element from indexclone(int newSegment) Create clone of current index with new segmentIdcloneHeader(int newSegment) Clone only header of current index with new segmentIdvoidclose()Close index (sync and clear caches)voidcommit()Commit changes from last merge operationbooleancontains(long key) Test if index contain specified keybooleanTest if index contain specified keyvoidDrop all cache without store write cache to diskentrySet()Get entry set from indexvoidevict()Advice to XMDB (put all data from caches to files, but no sync fdatasync call).byte[]get(long key) Get value by long keybyte[]Get value by String keygetCache()Get internal index cache (same as database cache)intGet merge rebuild border.Get base indexintGet segment id of indexkeySet()Get keys set (clone all keys from index into new set)voidmerge(KeyValueStorage updates) Merge updates into base index If updates contain entry with empty (=null) value - key will be removed from base indexvoidmerge(KeyValueStorage<K, byte[]> s1, Map<K, byte[]> s2) Merge KVS and Map into current index (first can be this index)voidmerge(KeyValueStorage s1, KeyValueStorage s2) Merge two KVS into current index (first can be this index)voidMerge updates into base index If updates contain entry with empty (=null) value - key will be removed from base indexvoidmergeCommit(KeyValueStorage updates) Merge&commit updates - fastest, but less integrity safe method to bulk update indexvoidmergeCommit(Map<K, V> updates) merge&commit updates - fastest, but less integrity safe method to bulk update indexvoidput(long key, byte[] value) Put new key/value pair in index (by long key)voidPut new key/value pair in index (by String key)voidputRAW(long key, byte[] rawValue) Put raw (complex) value to index with complex value typebyte[]remove(long key) Remove long key from indexbyte[]Remove String key from indexvoidrollback()Rollback changes from last uncommited merge operationSerialize index headervoidsetMergeRebuildBorder(int mergeRebuildBorder) Set merge rebuild border (see getMergeRebuildBorder)intsize()Get index size in elementsvoidsync()Sync index state with internal store (to file).
- 
Field Details- 
MERGE_REBUILD_BORDER_DEFpublic static final int MERGE_REBUILD_BORDER_DEF- See Also:
 
 
- 
- 
Constructor Details- 
TransactionalKVSImpl
 
- 
- 
Method Details- 
sizepublic int size()Description copied from interface:KeyValueStorageGet index size in elements- Specified by:
- sizein interface- KeyValueStorage<K,- V> 
- Returns:
- size
 
- 
clearpublic void clear()Description copied from interface:KeyValueStorageRemove all element from index- Specified by:
- clearin interface- KeyValueStorage<K,- V> 
 
- 
syncpublic void sync()Description copied from interface:KeyValueStorageSync index state with internal store (to file). Force write cache to store to engine;- Specified by:
- syncin interface- KeyValueStorage<K,- V> 
 
- 
closepublic void close()Description copied from interface:KeyValueStorageClose index (sync and clear caches)- Specified by:
- closein interface- KeyValueStorage<K,- V> 
 
- 
getpublic byte[] get(long key) Description copied from interface:KeyValueStorageGet value by long key- Specified by:
- getin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key
- Returns:
- value or null (if key doesn;t exist in index)
 
- 
getDescription copied from interface:KeyValueStorageGet value by String key- Specified by:
- getin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key
- Returns:
- value or null (if key doesn;t exist in index)
 
- 
putpublic void put(long key, byte[] value) Description copied from interface:KeyValueStoragePut new key/value pair in index (by long key)- Specified by:
- putin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key to put
- value- value to put
 
- 
putDescription copied from interface:KeyValueStoragePut new key/value pair in index (by String key)- Specified by:
- putin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key to put
- value- value to put
 
- 
entrySetDescription copied from interface:KeyValueStorageGet entry set from index- Specified by:
- entrySetin interface- KeyValueStorage<K,- V> 
- Returns:
- entry<Key,Value> set
 
- 
setMergeRebuildBorderpublic void setMergeRebuildBorder(int mergeRebuildBorder) Description copied from interface:TransactionalKVSSet merge rebuild border (see getMergeRebuildBorder)- Specified by:
- setMergeRebuildBorderin interface- TransactionalKVS<K,- V> 
- Parameters:
- mergeRebuildBorder- merge rebuild border
 
- 
mergeCommitDescription copied from interface:TransactionalKVSMerge&commit updates - fastest, but less integrity safe method to bulk update index- Specified by:
- mergeCommitin interface- TransactionalKVS<K,- V> 
- Parameters:
- updates- updates
 
- 
mergeDescription copied from interface:TransactionalKVSMerge updates into base index If updates contain entry with empty (=null) value - key will be removed from base index- Specified by:
- mergein interface- TransactionalKVS<K,- V> 
- Parameters:
- updates- updates to merge
 
- 
rollbackDescription copied from interface:TransactionalKVSRollback changes from last uncommited merge operation- Specified by:
- rollbackin interface- TransactionalKVS<K,- V> 
- Throws:
- DBException
 
- 
commitDescription copied from interface:TransactionalKVSCommit changes from last merge operation- Specified by:
- commitin interface- TransactionalKVS<K,- V> 
- Throws:
- DBException
 
- 
getCacheDescription copied from interface:KeyValueStorageGet internal index cache (same as database cache)- Specified by:
- getCachein interface- KeyValueStorage<K,- V> 
- Returns:
- index cache
 
- 
mergeDescription copied from interface:KeyValueStorageMerge two KVS into current index (first can be this index)- Specified by:
- mergein interface- KeyValueStorage<K,- V> 
- Parameters:
- s1- first KVS, base
- s2- second KVS, updates
 
- 
removepublic byte[] remove(long key) Description copied from interface:KeyValueStorageRemove long key from index- Specified by:
- removein interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key to remove
- Returns:
- old value (or null if key doesn;t exist in index)
 
- 
removeDescription copied from interface:KeyValueStorageRemove String key from index- Specified by:
- removein interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key to remove
- Returns:
- old value (or null if key doesn;t exist in index)
 
- 
getPrimaryStorageDescription copied from interface:TransactionalKVSGet base index- Specified by:
- getPrimaryStoragein interface- TransactionalKVS<K,- V> 
- Returns:
- KeyValueStorage
 
- 
getMergeRebuildBorderpublic int getMergeRebuildBorder()Description copied from interface:TransactionalKVSGet merge rebuild border. Value (in percent) show how many updates need to full rebuild of base index. If updates have less size - it will be merge by simple put into base index (on mergeCommit method) or base index clone (on merge method)- Specified by:
- getMergeRebuildBorderin interface- TransactionalKVS<K,- V> 
- Returns:
- merge rebuld border
 
- 
dropCachespublic void dropCaches()Description copied from interface:KeyValueStorageDrop all cache without store write cache to disk- Specified by:
- dropCachesin interface- KeyValueStorage<K,- V> 
 
- 
serializeDescription copied from interface:KeyValueStorageSerialize index header- Specified by:
- serializein interface- KeyValueStorage<K,- V> 
- Returns:
- index header byte[] representation
 
- 
getSegmentpublic int getSegment()Description copied from interface:KeyValueStorageGet segment id of index- Specified by:
- getSegmentin interface- KeyValueStorage<K,- V> 
- Returns:
- segment id
 
- 
cloneDescription copied from interface:KeyValueStorageCreate clone of current index with new segmentId- Specified by:
- clonein interface- KeyValueStorage<K,- V> 
- Parameters:
- newSegment- new segment id
- Returns:
- new index
 
- 
cloneHeaderDescription copied from interface:KeyValueStorageClone only header of current index with new segmentId- Specified by:
- cloneHeaderin interface- KeyValueStorage<K,- V> 
- Parameters:
- newSegment- new segment id
- Returns:
- new index (same as old, but with new index header and segment)
 
- 
putRAWpublic void putRAW(long key, byte[] rawValue) Description copied from interface:KeyValueStoragePut raw (complex) value to index with complex value type- Specified by:
- putRAWin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- long hash key of raw value
- rawValue- raw (complex) value
 
- 
containspublic boolean contains(long key) Description copied from interface:KeyValueStorageTest if index contain specified key- Specified by:
- containsin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key to test
- Returns:
- "key exist in index" flag
 
- 
containsDescription copied from interface:KeyValueStorageTest if index contain specified key- Specified by:
- containsin interface- KeyValueStorage<K,- V> 
- Parameters:
- key- key to test
- Returns:
- "key exist in index" flag
 
- 
evictpublic void evict()Description copied from interface:KeyValueStorageAdvice to XMDB (put all data from caches to files, but no sync fdatasync call). Not mandatory, just safe RAM & speedup another threads- Specified by:
- evictin interface- KeyValueStorage<K,- V> 
 
- 
mergeDescription copied from interface:KeyValueStorageMerge KVS and Map into current index (first can be this index)- Specified by:
- mergein interface- KeyValueStorage<K,- V> 
- Parameters:
- s1- fist KVS, base
- s2- second Map, updates
 
- 
mergeDescription copied from interface:TransactionalKVSMerge updates into base index If updates contain entry with empty (=null) value - key will be removed from base index- Specified by:
- mergein interface- TransactionalKVS<K,- V> 
- Parameters:
- updates- updates to merge
 
- 
mergeCommitDescription copied from interface:TransactionalKVSmerge&commit updates - fastest, but less integrity safe method to bulk update index- Specified by:
- mergeCommitin interface- TransactionalKVS<K,- V> 
- Parameters:
- updates- updates
 
- 
keySetDescription copied from interface:KeyValueStorageGet keys set (clone all keys from index into new set)- Specified by:
- keySetin interface- KeyValueStorage<K,- V> 
- Returns:
- keys set
 
 
-