Skip to content

Commit 07812c4

Browse files
committed
mark some UnidocDB API as unused
1 parent 3c6dc00 commit 07812c4

File tree

4 files changed

+37
-36
lines changed

4 files changed

+37
-36
lines changed

Sources/HTTPClient/HTTP2Client.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ extension HTTP2Client
8484
{
8585
/// Connect to the remote host over HTTPS and perform the given operation.
8686
@inlinable public
87-
func connect<T>(with body:(Connection) async throws -> T) async throws -> T
87+
func connect<T>(port:Int = 443, with body:(Connection) async throws -> T) async throws -> T
8888
{
8989
let channel:any Channel = try await self.bootstrap.connect(
9090
host: self.remote,
91-
port: 443).get()
91+
port: port).get()
9292

9393
defer
9494
{

Sources/UnidocBuild/Main.swift

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum Main
2222
let http2:HTTP2Client = .init(
2323
threads: threads,
2424
niossl: niossl,
25-
remote: "swiftinit.org")
25+
remote: options.remote)
2626

2727
let swiftinit:SwiftinitClient = .init(http2: http2)
2828

@@ -42,11 +42,13 @@ extension Main
4242
struct Options
4343
{
4444
var package:PackageIdentifier
45+
var remote:String
4546

4647
private
4748
init(package:PackageIdentifier)
4849
{
4950
self.package = package
51+
self.remote = "swiftinit.org"
5052
}
5153
}
5254
}
@@ -64,7 +66,28 @@ extension Main.Options
6466
fatalError("Usage: \(CommandLine.arguments[0]) <package>")
6567
}
6668

67-
return .init(package: .init(package))
69+
var options:Self = .init(package: .init(package))
70+
71+
while let option:String = arguments.popFirst()
72+
{
73+
switch option
74+
{
75+
case "--remote", "-h":
76+
guard
77+
let remote:String = arguments.popFirst()
78+
else
79+
{
80+
fatalError("Expected remote hostname after '\(option)'")
81+
}
82+
83+
options.remote = remote
84+
85+
case let option:
86+
fatalError("Unknown option '\(option)'")
87+
}
88+
}
89+
90+
return options
6891
}
6992
}
7093

@@ -89,7 +112,7 @@ extension SwiftinitClient
89112
{
90113
try await self.http2.connect
91114
{
92-
try await body(Connection.init(http2: $0))
115+
try await body(Connection.init(http2: $0, to: self.http2.remote))
93116
}
94117
}
95118
}
@@ -113,11 +136,14 @@ extension SwiftinitClient
113136
{
114137
@usableFromInline internal
115138
let http2:HTTP2Client.Connection
139+
@usableFromInline internal
140+
let remote:String
116141

117142
@inlinable internal
118-
init(http2:HTTP2Client.Connection)
143+
init(http2:HTTP2Client.Connection, to remote:String)
119144
{
120145
self.http2 = http2
146+
self.remote = remote
121147
}
122148
}
123149
}
@@ -137,7 +163,7 @@ extension SwiftinitClient.Connection
137163
[
138164
":method": "GET",
139165
":scheme": "https",
140-
":authority": "swiftinit.org",
166+
":authority": self.remote,
141167
":path": endpoint,
142168

143169
"user-agent": "UnidocBuild",
@@ -159,7 +185,7 @@ extension SwiftinitClient.Connection
159185
case 301?:
160186
if let location:String = response.headers?["location"].first
161187
{
162-
endpoint = String.init(location.trimmingPrefix("https://swiftinit.org"))
188+
endpoint = String.init(location.trimmingPrefix("https://\(self.remote)"))
163189
continue following
164190
}
165191
case _:

Sources/UnidocDB/Packages/UnidocDatabase.Graphs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extension UnidocDatabase.Graphs
122122
}
123123
extension UnidocDatabase.Graphs
124124
{
125-
public
125+
@available(*, unavailable, message: "unused")
126126
func metadata(
127127
package:PackageIdentifier,
128128
limit:Int = 1,

Sources/UnidocDB/Packages/UnidocDatabase.swift

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -107,29 +107,6 @@ extension UnidocDatabase
107107
{
108108
(snapshot:Snapshot) in
109109

110-
// let origin:Volume.Origin? = try await
111-
// {
112-
// switch $0
113-
// {
114-
// case let origin??:
115-
// return origin
116-
117-
// case nil?:
118-
// // We already tried to find the origin for this package, and it
119-
// // didn't exist.
120-
// return nil
121-
122-
// case nil:
123-
// let package:PackageRecord? = try await self.packages.find(
124-
// by: PackageRecord[.cell],
125-
// of: snapshot.package,
126-
// with: session)
127-
// let origin:Volume.Origin? = package?.repo?.origin
128-
// $0 = .some(origin)
129-
// return origin
130-
// }
131-
// } (&origins[snapshot.package])
132-
133110
let volume:Volume = try await self.link(snapshot, with: session)
134111

135112
try await self.publish(volume, with: session)
@@ -202,9 +179,7 @@ extension UnidocDatabase
202179
case _:
203180
fatalError("unimplemented")
204181
}
205-
/// Standard library symbol graphs don’t come with hashes, so we can’t efficiently
206-
/// “prove” that a particular edition has at least one symbol graph. But we don’t
207-
/// need to query that in the first place.
182+
208183
let placement:Editions.Placement = try await self.editions.register(
209184
package: placement.coordinate,
210185
version: semver,
@@ -241,7 +216,7 @@ extension UnidocDatabase
241216
}
242217
extension UnidocDatabase
243218
{
244-
public
219+
@available(*, unavailable, message: "unused")
245220
func _editions(of package:PackageIdentifier,
246221
with session:Mongo.Session) async throws -> [PackageEdition]
247222
{

0 commit comments

Comments
 (0)