-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: defines and implements pull streams as provider data returning …
…only
- Loading branch information
Showing
7 changed files
with
225 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,56 @@ | ||
@startuml Classes | ||
|
||
interface StreamProvider<O, I, Primer> { | ||
first(value: I): Primer | ||
data(value: I): StreamResult<O> | ||
error(error: Error): StreamResult<O> | ||
interface StreamProvider<T, Primer> { | ||
open(): Primer | ||
data(): StreamResult<T> | ||
close(): void | ||
} | ||
|
||
interface StreamConsumer<O, I> { | ||
first(): I | ||
data(value: O): StreamResult<I> | ||
error(error: Error): StreamResult<I> | ||
close(): void | ||
interface StreamConsumer<T, Primer> { | ||
open(primer: Primer): void | ||
data(value: T): boolean | void | ||
close(error?: Error): void | ||
} | ||
|
||
interface StreamResult<T> { | ||
done: boolean | ||
value: T | Promise<T> | ||
value: T | ||
} | ||
|
||
interface StreamBroker { | ||
done: boolean | ||
cancel(): void | ||
} | ||
|
||
interface ProcedureStream<O, I, Primer> { | ||
interface BroadStream<T, Primer> { | ||
primer(): Primer; | ||
engage(): StreamProvider<O, I, Primer> | ||
consume(executor: (): StreamConsumer<O, I, Primer>): Broker | ||
} | ||
|
||
PureStream <|-- ProcedureStream | ||
interface PureStream<O, Primer> { | ||
primer(): Primer | ||
engage(): StreamProvider<O, void, Primer> | ||
consume(executor: (): StreamConsumer<O, void, Primer>): Broker | ||
execute(): Provider<T, Primer> | ||
consume(executor: (): StreamConsumer<T, Primer>): StreamBroker | ||
} | ||
|
||
ForeStream <|-- PureStream | ||
interface ForeStream<O> { | ||
primer(): O | ||
engage(): StreamProvider<O, void, O> | ||
consume(executor: (): StreamConsumer<O, void, O>): Broker | ||
PureStream <|-- BroadStream | ||
interface PureStream<T> { | ||
primer(): void | ||
engage(): Provider<T, void> | ||
consume(executor: (): StreamConsumer<T, void>): StreamBroker | ||
} | ||
|
||
Stream <|.. ProcedureStream | ||
class Stream<O, I, Primer> { | ||
+constructor(executor: (): StreamProvider<O, I, Primer>): Stream<O, I, Primer> | ||
ForeStream <|-- BroadStream | ||
interface ForeStream<T> { | ||
primer(): T | ||
engage(): Provider<T, T> | ||
consume(executor: (): StreamConsumer<T, T>): StreamBroker | ||
} | ||
|
||
PushStream <|.. PureStream | ||
PushStream <|-- Stream | ||
class PushStream<O, Primer> { | ||
+subscribe(): Broker | ||
Stream <|-- BroadStream | ||
class Stream<T, Primer> { | ||
+constructor(executor: (): StreamProvider<T, Primer>): Stream<T, Primer> | ||
} | ||
|
||
SubjectStream <|-- PushStream | ||
class SubjectStream<O, Primer> { | ||
+data(value: O): void | ||
+error(error: Error): void | ||
+done(): void | ||
SubjectStream <|.. Stream | ||
class SubjectStream<T, Primer> { | ||
+data(value: T): void | ||
+close(error?: Error): void | ||
} | ||
|
||
@enduml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.