Interface SegmentWriter
-
- All Known Implementing Classes:
DefaultSegmentWriter
public interface SegmentWriter
Converts nodes, properties, values, etc. to records and persists them.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
flush()
@NotNull RecordId
writeBlob(@NotNull Blob blob)
Write a blob (as list of block records)default @NotNull RecordId
writeNode(@NotNull NodeState state)
Write a node state.@NotNull RecordId
writeNode(@NotNull NodeState state, @Nullable Buffer stableIdBytes)
Write a node state.@NotNull RecordId
writeStream(@NotNull java.io.InputStream stream)
Writes a stream value record.
-
-
-
Method Detail
-
flush
void flush() throws java.io.IOException
- Throws:
java.io.IOException
-
writeBlob
@NotNull @NotNull RecordId writeBlob(@NotNull @NotNull Blob blob) throws java.io.IOException
Write a blob (as list of block records)- Parameters:
blob
- blob to write- Returns:
- the record id of the blob written
- Throws:
java.io.IOException
-
writeStream
@NotNull @NotNull RecordId writeStream(@NotNull @NotNull java.io.InputStream stream) throws java.io.IOException
Writes a stream value record. The given stream is consumed and closed by this method.- Parameters:
stream
- stream to be written- Returns:
- the record id of the stream written
- Throws:
java.io.IOException
- if the input stream could not be read or the output could not be written
-
writeNode
@NotNull @NotNull RecordId writeNode(@NotNull @NotNull NodeState state, @Nullable @Nullable Buffer stableIdBytes) throws java.io.IOException
Write a node state. If non null, the passedstableId
will be assigned to the persisted node. Otherwise the stable id will be inferred fromstate
.- 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:
java.io.IOException
-
writeNode
@NotNull default @NotNull RecordId writeNode(@NotNull @NotNull NodeState state) throws java.io.IOException
Write a node state.Equivalent to
writeNode(state, null)
- Throws:
java.io.IOException
- See Also:
writeNode(NodeState, Buffer)
-
-