Class LobStorageMap
java.lang.Object
org.h2.mvstore.db.LobStorageMap
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Databaseprivate final MVMap<Long, LobStorageMap.BlobMeta> The lob metadata map.(package private) final MVStoreprivate final AtomicLongprivate final MVMap<LobStorageMap.BlobReference, Value> The reference map.private final StreamStoreThe lob metadata map for temporary lobs.private static final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCopy a lob.private ValueBlobcreateBlob(InputStream in, long maxLength) Create a BLOB object.createClob(Reader reader, long maxLength) Create a CLOB object.private longgetInputStream(long lobId, int tableId, long byteCount) Get the input stream for the given lobgetInputStream(long lobId, long byteCount) Get the input stream for the given lob, only called on server side of a TCP connection.booleanWhether the storage is read-onlyprivate static booleanisTemporaryLob(int tableId) openLobDataMap(TransactionStore txStore) Open map used to store LOB datastatic MVMap<Long, LobStorageMap.BlobMeta> openLobMap(TransactionStore txStore) Open map used to store LOB metadatavoidremoveAllForTable(int tableId) Remove all LOBs for this table.private voidremoveLob(int tableId, long lobId) voidDelete a LOB (from the database, if it is stored there).private static void
-
Field Details
-
TRACE
private static final boolean TRACE- See Also:
-
database
-
mvStore
-
nextLobId
-
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
-
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. -
streamStore
-
-
Constructor Details
-
LobStorageMap
-
-
Method Details
-
openLobMap
Open map used to store LOB metadata- Parameters:
txStore- containing map- Returns:
- MVMap instance
-
openLobDataMap
Open map used to store LOB data- Parameters:
txStore- containing map- Returns:
- MVMap instance
-
createBlob
Description copied from interface:LobStorageInterfaceCreate a BLOB object.- Specified by:
createBlobin interfaceLobStorageInterface- Parameters:
in- the input streammaxLength- the maximum length (-1 if not known)- Returns:
- the LOB
-
createClob
Description copied from interface:LobStorageInterfaceCreate a CLOB object.- Specified by:
createClobin interfaceLobStorageInterface- Parameters:
reader- the readermaxLength- the maximum length (-1 if not known)- Returns:
- the LOB
-
createBlob
- Throws:
IOException
-
generateLobId
private long generateLobId() -
isReadOnly
public boolean isReadOnly()Description copied from interface:LobStorageInterfaceWhether the storage is read-only- Specified by:
isReadOnlyin interfaceLobStorageInterface- Returns:
- true if yes
-
copyLob
Description copied from interface:LobStorageInterfaceCopy a lob.- Specified by:
copyLobin interfaceLobStorageInterface- Parameters:
old- the old lobtableId- the new table id- Returns:
- the new lob
-
getInputStream
Description copied from interface:LobStorageInterfaceGet the input stream for the given lob, only called on server side of a TCP connection.- Specified by:
getInputStreamin interfaceLobStorageInterface- Parameters:
lobId- the lob idbyteCount- the number of bytes to read, or -1 if not known- Returns:
- the stream
- Throws:
IOException- on failure
-
getInputStream
Description copied from interface:LobStorageInterfaceGet the input stream for the given lob- Specified by:
getInputStreamin interfaceLobStorageInterface- Parameters:
lobId- the lob idtableId- the able idbyteCount- the number of bytes to read, or -1 if not known- Returns:
- the stream
- Throws:
IOException- on failure
-
removeAllForTable
public void removeAllForTable(int tableId) Description copied from interface:LobStorageInterfaceRemove all LOBs for this table.- Specified by:
removeAllForTablein interfaceLobStorageInterface- Parameters:
tableId- the table id
-
removeLob
Description copied from interface:LobStorageInterfaceDelete a LOB (from the database, if it is stored there).- Specified by:
removeLobin interfaceLobStorageInterface- Parameters:
lob- the lob
-
removeLob
private void removeLob(int tableId, long lobId) -
isTemporaryLob
private static boolean isTemporaryLob(int tableId) -
trace
-