-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add HashEncoder
and QueryEngineTests
#7435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This ports most of the current `GeneratorEngine` implementation from the Swift SDK Generator to the SwiftPM code base: https://github.com/apple/swift-sdk-generator/blob/main/Sources/GeneratorEngine/Engine.swift. Since Swift NIO is not supported on Windows, references to `AsyncHTTPClient` have been removed. Additionally, we can't use macros in the SwiftPM code base either, thus the `Query` protocol has to conform to `Encodable` instead. We don't have a consistent hashing implementation for `Encodable` yet, and a temporary stub for it is marked with `fatalError` for now.
…xd/query-engine-hashing
Previously, `QueryEngine` couldn't cache anything due to a missing hashing implementation that could be consistent across SwiftPM relaunches. Here `HashEncoder` is implemented on top `Codable`. While it probably has certain performance overhead when compared to an implementation with macros, it should be good enough for prototyping. New `QueryEngine` now works for trivial computations, as verified by newly added `QueryEngineTests`.
…xd/query-engine-scaffolding # Conflicts: # Package.swift
…t-package-manager into maxd/query-engine-hashing # Conflicts: # Package.swift
public let observabilityScope: ObservabilityScope | ||
package let fileSystem: any AsyncFileSystem | ||
package let httpClient = HTTPClient() | ||
package let observabilityScope: ObservabilityScope | ||
private let resultsCache: SQLiteBackedCache<FileCacheRecord> | ||
private var isShutDown = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to handle circular query dependencies here, probably with a dictionary from Query
to query result continuation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, don't recompute Query
hash for deep FS trees.
…xd/query-engine-hashing # Conflicts: # Package.swift # Sources/Basics/SQLiteBackedCache.swift # Sources/QueryEngine/FileSystem/AsyncFileSystem.swift # Sources/QueryEngine/FileSystem/OpenReadableFile.swift # Sources/QueryEngine/FileSystem/OpenWritableFile.swift # Sources/QueryEngine/FileSystem/VirtualFileSystem.swift # Sources/QueryEngine/Query.swift # Sources/QueryEngine/QueryEngine.swift
@swift-ci test |
@swift-ci test |
Depends on swiftlang#7347. Previously, `QueryEngine` couldn't cache anything due to a missing hashing implementation that could be consistent across SwiftPM relaunches. Here `HashEncoder` is implemented on top `Codable`. While it probably has certain performance overhead when compared to an implementation with macros, it should be good enough for prototyping. New `QueryEngine` now works for trivial computations, as verified by newly added `QueryEngineTests`.
Depends on swiftlang#7347. Previously, `QueryEngine` couldn't cache anything due to a missing hashing implementation that could be consistent across SwiftPM relaunches. Here `HashEncoder` is implemented on top `Codable`. While it probably has certain performance overhead when compared to an implementation with macros, it should be good enough for prototyping. New `QueryEngine` now works for trivial computations, as verified by newly added `QueryEngineTests`.
Previously,
QueryEngine
couldn't cache anything due to a missing persistable hashing implementation that could be consistent across SwiftPM relaunches. HereHashEncoder
is implemented on topCodable
. While it probably has certain performance overhead when compared to an implementation with macros, it should be good enough for prototyping.New
QueryEngine
now works for trivial computations, as verified by newly addedQueryEngineTests
.