Skip to content

Commit

Permalink
fix doc
Browse files Browse the repository at this point in the history
Signed-off-by: thekingofcity <3353040+thekingofcity@users.noreply.github.com>
  • Loading branch information
thekingofcity committed Mar 15, 2022
1 parent 66ede75 commit c92c04c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion nodejs/src/stream_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl StreamReader {
// Spawn an `async` task on the tokio runtime.
let reader = Arc::clone(&stream_reader.reader);
stream_reader.runtime_handle.spawn(async move {
// expensive async procrdure executed in the tokio thread
// expensive async procedure executed in the tokio thread
let slice_result = reader.lock().await.acquire_segment().await;

// notify and execute in the javascript main thread
Expand Down
5 changes: 4 additions & 1 deletion nodejs/stream_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ export const StreamManager = (
/**
* Create a ReaderGroup for a given Stream.
*
* @param stream_cut The offset you would like to read from.
* @param reader_group_name The reader group name.
* @param scope_name The scope name.
* @returns All stream names in this scope.
* @param streams All stream names in this scope.
* @returns A StreamReaderGroup.
* @todo An optional element cannot follow a rest element. `...args: [...stream: string[], stream_cut?: StreamCut]`
*/
const create_reader_group = (
Expand Down
5 changes: 5 additions & 0 deletions nodejs/stream_reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ interface Event {
* @returns ArrayBuffer that contains raw data.
*/
data: () => ArrayBuffer;

/**
* Return the event offset in the segment.
*
* @returns offset
*/
offset: () => number;

toString: () => string;
}

Expand Down Expand Up @@ -105,15 +107,18 @@ export interface StreamReader {
* @returns Slice in Promise.
*/
get_segment_slice: () => Promise<Slice>;

/**
* Mark the reader as offline.
* This will ensure the segments owned by this reader is distributed to other readers in the ReaderGroup.
*/
reader_offline: () => void;

/**
* Release a partially read segment slice back to event reader.
*/
release_segment: (slice: Slice) => void;

toString: () => string;
}

Expand Down
2 changes: 2 additions & 0 deletions nodejs/stream_reader_group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface StreamReaderGroup {
* @returns The StreamReader
*/
create_reader: (reader_name: string) => StreamReader;

/**
* Invoked when a reader that was added to the group is no longer consuming events. This will
* cause the events that were going to that reader to be redistributed among the other
Expand All @@ -63,6 +64,7 @@ export interface StreamReaderGroup {
* @param reader_name The name of the reader that is offline.
*/
reader_offline: (reader_name: string) => void;

toString: () => string;
}

Expand Down

0 comments on commit c92c04c

Please sign in to comment.