-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SPT-1998 fix pr and some improvements
- Loading branch information
1 parent
c3e306d
commit 3a6b30c
Showing
78 changed files
with
1,520 additions
and
1,181 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// AsyncStreamCombineNode.swift | ||
// NodeKit | ||
// | ||
// Created by Andrei Frolov on 03.04.24. | ||
// Copyright © 2024 Surf. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
/// Реализация ``PublisherContainerNode`` для ``AsyncStreamNode``. | ||
public struct AsyncStreamCombineNode<Input, Output>: CombineStreamNode { | ||
|
||
// MARK: - Private Properties | ||
|
||
private let subject = PassthroughSubject<NodeResult<Output>, Never>() | ||
private let node: any AsyncStreamNode<Input, Output> | ||
|
||
// MARK: - Initialization | ||
|
||
init(node: some AsyncStreamNode<Input, Output>) { | ||
self.node = node | ||
} | ||
|
||
// MARK: - CombineNode | ||
|
||
/// Publisher результата обработки данных. | ||
/// - Parameter queue: Очередь на которой будут выдаваться результаты. | ||
public func nodeResultPublisher(on scheduler: some Scheduler) -> AnyPublisher<NodeResult<Output>, Never> { | ||
return subject | ||
.receive(on: scheduler) | ||
.eraseToAnyPublisher() | ||
} | ||
|
||
/// Метод обработки данных протокола ``Node``. Будет удален в ближайшее время. | ||
public func processLegacy(_ data: Input) -> Observer<Output> { | ||
return node.processLegacy(data) | ||
} | ||
|
||
/// Метод запускающий процесс обработки данных. | ||
/// | ||
/// - Parameters: | ||
/// - data: Входные данные ноды. | ||
/// - logContext: Контекст логов. | ||
public func process(_ data: Input, logContext: LoggingContextProtocol) { | ||
Task { | ||
for await result in node.process(data, logContext: logContext) { | ||
subject.send(result) | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.