Skip to content

Commit

Permalink
Updated to new API
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr. Brandon Wiley committed Nov 8, 2021
1 parent 93c3ffd commit ad4778a
Show file tree
Hide file tree
Showing 10 changed files with 510 additions and 370 deletions.
34 changes: 26 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,53 @@
"repositoryURL": "https://github.com/OperatorFoundation/Chord",
"state": {
"branch": null,
"revision": "25e5267c7dde0df1f7bcc285979f6302d46f7101",
"version": "0.0.12"
"revision": "94ef383494fb4c1b8b0e0e368df6f35265ff62d1",
"version": "0.0.14"
}
},
{
"package": "Datable",
"repositoryURL": "https://github.com/OperatorFoundation/Datable",
"state": {
"branch": null,
"revision": "31b055da961f794f1a2ce01b5521ee650815a9c9",
"version": "3.0.6"
"revision": "f935c18f2527f1b3cb6cad2511758b54effac5b1",
"version": "3.1.2"
}
},
{
"package": "Net",
"repositoryURL": "https://github.com/OperatorFoundation/Net",
"state": {
"branch": null,
"revision": "57de753edfa076c8b6c2ce5d08bbd48e3cdc1d52",
"version": "0.0.1"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
"version": "1.4.2"
}
},
{
"package": "SwiftQueue",
"repositoryURL": "https://github.com/OperatorFoundation/SwiftQueue",
"state": {
"branch": null,
"revision": "eaa39c586fddb49ad1e0e8b5b3e9b0aaf0b3be82",
"version": "0.1.0"
"revision": "5e6cd8b325493f520a45d20d788efca707b53e6c",
"version": "0.1.2"
}
},
{
"package": "Transport",
"repositoryURL": "https://github.com/OperatorFoundation/Transport",
"state": {
"branch": null,
"revision": "91dca4e691a9d2a6d38acd9b6dd64a1240da85f1",
"version": "2.3.6"
"revision": "a95c7bd870c558a040f9a22a88badab5577bd4df",
"version": "2.3.8"
}
}
]
Expand Down
18 changes: 12 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// swift-tools-version:5.3
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "TransmissionLinux",
platforms: [.macOS(.v11), .iOS(.v13)],
platforms: [.macOS(.v10_15)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
Expand All @@ -15,17 +15,23 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/OperatorFoundation/Chord", from: "0.0.12"),
.package(url: "https://github.com/OperatorFoundation/Datable", from: "3.0.6"),
.package(url: "https://github.com/OperatorFoundation/Chord", from: "0.0.15"),
.package(url: "https://github.com/OperatorFoundation/Datable", from: "3.1.2"),
.package(name: "Socket", url: "https://github.com/OperatorFoundation/BlueSocket", from: "1.1.0"),
.package(url: "https://github.com/OperatorFoundation/Transport", from: "2.3.6"),
.package(url: "https://github.com/OperatorFoundation/Net", from: "0.0.1"),
.package(url: "https://github.com/OperatorFoundation/Transport", from: "2.3.9"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.4.2")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "TransmissionLinux",
dependencies: ["Chord", "Socket", "Datable", "Transport"]),
dependencies: [
"Chord", "Socket", "Datable", "Transport", "Net",
.product(name: "Logging", package: "swift-log")
]
),
.testTarget(
name: "TransmissionLinuxTests",
dependencies: ["TransmissionLinux", "Datable"]),
Expand Down
172 changes: 0 additions & 172 deletions Sources/Transmission/Connection.swift

This file was deleted.

51 changes: 0 additions & 51 deletions Sources/Transmission/Listener.swift

This file was deleted.

22 changes: 19 additions & 3 deletions Sources/TransmissionLinux/Connection.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import Foundation
import Socket
import Net
import Datable
import Chord
import Transport
import Logging

public protocol Connection
{
// Reads exactly size bytes
func read(size: Int) -> Data?

// reads up to maxSize bytes
func read(maxSize: Int) -> Data?

func readWithLengthPrefix(prefixSizeInBits: Int) -> Data?

func write(string: String) -> Bool

func write(data: Data) -> Bool
func identifier() -> Int

func writeWithLengthPrefix(data: Data, prefixSizeInBits: Int) -> Bool
}

public enum ConnectionType
{
case udp
case tcp
}
Loading

0 comments on commit ad4778a

Please sign in to comment.