001/*
002 * The contents of this file are subject to the license and copyright
003 * detailed in the LICENSE and NOTICE files at the root of the source
004 * tree.
005 */
006package org.fcrepo.persistence.api;
007
008import org.fcrepo.kernel.api.Transaction;
009
010/**
011 * Interface to access PersistentStorageSessions.
012 *
013 * @author whikloj
014 * @author dbernstein
015 * @since 2019-09-19
016 */
017public interface PersistentStorageSessionManager {
018
019    /**
020     * Retrieve a PersistentStorageSession.
021     *
022     * @param transaction the externally generated transaction.
023     * @return the PersistentStorageSession instance.
024     */
025    PersistentStorageSession getSession(final Transaction transaction);
026
027    /**
028     * Retrieve a read-only PersistentStorageSession. Clients should expect
029     * invocation on storage modifying methods to throw exception.
030     *
031     * @return the PersistentStorageSession instance.
032     */
033    PersistentStorageSession getReadOnlySession();
034
035    /**
036     * Removes the indicated session. If the session does not exist, null is returned.
037     *
038     * @param sessionId the id of the session to remove
039     * @return the session, if it exists
040     */
041    PersistentStorageSession removeSession(final String sessionId);
042
043}