Class LobStorageMap

  • All Implemented Interfaces:
    LobStorageInterface

    public final class LobStorageMap
    extends java.lang.Object
    implements LobStorageInterface
    This class stores LOB objects in the database, in maps. This is the back-end i.e. the server side of the LOB storage.
    • Field Detail

      • database

        private final Database database
      • nextLobId

        private final java.util.concurrent.atomic.AtomicLong nextLobId
      • lobMap

        private final MVMap<java.lang.Long,​LobStorageMap.BlobMeta> lobMap
        The lob metadata map. It contains the mapping from the lob id (which is a long) to the blob metadata, including stream store id (which is a byte array).
      • tempLobMap

        private final MVMap<java.lang.Long,​byte[]> tempLobMap
        The lob metadata map for temporary lobs. It contains the mapping from the lob id (which is a long) to the stream store id (which is a byte array). Key: lobId (long) Value: streamStoreId (byte[])
      • refMap

        private final MVMap<LobStorageMap.BlobReference,​Value> refMap
        The reference map. It is used to remove data from the stream store: if no more entries for the given streamStoreId exist, the data is removed from the stream store.
    • Constructor Detail

      • LobStorageMap

        public LobStorageMap​(Database database)
    • Method Detail

      • openLobDataMap

        public static MVMap<java.lang.Long,​byte[]> openLobDataMap​(TransactionStore txStore)
        Open map used to store LOB data
        Parameters:
        txStore - containing map
        Returns:
        MVMap instance
      • createBlob

        public ValueBlob createBlob​(java.io.InputStream in,
                                    long maxLength)
        Description copied from interface: LobStorageInterface
        Create a BLOB object.
        Specified by:
        createBlob in interface LobStorageInterface
        Parameters:
        in - the input stream
        maxLength - the maximum length (-1 if not known)
        Returns:
        the LOB
      • createClob

        public ValueClob createClob​(java.io.Reader reader,
                                    long maxLength)
        Description copied from interface: LobStorageInterface
        Create a CLOB object.
        Specified by:
        createClob in interface LobStorageInterface
        Parameters:
        reader - the reader
        maxLength - the maximum length (-1 if not known)
        Returns:
        the LOB
      • createBlob

        private ValueBlob createBlob​(java.io.InputStream in)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • generateLobId

        private long generateLobId()
      • getInputStream

        public java.io.InputStream getInputStream​(long lobId,
                                                  long byteCount)
                                           throws java.io.IOException
        Description copied from interface: LobStorageInterface
        Get the input stream for the given lob, only called on server side of a TCP connection.
        Specified by:
        getInputStream in interface LobStorageInterface
        Parameters:
        lobId - the lob id
        byteCount - the number of bytes to read, or -1 if not known
        Returns:
        the stream
        Throws:
        java.io.IOException - on failure
      • getInputStream

        public java.io.InputStream getInputStream​(long lobId,
                                                  int tableId,
                                                  long byteCount)
                                           throws java.io.IOException
        Description copied from interface: LobStorageInterface
        Get the input stream for the given lob
        Specified by:
        getInputStream in interface LobStorageInterface
        Parameters:
        lobId - the lob id
        tableId - the able id
        byteCount - the number of bytes to read, or -1 if not known
        Returns:
        the stream
        Throws:
        java.io.IOException - on failure
      • removeLob

        private void removeLob​(int tableId,
                               long lobId)
      • isTemporaryLob

        private static boolean isTemporaryLob​(int tableId)
      • trace

        private static void trace​(java.lang.String op)