Skip to content

Commit

Permalink
Merge pull request #235 from tayloraswift/ci-events-api
Browse files Browse the repository at this point in the history
CI documentation state change events
  • Loading branch information
tayloraswift committed May 26, 2024
2 parents 7b15b7b + ee7dae7 commit 73a3679
Show file tree
Hide file tree
Showing 62 changed files with 1,289 additions and 1,026 deletions.
2 changes: 1 addition & 1 deletion Assets/css/Admin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/css/Admin.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Sources/HTTP/HTTP.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Enumerates supported HTTP versions. This type also serves as a namespace for other
/// HTTP-related types.
@frozen public
enum HTTP
enum HTTP:Comparable
{
case http1_1
case http2
Expand Down
4 changes: 2 additions & 2 deletions Sources/HTTPServer/HTTP.ServerIntegralRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ extension HTTP
init?(get uri:URI, headers:HPACKHeaders, origin:IP.Origin)
init?(get uri:URI, headers:HTTPHeaders, origin:IP.Origin)

init?(post path:URI, headers:HPACKHeaders, origin:IP.Origin, body:borrowing [UInt8])
init?(post path:URI, headers:HTTPHeaders, origin:IP.Origin, body:borrowing [UInt8])
init?(post uri:URI, headers:HPACKHeaders, origin:IP.Origin, body:borrowing [UInt8])
init?(post uri:URI, headers:HTTPHeaders, origin:IP.Origin, body:borrowing [UInt8])
}
}
extension HTTP.ServerIntegralRequest
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPServer/HTTP.ServerLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension HTTP.ServerLoop
from binding:(address:String, port:Int),
as authority:Authority,
on threads:MultiThreadedEventLoopGroup,
policy:(some HTTP.ServerPolicy)? = nil) async throws
policy:(any HTTP.ServerPolicy)? = nil) async throws
where Authority:HTTP.ServerAuthority
{
let bootstrap:ServerBootstrap = .init(group: threads)
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPServer/HTTP.ServerPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import IP
extension HTTP
{
public
protocol ServerPolicy:Sendable
protocol ServerPolicy:AnyObject, Sendable
{
/// Loads the latest available policy list.
func load() -> IP.Policylist?
Expand Down
2 changes: 1 addition & 1 deletion Sources/HTTPServer/IP.Owner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension IP
case known

/// The IP address could not be mapped to an owner because the tables have
/// not been initialized yet. This is a distinct state from the nil case, because
/// not been initialized yet. This is a distinct state from the ``known`` case, because
/// the IP might still belong to one of the enumerated services.
case unknown
}
Expand Down
34 changes: 34 additions & 0 deletions Sources/UnidocDB/Mongo.Session (ext).swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import BSON
import Durations
import MongoDB

extension Mongo.Session
Expand All @@ -20,6 +22,38 @@ extension Mongo.Session
}
}
extension Mongo.Session
{
@inlinable public
func observe<Source, Delta>(collection:Source,
every interval:Milliseconds = 30_000,
since start:inout BSON.Timestamp?,
yield:(Mongo.ChangeEvent<Delta>) async throws -> ()) async throws where
Source:Mongo.CollectionModel<Delta.Model>,
Delta:Mongo.MasterCodingDelta,
Delta:Sendable,
Delta.Model.CodingKey:Sendable,
Delta.Model:BSONDecodable
{
try await self.run(
command: Mongo.Aggregate<Mongo.Cursor<Mongo.ChangeEvent<Delta>>>.init(Source.name,
tailing: .init(timeout: interval, awaits: true))
{
$0[stage: .changeStream] { $0[.startAtOperationTime] = start }
},
against: collection.database)
{
for try await events:[Mongo.ChangeEvent<Delta>] in $0
{
for event:Mongo.ChangeEvent<Delta> in events
{
try await yield(event)
start = event.clusterTime
}
}
}
}
}
extension Mongo.Session
{
// This should be part of the swift-mongodb package. An incredibly interesting statement,
// considering this method is private.
Expand Down

This file was deleted.

105 changes: 0 additions & 105 deletions Sources/UnidocProfiling/Breakdowns/ServerProfile.ByClient.swift

This file was deleted.

53 changes: 0 additions & 53 deletions Sources/UnidocProfiling/Breakdowns/ServerProfile.ByLanguage.swift

This file was deleted.

This file was deleted.

Loading

0 comments on commit 73a3679

Please sign in to comment.