Class StoreDirect
- java.lang.Object
-
- org.mapdb.Store
-
- org.mapdb.StoreDirect
-
- All Implemented Interfaces:
- java.io.Closeable, java.lang.AutoCloseable, Engine
- Direct Known Subclasses:
- StoreCached
public class StoreDirect extends Store
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classStoreDirect.Snapshot-
Nested classes/interfaces inherited from class org.mapdb.Store
Store.Cache, Store.LongLongMap, Store.LongObjectMap<V>, Store.LongObjectObjectMap<V1,V2>, Store.LongQueue, Store.MemoryBarrierLessLock, Store.ReadWriteSingleLock
-
Nested classes/interfaces inherited from interface org.mapdb.Engine
Engine.CloseOnJVMShutdown, Engine.ReadOnly, Engine.ReadOnlyWrapper
-
-
Field Summary
-
Fields inherited from class org.mapdb.Store
LOCKING_STRATEGY_NOLOCK, LOCKING_STRATEGY_READWRITELOCK, LOCKING_STRATEGY_WRITELOCK, NOLOCK
-
Fields inherited from interface org.mapdb.Engine
CLOSED_ENGINE, RECID_CLASS_CATALOG, RECID_FIRST, RECID_LAST_RESERVED, RECID_NAME_CATALOG, RECID_RECORD_CHECK
-
-
Constructor Summary
Constructors Constructor and Description StoreDirect(java.lang.String fileName)StoreDirect(java.lang.String fileName, Volume.VolumeFactory volumeFactory, Store.Cache cache, int lockScale, int lockingStrategy, boolean checksum, boolean compress, byte[] password, boolean readonly, boolean snapshotEnable, boolean fileLockDisable, DataIO.HeartbeatFileLock fileLockHeartbeat, java.util.concurrent.ScheduledExecutorService executor, long startSize, long sizeIncrement, boolean recidReuseDisable)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidbackup(java.io.OutputStream out, boolean incremental)voidbackupRestore(java.io.InputStream[] ins)booleancanRollback()voidclearCache()clears any underlying cachevoidclose()Close store/cache.voidcommit()Makes all changes made since the previous commit/rollback permanent.voidcompact()booleanfileLoad()If underlying storage is memory-mapped-file, this method will try to load and precache all file data into disk cache.longgetCurrSize()longgetFreeSize()voidinit()longpreallocate()Preallocates recid for not yet created record.<A> longput(A value, Serializer<A> serializer)Insert new record.voidrollback()Undoes all changes made in the current transaction.Enginesnapshot()Returns read-only snapshot of data in Engine.-
Methods inherited from class org.mapdb.Store
canSnapshot, compareAndSwap, delete, forDB, forEngine, get, getWrappedEngine, isClosed, isReadOnly, metricsCollect, update
-
-
-
-
Constructor Detail
-
StoreDirect
public StoreDirect(java.lang.String fileName, Volume.VolumeFactory volumeFactory, Store.Cache cache, int lockScale, int lockingStrategy, boolean checksum, boolean compress, byte[] password, boolean readonly, boolean snapshotEnable, boolean fileLockDisable, DataIO.HeartbeatFileLock fileLockHeartbeat, java.util.concurrent.ScheduledExecutorService executor, long startSize, long sizeIncrement, boolean recidReuseDisable)
-
StoreDirect
public StoreDirect(java.lang.String fileName)
-
-
Method Detail
-
getCurrSize
public long getCurrSize()
- Specified by:
getCurrSizein classStore
-
getFreeSize
public long getFreeSize()
- Specified by:
getFreeSizein classStore
-
fileLoad
public boolean fileLoad()
Description copied from class:StoreIf underlying storage is memory-mapped-file, this method will try to load and precache all file data into disk cache. Most likely it will call
MappedByteBuffer.load(), but could also read content of entire file etc This method will not pin data into memory, they might be removed at any time.
-
preallocate
public long preallocate()
Description copied from interface:EnginePreallocates recid for not yet created record. It does not insert any data into it.- Returns:
- new recid
-
put
public <A> long put(A value, Serializer<A> serializer)Description copied from interface:EngineInsert new record.- Parameters:
value- records to be addedserializer- used to convert record into/from binary form- Returns:
- recid (record identifier) under which record is stored.
-
close
public void close()
Description copied from interface:EngineClose store/cache. This method must be called before JVM exits to flush all caches and prevent store corruption. Also it releases resources used by MapDB (disk, memory..).
Engine can no longer be used after this method was called. If Engine is used after closing, it may throw any exception including
NullPointerExceptionThere is an configuration option
DBMaker.Maker.closeOnJvmShutdown()which uses shutdown hook to automatically close Engine when JVM shutdowns.
-
commit
public void commit()
Description copied from interface:EngineMakes all changes made since the previous commit/rollback permanent. In transactional mode (on by default) it means creating journal file and replaying it to storage. In other modes it may flush disk caches or do nothing at all (check your config options)
-
rollback
public void rollback() throws java.lang.UnsupportedOperationExceptionDescription copied from interface:EngineUndoes all changes made in the current transaction. If transactions are disabled it throwsUnsupportedOperationException.- Throws:
java.lang.UnsupportedOperationException- if transactions are disabled
-
canRollback
public boolean canRollback()
- Returns:
- true if engine supports rollback
-
snapshot
public Engine snapshot() throws java.lang.UnsupportedOperationException
Description copied from interface:EngineReturns read-only snapshot of data in Engine.- Throws:
java.lang.UnsupportedOperationException- if snapshots are not supported/enabled
-
clearCache
public void clearCache()
Description copied from interface:Engineclears any underlying cache- Specified by:
clearCachein interfaceEngine- Overrides:
clearCachein classStore
-
backup
public void backup(java.io.OutputStream out, boolean incremental)
-
backupRestore
public void backupRestore(java.io.InputStream[] ins)
- Specified by:
backupRestorein classStore
-
compact
public void compact()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG