Interface SegmentWriter
- All Known Implementing Classes:
DefaultSegmentWriter
public interface SegmentWriter
Converts nodes, properties, values, etc. to records and persists them.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
flush()
@NotNull RecordId
Write a blob (as list of block records)default @NotNull RecordId
Write a node state.@NotNull RecordId
Write a node state.@NotNull RecordId
writeStream
(@NotNull InputStream stream) Writes a stream value record.
-
Method Details
-
flush
- Throws:
IOException
-
writeBlob
Write a blob (as list of block records)- Parameters:
blob
- blob to write- Returns:
- the record id of the blob written
- Throws:
IOException
-
writeStream
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:
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 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:
IOException
-
writeNode
Write a node state.Equivalent to
writeNode(state, null)
- Throws:
IOException
- See Also:
-