Class MemRepository

  • All Implemented Interfaces:
    LockManager, Repository, DBSRepository

    public class MemRepository
    extends DBSRepositoryBase
    In-memory implementation of a DBSRepository.

    Internally, the repository is a map from id to document object.

    A document object is a JSON-like document stored as a Map recursively containing the data, see DBSDocument for the description of the document.

    Since:
    5.9.4
    • Method Detail

      • initRepository

        protected void initRepository()
      • generateNewId

        protected String generateNewId()
      • getConnection

        public MemConnection getConnection()
        Description copied from interface: DBSRepository
        Gets a new connection to this repository.
        Returns:
        a new connection
      • getLock

        public Lock getLock​(String id)
        Description copied from interface: LockManager
        Gets the lock on a document.

        If the document does not exist, null is returned.

        Specified by:
        getLock in interface LockManager
        Overrides:
        getLock in class DBSRepositoryBase
        Parameters:
        id - the document id
        Returns:
        the existing lock, or null when there is no lock
      • removeLock

        public Lock removeLock​(String id,
                               String owner)
        Description copied from interface: LockManager
        Removes the lock from a document.

        The previous lock is returned.

        If owner is null then the lock is unconditionally removed.

        If owner is not null, it must match the existing lock owner for the lock to be removed. If it doesn't match, the returned lock will return true for Lock.getFailed().

        Specified by:
        removeLock in interface LockManager
        Overrides:
        removeLock in class DBSRepositoryBase
        Parameters:
        id - the document id
        owner - the owner to check, or null for no check
        Returns:
        the previous lock (may be null), with a failed flag if locking failed
      • markReferencedBlobs

        public void markReferencedBlobs​(BiConsumer<String,​String> markerCallback)
        Description copied from interface: Repository
        Marks the blobs in use by passing them to the provided callback (taking the blob key and the repository name).
      • updateCapabilities

        public void updateCapabilities()
        Description copied from interface: DBSRepository
        Update repository capabilities after a migration. Internal use only.