A reader for a stream.

Note: A StreamReader cannot be created directly without using the StreamReaderGroup.

Hierarchy

  • StreamReader

Properties

get_segment_slice: (() => Promise<Slice>)

Type declaration

    • (): Promise<Slice>
    • This function returns a SegmentSlice from the SegmentStore(s). Individual events can be read from the Slice with the following snippets.

      const seg_slice: Slice = await stream_reader.get_segment_slice();
      for (const event of seg_slice) {
      const raw_value: ArrayBuffer = event.data();
      // do your things
      }

      Invoking this function multiple times ensure multiple SegmentSlices corresponding to different Segments of the stream are received. In-case we receive data for an already acquired SegmentSlice, this method waits until SegmentSlice is completely consumed before returning the data.

      Returns

      Slice in Promise.

      Returns Promise<Slice>

reader_offline: (() => void)

Type declaration

    • (): void
    • Mark the reader as offline.

      This will ensure the segments owned by this reader is distributed to other readers in the ReaderGroup.

      Returns void

release_segment: ((slice: Slice) => void)

Type declaration

    • (slice: Slice): void
    • Release a partially read segment slice back to event reader.

      Parameters

      Returns void

toString: (() => string)

Type declaration

    • (): string
    • Returns string

Generated using TypeDoc