Class DefaultSegmentWriter
- java.lang.Object
-
- org.apache.jackrabbit.oak.segment.DefaultSegmentWriter
-
- All Implemented Interfaces:
SegmentWriter
public class DefaultSegmentWriter extends Object implements SegmentWriter
Converts nodes, properties, values, etc. to records and persists them with the help of aWriteOperationHandler. All public methods of this class are thread safe if and only if theWriteOperationHandlerpassed to the constructor is thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringMAX_MAP_RECORD_SIZE_KEY
-
Constructor Summary
Constructors Constructor Description DefaultSegmentWriter(@NotNull SegmentStore store, @NotNull SegmentReader reader, @NotNull SegmentIdProvider idProvider, @Nullable BlobStore blobStore, @NotNull WriterCacheManager cacheManager, @NotNull org.apache.jackrabbit.oak.segment.WriteOperationHandler writeOperationHandler, int binariesInlineThreshold)Create a new instance of aSegmentWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()@NotNull RecordIdwriteBlob(@NotNull Blob blob)Write a blob (as list of block records)@NotNull RecordIdwriteNode(@NotNull NodeState state, @Nullable Buffer stableIdBytes)Write a node state.@NotNull RecordIdwriteStream(@NotNull InputStream stream)Writes a stream value record.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.oak.segment.SegmentWriter
writeNode
-
-
-
-
Field Detail
-
MAX_MAP_RECORD_SIZE_KEY
protected static final String MAX_MAP_RECORD_SIZE_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultSegmentWriter
public DefaultSegmentWriter(@NotNull @NotNull SegmentStore store, @NotNull @NotNull SegmentReader reader, @NotNull @NotNull SegmentIdProvider idProvider, @Nullable @Nullable BlobStore blobStore, @NotNull @NotNull WriterCacheManager cacheManager, @NotNull @NotNull org.apache.jackrabbit.oak.segment.WriteOperationHandler writeOperationHandler, int binariesInlineThreshold)Create a new instance of aSegmentWriter. Note the thread safety properties pointed out in the class comment.- Parameters:
store- store to write toreader- segment reader for thestoreidProvider- segment id provider for thestoreblobStore- the blob store ornullfor inlined blobscacheManager- cache manager instance for the de-duplication caches used by this writerwriteOperationHandler- handler for write operations.binariesInlineThreshold- threshold in bytes, specifying the limit up to which blobs will be inlined
-
-
Method Detail
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceSegmentWriter- Throws:
IOException
-
writeBlob
@NotNull public @NotNull RecordId writeBlob(@NotNull @NotNull Blob blob) throws IOException
Description copied from interface:SegmentWriterWrite a blob (as list of block records)- Specified by:
writeBlobin interfaceSegmentWriter- Parameters:
blob- blob to write- Returns:
- the record id of the blob written
- Throws:
IOException
-
writeStream
@NotNull public @NotNull RecordId writeStream(@NotNull @NotNull InputStream stream) throws IOException
Description copied from interface:SegmentWriterWrites a stream value record. The given stream is consumed and closed by this method.- Specified by:
writeStreamin interfaceSegmentWriter- Parameters:
stream- stream to be written- Returns:
- the record id of the stream written
- Throws:
IOException- if the input stream could not be read or the output could not be written
-
writeNode
@NotNull public @NotNull RecordId writeNode(@NotNull @NotNull NodeState state, @Nullable @Nullable Buffer stableIdBytes) throws IOException
Description copied from interface:SegmentWriterWrite a node state. If non null, the passedstableIdwill be assigned to the persisted node. Otherwise the stable id will be inferred fromstate.- Specified by:
writeNodein interfaceSegmentWriter- Parameters:
state- node state to writestableIdBytes- the stableId that should be assigned to the node ornull.- Returns:
- the record id of the segment node state written
- Throws:
IOException
-
-