Documentation of 'org.mapdb.Store' Java class
Store
org.mapdb

Class Store

    • Field Detail

      • LOCKING_STRATEGY_READWRITELOCK

        public static final int LOCKING_STRATEGY_READWRITELOCK
        See Also:
        Constant Field Values
      • LOCKING_STRATEGY_WRITELOCK

        public static final int LOCKING_STRATEGY_WRITELOCK
        See Also:
        Constant Field Values
      • LOCKING_STRATEGY_NOLOCK

        public static final int LOCKING_STRATEGY_NOLOCK
        See Also:
        Constant Field Values
      • NOLOCK

        public static final java.util.concurrent.locks.Lock NOLOCK
        fake lock
    • Method Detail

      • init

        public void init()
      • get

        public <A> A get(long recid,
                         Serializer<A> serializer)
        Description copied from interface: Engine

        Get existing record.

        Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it returns null or throws 'EndOfFileException'

        Specified by:
        get in interface Engine
        Parameters:
        recid - (record identifier) under which record was persisted
        serializer - used to deserialize record from binary form
        Returns:
        record matching given recid, or null if record is not found under given recid.
      • update

        public <A> void update(long recid,
                               A value,
                               Serializer<A> serializer)
        Description copied from interface: Engine

        Update existing record with new value.

        Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.

        Specified by:
        update in interface Engine
        Parameters:
        recid - (record identifier) under which record was persisted.
        value - new record value to be stored
        serializer - used to serialize record into binary form
      • compareAndSwap

        public <A> boolean compareAndSwap(long recid,
                                          A expectedOldValue,
                                          A newValue,
                                          Serializer<A> serializer)
        Description copied from interface: Engine

        Updates existing record in atomic (Compare And Swap) manner. Value is modified only if old value matches expected value. There are three ways to match values, MapDB may use any of them:

        1. Equality check oldValue==expectedOldValue when old value is found in instance cache
        2. Deserializing oldValue using serializer and checking oldValue.equals(expectedOldValue)
        3. Serializing expectedOldValue using serializer and comparing binary array with already serialized oldValue

        Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.

        Specified by:
        compareAndSwap in interface Engine
        Parameters:
        recid - (record identifier) under which record was persisted.
        expectedOldValue - old value to be compared with existing record
        newValue - to be written if values are matching
        serializer - used to serialize record into binary form
        Returns:
        true if values matched and newValue was written
      • delete

        public <A> void delete(long recid,
                               Serializer<A> serializer)
        Description copied from interface: Engine

        Remove existing record from store/cache

        Recid must be a number returned by 'put' method. Behaviour for invalid recid (random number or already deleted record) is not defined, typically it throws 'EndOfFileException', but it may also corrupt store.

        Specified by:
        delete in interface Engine
        Parameters:
        recid - (record identifier) under which was record persisted
        serializer - which may be used in some circumstances to deserialize and store old object
      • isClosed

        public boolean isClosed()
        Description copied from interface: Engine
        Checks whether Engine was closed.
        Specified by:
        isClosed in interface Engine
        Returns:
        true if engine was closed
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: Engine
        Check if you can write into this Engine. It may be readonly in some cases (snapshot, read-only files).
        Specified by:
        isReadOnly in interface Engine
        Returns:
        true if engine is read-only
      • forDB

        public static Store forDB(DB db)
        traverses Engine wrappers and returns underlying Store
      • forEngine

        public static Store forEngine(Engine e)
        traverses Engine wrappers and returns underlying Store
      • getCurrSize

        public abstract long getCurrSize()
      • getFreeSize

        public abstract long getFreeSize()
      • fileLoad

        public abstract boolean fileLoad()

        If 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.

        Returns:
        true if this method did something, false if underlying storage does not support loading, or is already in-memory
      • clearCache

        public void clearCache()
        Description copied from interface: Engine
        clears any underlying cache
        Specified by:
        clearCache in interface Engine
      • metricsCollect

        public void metricsCollect(java.util.Map<java.lang.String,java.lang.Long> map)
        puts metrics into given map
      • backup

        public abstract void backup(java.io.OutputStream out,
                                    boolean incremental)
      • backupRestore

        public abstract void backupRestore(java.io.InputStream[] in)
      • getWrappedEngine

        public Engine getWrappedEngine()
        Description copied from interface: Engine
        if this is wrapper return underlying engine, or null
        Specified by:
        getWrappedEngine in interface Engine
      • canSnapshot

        public boolean canSnapshot()
        Specified by:
        canSnapshot in interface Engine
        Returns:
        true if engine can create read-only snapshots

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.