Interface SegmentWriter

  • All Known Implementing Classes:
    DefaultSegmentWriter

    public interface SegmentWriter
    Converts nodes, properties, values, etc. to records and persists them.
    • 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 passed stableId will be assigned to the persisted node. Otherwise the stable id will be inferred from state.
        Parameters:
        state - node state to write
        stableIdBytes - the stableId that should be assigned to the node or null.
        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)