public class SegmentWriter extends Object
SegmentWriter converts nodes, properties, values, etc. to records and
persists them with the help of a WriteOperationHandler.
All public methods of this class are thread safe if and only if the
WriteOperationHandler passed to the constructor is thread safe.| Constructor and Description |
|---|
SegmentWriter(SegmentStore store,
SegmentReader reader,
org.apache.jackrabbit.oak.spi.blob.BlobStore blobStore,
WriterCacheManager cacheManager,
org.apache.jackrabbit.oak.segment.WriteOperationHandler writeOperationHandler)
Create a new instance of a
SegmentWriter. |
public SegmentWriter(@Nonnull SegmentStore store, @Nonnull SegmentReader reader, @Nullable org.apache.jackrabbit.oak.spi.blob.BlobStore blobStore, @Nonnull WriterCacheManager cacheManager, @Nonnull org.apache.jackrabbit.oak.segment.WriteOperationHandler writeOperationHandler)
SegmentWriter. Note the thread safety properties
pointed out in the class comment.store - store to write toreader - segment reader for the storeblobStore - the blog store or null for inlined blobscacheManager - cache manager instance for the de-duplication caches used by this writerwriteOperationHandler - handler for write operations.@CheckForNull public String getNodeCacheOccupancyInfo()
public void flush()
throws IOException
IOException@CheckForNull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getStringCacheStats()
null if not available.@CheckForNull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getTemplateCacheStats()
null if not available.@CheckForNull public org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean getNodeCacheStats()
null if not available.@Nonnull public MapRecord writeMap(@Nullable MapRecord base, @Nonnull Map<String,RecordId> changes) throws IOException
base - base map relative to which the changes are applied ot
null for the empty map.changes - the changed mapping to apply to the base map.IOException@Nonnull public RecordId writeList(@Nonnull List<RecordId> list) throws IOException
list - the list to write.IOException@Nonnull public RecordId writeString(@Nonnull String string) throws IOException
string - the string to write.IOException@Nonnull public SegmentBlob writeBlob(@Nonnull org.apache.jackrabbit.oak.api.Blob blob) throws IOException
blob - blob to writeIOException@Nonnull public RecordId writeBlock(@Nonnull byte[] bytes, int offset, int length) throws IOException
bytes - source bufferoffset - offset within the source bufferlength - number of bytes to writeIOException@Nonnull public SegmentBlob writeStream(@Nonnull InputStream stream) throws IOException
stream - stream to be writtenstreamIOException - if the input stream could not be read or the output could not be written@Nonnull public SegmentPropertyState writeProperty(@Nonnull org.apache.jackrabbit.oak.api.PropertyState state) throws IOException
state - the property to writeIOException@Nonnull public SegmentNodeState writeNode(@Nonnull org.apache.jackrabbit.oak.spi.state.NodeState state) throws IOException
Note: the returned SegmentNodeState instance is bound to this
SegmentWriter instance. That is, future calls to #builder()
return a NodeBuilder that is also bound to the same SegmentWriter
instance and uses it for writing any changes. This might not always be desired
and callers of this method need to take care not to proliferate this writer
through the returned node states beyond the intended bounds.
state - node state to writestateIOException@CheckForNull public SegmentNodeState writeNode(@Nonnull org.apache.jackrabbit.oak.spi.state.NodeState state, @Nonnull com.google.common.base.Supplier<Boolean> cancel) throws IOException
Note: the returned SegmentNodeState instance is bound to this
SegmentWriter instance. That is, future calls to #builder()
return a NodeBuilder that is also bound to the same SegmentWriter
instance and uses it for writing any changes. This might not always be desired
and callers of this method need to take care not to proliferate this writer
through the returned node states beyond the intended bounds.
state - node state to writecancel - supplier to signal cancellation of this write operationstate or null if cancelled.IOExceptionpublic void setCompactionMonitor(@Nonnull GCNodeWriteMonitor compactionMonitor)
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.