generated from Apodini/Template-Repository
-
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.
* Adding grpc support * Add the QONECTIC gRPC client library * Track 0.9.0 line of Apodini Co-authored-by: Paul Schmiedmayer <[email protected]>
- Loading branch information
1 parent
c1ef40d
commit 31933c8
Showing
109 changed files
with
11,213 additions
and
1,793 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
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,196 @@ | ||
{ | ||
"object": { | ||
"pins": [ | ||
{ | ||
"package": "ApodiniDocumentExport", | ||
"repositoryURL": "https://github.com/Apodini/ApodiniDocumentExport.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "0a3fe4195f011057ad2cd5150c9091f2a17c2ec1", | ||
"version": "0.1.1" | ||
} | ||
}, | ||
{ | ||
"package": "ApodiniMigrator", | ||
"repositoryURL": "https://github.com/Apodini/ApodiniMigrator.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "10671191ddd8a19a61ac6cae06060d259dbfe9ce", | ||
"version": "0.3.0" | ||
} | ||
}, | ||
{ | ||
"package": "ApodiniTypeInformation", | ||
"repositoryURL": "https://github.com/Apodini/ApodiniTypeInformation.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "40247bedd5153b7641e95a11bd826b16a15fd12e", | ||
"version": "0.3.6" | ||
} | ||
}, | ||
{ | ||
"package": "AssociatedTypeRequirementsKit", | ||
"repositoryURL": "https://github.com/nerdsupremacist/AssociatedTypeRequirementsKit.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "2e4c49c21ffb2135f1c99fbfcf2119c9d24f5e8c", | ||
"version": "0.3.2" | ||
} | ||
}, | ||
{ | ||
"package": "FineJSON", | ||
"repositoryURL": "https://github.com/omochi/FineJSON.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "05101709243cb66d80c92e645210a3b80cf4e17f", | ||
"version": "1.14.0" | ||
} | ||
}, | ||
{ | ||
"package": "grpc-swift", | ||
"repositoryURL": "https://github.com/grpc/grpc-swift.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "0dd42b5b1bafc56548bdbf3a0ba06898944dc4ba", | ||
"version": "1.6.0-async-await.1" | ||
} | ||
}, | ||
{ | ||
"package": "MetadataSystem", | ||
"repositoryURL": "https://github.com/Apodini/MetadataSystem.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "f655813f1953af8d3aaac432dad35f394e7bdf75", | ||
"version": "0.1.6" | ||
} | ||
}, | ||
{ | ||
"package": "PathKit", | ||
"repositoryURL": "https://github.com/kylef/PathKit.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", | ||
"version": "1.0.1" | ||
} | ||
}, | ||
{ | ||
"package": "RichJSONParser", | ||
"repositoryURL": "https://github.com/omochi/RichJSONParser.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "263e2ecfe88d0500fa99e4cbc8c948529d335534", | ||
"version": "3.0.0" | ||
} | ||
}, | ||
{ | ||
"package": "Runtime", | ||
"repositoryURL": "https://github.com/wickwirew/Runtime.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "dad03135d7701a4e7b3a4051e75d6b37bd8e178e", | ||
"version": "2.2.4" | ||
} | ||
}, | ||
{ | ||
"package": "Spectre", | ||
"repositoryURL": "https://github.com/kylef/Spectre.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "26cc5e9ae0947092c7139ef7ba612e34646086c7", | ||
"version": "0.10.1" | ||
} | ||
}, | ||
{ | ||
"package": "swift-argument-parser", | ||
"repositoryURL": "https://github.com/apple/swift-argument-parser", | ||
"state": { | ||
"branch": null, | ||
"revision": "83b23d940471b313427da226196661856f6ba3e0", | ||
"version": "0.4.4" | ||
} | ||
}, | ||
{ | ||
"package": "swift-collections", | ||
"repositoryURL": "https://github.com/apple/swift-collections.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "48254824bb4248676bf7ce56014ff57b142b77eb", | ||
"version": "1.0.2" | ||
} | ||
}, | ||
{ | ||
"package": "swift-log", | ||
"repositoryURL": "https://github.com/apple/swift-log.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", | ||
"version": "1.4.2" | ||
} | ||
}, | ||
{ | ||
"package": "swift-nio", | ||
"repositoryURL": "https://github.com/apple/swift-nio.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "51c3fc2e4a0fcdf4a25089b288dd65b73df1b0ef", | ||
"version": "2.37.0" | ||
} | ||
}, | ||
{ | ||
"package": "swift-nio-extras", | ||
"repositoryURL": "https://github.com/apple/swift-nio-extras.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "f73ca5ee9c6806800243f1ac415fcf82de9a4c91", | ||
"version": "1.10.2" | ||
} | ||
}, | ||
{ | ||
"package": "swift-nio-http2", | ||
"repositoryURL": "https://github.com/apple/swift-nio-http2.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "6e94a7be32891d1b303a3fcfde8b5bf64d162e74", | ||
"version": "1.19.1" | ||
} | ||
}, | ||
{ | ||
"package": "swift-nio-ssl", | ||
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "52a486ff6de9bc3e26bf634c5413c41c5fa89ca5", | ||
"version": "2.17.2" | ||
} | ||
}, | ||
{ | ||
"package": "swift-nio-transport-services", | ||
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "8ab824b140d0ebcd87e9149266ddc353e3705a3e", | ||
"version": "1.11.4" | ||
} | ||
}, | ||
{ | ||
"package": "SwiftProtobuf", | ||
"repositoryURL": "https://github.com/apple/swift-protobuf.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "7e2c5f3cbbeea68e004915e3a8961e20bd11d824", | ||
"version": "1.18.0" | ||
} | ||
}, | ||
{ | ||
"package": "Yams", | ||
"repositoryURL": "https://github.com/jpsim/Yams.git", | ||
"state": { | ||
"branch": null, | ||
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa", | ||
"version": "4.0.6" | ||
} | ||
} | ||
] | ||
}, | ||
"version": 1 | ||
} |
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,7 @@ | ||
// | ||
// This source file is part of the Apodini open source project | ||
// | ||
// SPDX-FileCopyrightText: 2019-2022 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// |
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,42 @@ | ||
// swift-tools-version:5.5 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
// | ||
// This source file is part of the Apodini open source project | ||
// | ||
// SPDX-FileCopyrightText: 2019-2022 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "QONECTIQ", | ||
platforms: [ | ||
.macOS(.v12), .iOS(.v15) | ||
], | ||
products: [ | ||
.library(name: "QONECTIQ", targets: ["QONECTIQ"]) | ||
], | ||
dependencies: [ | ||
.package(url: "https://github.com/grpc/grpc-swift.git", .exact("1.6.0-async-await.1")), | ||
.package(url: "https://github.com/Apodini/ApodiniMigrator.git", .upToNextMinor(from: "0.3.0")) | ||
], | ||
targets: [ | ||
.target( | ||
name: "QONECTIQ", | ||
dependencies: [ | ||
.product(name: "GRPC", package: "grpc-swift"),.product(name: "ApodiniMigratorClientSupport", package: "ApodiniMigrator") | ||
], | ||
resources: [ | ||
.process("Resources") | ||
] | ||
), | ||
.executableTarget( | ||
name: "QONECTIQClient", | ||
dependencies: [ | ||
.target(name: "QONECTIQ") | ||
] | ||
) | ||
] | ||
) |
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,11 @@ | ||
<!-- | ||
This source file is part of the Apodini open source project | ||
SPDX-FileCopyrightText: 2021 Paul Schmiedmayer and the project authors (see CONTRIBUTORS.md) <[email protected]> | ||
SPDX-License-Identifier: MIT | ||
--> | ||
|
||
# QONECTIQ |
54 changes: 54 additions & 0 deletions
54
ApodiniMigratorExampleClientGRPC/Sources/QONECTIQ/Networking/GRPCNetworking.swift
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,54 @@ | ||
// | ||
// This source file is part of the Apodini open source project | ||
// | ||
// SPDX-FileCopyrightText: 2019-2022 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import NIO | ||
import NIOSSL | ||
import GRPC | ||
|
||
open class GRPCNetworking { | ||
public static let verification: CertificateVerification = .none | ||
|
||
public static let hostname = "127.0.0.1" | ||
public static let port = 8080 | ||
|
||
public let eventLoopGroup: EventLoopGroup | ||
|
||
private var _defaultChannel: GRPCChannel? | ||
public var defaultChannel: GRPCChannel { | ||
get throws { | ||
guard let channel = _defaultChannel else { | ||
let channel = try GRPCChannelPool.with( | ||
target: .host(Self.hostname, port: Self.port), | ||
transportSecurity: .tls(.makeClientConfigurationBackedByNIOSSL(certificateVerification: Self.verification)), | ||
eventLoopGroup: eventLoopGroup | ||
) | ||
self._defaultChannel = channel | ||
return channel | ||
} | ||
|
||
return channel | ||
} | ||
} | ||
|
||
public init(eventLoopGroup: EventLoopGroup) { | ||
self.eventLoopGroup = eventLoopGroup | ||
} | ||
|
||
public func close() -> EventLoopFuture<Void> { | ||
guard let channel = _defaultChannel else { | ||
return eventLoopGroup.next().makeSucceededVoidFuture() | ||
} | ||
|
||
self._defaultChannel = nil | ||
return channel.close() | ||
} | ||
|
||
deinit { | ||
try! close().wait() | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
ApodiniMigratorExampleClientGRPC/Sources/QONECTIQ/Networking/GRPCNetworkingError.swift
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,20 @@ | ||
// | ||
// This source file is part of the Apodini open source project | ||
// | ||
// SPDX-FileCopyrightText: 2019-2022 Paul Schmiedmayer and the Apodini project authors (see CONTRIBUTORS.md) <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
|
||
public enum GRPCNetworkingError: Error { | ||
case streamingTypeMigrationError(type: StreamingTypeMigrationErrorType) | ||
} | ||
|
||
/// Defines errors which might be thrown when a conversion from a | ||
/// service side stream to service side response fails. | ||
public enum StreamingTypeMigrationErrorType { | ||
/// Thrown if the first next() already fails to yield any response! | ||
case didNotReceiveAnyResponse | ||
} |
Oops, something went wrong.