diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 71f0ff1..546db39 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,13 +7,28 @@ on: branches: [ "main" ] jobs: - build: + test: + container: + image: swift:5.9-jammy runs-on: ubuntu-latest + services: + loki: + image: grafana/loki:3.0.0 + steps: - uses: actions/checkout@v3 - name: Build - run: swift build -v + run: swift build - name: Run tests - run: swift test -v + run: swift test --enable-code-coverage + env: + XCT_LOKI_URL: http://loki:3100 + - name: Prepare Code Coverage + run: llvm-cov export -format="lcov" .build/debug/swift-log-lokiPackageTests.xctest -instr-profile .build/debug/codecov/default.profdata -ignore-filename-regex="\.pb\.swift" > info.lcov + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: info.lcov diff --git a/.spi.yml b/.spi.yml new file mode 100644 index 0000000..64adc79 --- /dev/null +++ b/.spi.yml @@ -0,0 +1,5 @@ +version: 1 +builder: + configs: + - documentation_targets: [LoggingLoki] + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f6ea290 --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +# Adapted from https://www.thapaliya.com/en/writings/well-documented-makefiles/ +.PHONY: help +help: ## Display this help and any documented user-facing targets. Other undocumented targets may be present in the Makefile. +help: + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " %-45s %s\n", $$1, $$2 }' $(MAKEFILE_LIST) + +.DEFAULT_GOAL := all +.PHONY: all clean-protos protos +.PHONY: clean-protos + +SHELL = /usr/bin/env bash -o pipefail + +############# +# Variables # +############# + +# We don't want find to scan inside a bunch of directories, to accelerate the +# 'make: Entering directory '/src/loki' phase. +DONT_FIND := -name .swiftpm -prune -o -name .build -prune -o + +# Protobuf files +PROTO_DEFS := $(shell find . $(DONT_FIND) -type f -name '*.proto' -print) +PROTO_SWIFTS := $(patsubst %.proto,%.pb.swift,$(PROTO_DEFS)) + +################ +# Main Targets # +################ +all: protos ## run all (clean-protos, protos) + +# This is really a check for the CI to make sure generated files are built and checked in manually +check-generated-files: protos + @if ! (git diff --exit-code $(PROTO_DEFS) $(PROTO_SWIFTS)); then \ + echo "\nChanges found in generated files"; \ + echo "Run 'make check-generated-files' and commit the changes to fix this error."; \ + echo "If you are actively developing these files you can ignore this error"; \ + echo "(Don't forget to check in the generated files when finished)\n"; \ + exit 1; \ + fi + +######### +# Clean # +######### + +clean-protos: ## remove swift protos + rm -rf $(PROTO_SWIFTS) + +############# +# Protobufs # +############# + +protos: clean-protos $(PROTO_SWIFTS) ## regenerate swift protos + +%.pb.swift: + protoc --swift_out=. $(patsubst %.pb.swift,%.proto,$@) diff --git a/Package.resolved b/Package.resolved index 6b48708..3d77e17 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,21 +1,138 @@ { "pins" : [ + { + "identity" : "async-http-client", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/async-http-client.git", + "state" : { + "revision" : "fb308ee72f3d4c082a507033f94afa7395963ef3", + "version" : "1.21.0" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms", + "state" : { + "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", + "version" : "1.2.0" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "da4e36f86544cdf733a40d59b3a2267e3a7bbf36", + "version" : "1.0.0" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "cd142fd2f64be2100422d658e7411e39489da985", + "version" : "1.2.0" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections.git", + "state" : { + "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", + "version" : "1.1.0" + } + }, { "identity" : "swift-docc-plugin", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-docc-plugin.git", "state" : { - "revision" : "3303b164430d9a7055ba484c8ead67a52f7b74f6", + "revision" : "26ac5758409154cc448d7ab82389c520fa8a8247", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-docc-symbolkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-symbolkit", + "state" : { + "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", "version" : "1.0.0" } }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types", + "state" : { + "revision" : "12358d55a3824bd5fed310b999ea8cf83a9a1a65", + "version" : "1.0.3" + } + }, { "identity" : "swift-log", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "6fe203dc33195667ce1759bf0182975e4653ba1c", - "version" : "1.4.4" + "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5", + "version" : "1.5.4" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio.git", + "state" : { + "revision" : "fc63f0cf4e55a4597407a9fc95b16a2bc44b4982", + "version" : "2.64.0" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63", + "version" : "1.22.0" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "0904bf0feb5122b7e5c3f15db7df0eabe623dd87", + "version" : "1.30.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5", + "version" : "2.26.0" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "6cbe0ed2b394f21ab0d46b9f0c50c6be964968ce", + "version" : "1.20.1" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0a5bc04095a675662cf24757cc0640aa2204253b", + "version" : "1.0.2" } }, { @@ -27,6 +144,15 @@ "version" : "1.20.3" } }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "d7fe0e731499a8dcce53bf4cbbc812c8e565d3a7", + "version" : "2.4.1" + } + }, { "identity" : "swift-snappy", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index aee6bbc..a24ffce 100644 --- a/Package.swift +++ b/Package.swift @@ -1,9 +1,9 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 import PackageDescription let package = Package( name: "swift-log-loki", - platforms: [.macOS(.v11), .iOS(.v14), .tvOS(.v14), .watchOS(.v7)], + platforms: [.macOS(.v14), .iOS(.v17), .tvOS(.v17), .watchOS(.v9), .visionOS(.v1)], products: [ .library(name: "LoggingLoki", targets: ["LoggingLoki"]), ], @@ -11,7 +11,9 @@ let package = Package( .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"), - .package(url: "https://github.com/lovetodream/swift-snappy", from: "1.0.0"), + .package(url: "https://github.com/lovetodream/swift-snappy.git", from: "1.0.0"), + .package(url: "https://github.com/swift-server/async-http-client.git", from: "1.0.0"), + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), ], targets: [ .target( @@ -20,6 +22,8 @@ let package = Package( .product(name: "Logging", package: "swift-log"), .product(name: "SwiftProtobuf", package: "swift-protobuf"), .product(name: "Snappy", package: "swift-snappy"), + .product(name: "AsyncHTTPClient", package: "async-http-client"), + .product(name: "ServiceLifecycle", package: "swift-service-lifecycle"), ] ), .testTarget(name: "LoggingLokiTests", dependencies: ["LoggingLoki"]), diff --git a/README.md b/README.md index 5e6002e..bc9398d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # SwiftLogLoki +[![Coverage](https://codecov.io/gh/lovetodream/swift-log-loki/graph/badge.svg?token=Q70PZWS0T2)](https://codecov.io/gh/lovetodream/swift-log-loki) [![Tests](https://github.com/lovetodream/swift-log-loki/actions/workflows/tests.yml/badge.svg)](https://github.com/lovetodream/swift-log-loki/actions/workflows/tests.yml) [![Docs](https://github.com/lovetodream/swift-log-loki/actions/workflows/deploy_docs.yml/badge.svg)](https://github.com/lovetodream/swift-log-loki/actions/workflows/deploy_docs.yml) @@ -7,7 +8,7 @@ This library can be used as an implementation of Apple's [swift-log](https://git ## Features -- Supports Darwin (macOS), Linux platforms, iOS, watchOS and tvOS +- Supports Linux and all Apple platforms - Different logging levels such as `trace`, `debug`, `info`, `notice`, `warning`, `error` and `critical` - Option to send logs as snappy-compressed Protobuf (default) or JSON - Batching logs via `TimeInterval`, amount of log entries or a mix of those options @@ -19,7 +20,7 @@ This library can be used as an implementation of Apple's [swift-log](https://git Add `LoggingLoki` to the dependencies within your application's `Package.swift` file. ```swift -.package(url: "https://github.com/lovetodream/swift-log-loki.git", from: "1.0.0"), +.package(url: "https://github.com/lovetodream/swift-log-loki.git", from: "2.0.0"), ``` Add `LoggingLoki` to your target's dependencies. @@ -38,26 +39,24 @@ Go to `File` > `Add Packages`, enter the Package URL `https://github.com/lovetod You can use LoggingLoki as your default Log Handler for [swift-log](https://github.com/apple/swift-log). ```swift -import LoggingLoki import Logging +import LoggingLoki -// yourLokiURL: e.g. http://localhost:3100 as URL -LoggingSystem.bootstrap { LokiLogHandler(label: $0, lokiURL: yourLokiURL) } -``` - -### Example Usage with [Swift Vapor](https://vapor.codes) - -LoggingLoki works great with [Swift Vapor](https://vapor.codes), to send all your logs to [Grafana Loki](https://grafana.com/oss/loki) add the following to the top of your `configure(_:)` method inside of `configure.swift`. - -```swift -app.logger = Logger(label: app.logger.label, factory: { label in - // yourLokiURL: e.g. http://localhost:3100 as URL - LokiLogHandler(label: label, lokiURL: yourLokiURL) -}) +let processor = LokiLogProcessor( + configuration: LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100") +) +LoggingSystem.bootstrap { label in + LokiLogHandler(label: label, processor: processor) +} + +try await withThrowingDiscardingTaskGroup { group in + group.addTask { + // The processor has to run in the background to send logs to Loki. + try await processor.run() + } +} ``` -For more information about Logging in [Swift Vapor](https://vapor.codes) take a look at the [Official Documentation](https://docs.vapor.codes/basics/logging/). - ## API documentation For more information visit the [API reference](https://timozacherl.com/swift-log-loki/documentation/loggingloki/). diff --git a/Snippets/BasicUsage.swift b/Snippets/BasicUsage.swift new file mode 100644 index 0000000..b8268d3 --- /dev/null +++ b/Snippets/BasicUsage.swift @@ -0,0 +1,19 @@ + +// snippet.setup +import Logging +import LoggingLoki + +let processor = LokiLogProcessor( + configuration: LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100") +) +LoggingSystem.bootstrap { label in + LokiLogHandler(label: label, processor: processor) +} + +try await withThrowingDiscardingTaskGroup { group in + group.addTask { + // The processor has to run in the background to send logs to Loki. + try await processor.run() + } +} +// snippet.end diff --git a/Sources/LoggingLoki/Batch.swift b/Sources/LoggingLoki/Batch.swift index a52ec8c..76a80f8 100644 --- a/Sources/LoggingLoki/Batch.swift +++ b/Sources/LoggingLoki/Batch.swift @@ -1,19 +1,24 @@ import Foundation -struct Batch: Sendable { +struct Batch { var entries: [BatchEntry] - let createdAt = Date() + let createdAt: Clock.Instant - var totalLogEntries: Int { - entries.flatMap { $0.logEntries }.count + var totalLogEntries: Int + + init(entries: [BatchEntry], createdAt: Clock.Instant) { + self.entries = entries + self.createdAt = createdAt + self.totalLogEntries = entries.flatMap(\.logEntries).count } - mutating func addEntry(_ log: LokiLog, with labels: LokiLabels) { - guard let index = entries.firstIndex(where: { $0.labels == labels }) else { + mutating func addEntry(_ log: LokiLog.Transport, with labels: [String: String]) { + if let index = entries.firstIndex(where: { $0.labels == labels }) { + entries[index].logEntries.append(log) + } else { entries.append(BatchEntry(labels: labels, logEntries: [log])) - return } - entries[index].logEntries.append(log) + totalLogEntries += 1 } } diff --git a/Sources/LoggingLoki/BatchEntry.swift b/Sources/LoggingLoki/BatchEntry.swift index ddc844f..44c4c6e 100644 --- a/Sources/LoggingLoki/BatchEntry.swift +++ b/Sources/LoggingLoki/BatchEntry.swift @@ -1,4 +1,4 @@ struct BatchEntry: Sendable { - var labels: LokiLabels - var logEntries: [LokiLog] + var labels: [String: String] + var logEntries: [LokiLog.Transport] } diff --git a/Sources/LoggingLoki/Batcher.swift b/Sources/LoggingLoki/Batcher.swift deleted file mode 100644 index 957e9ab..0000000 --- a/Sources/LoggingLoki/Batcher.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation - -final class Batcher: Sendable { - private let session: LokiSession - private let headers: [String: String] - - private let lokiURL: URL - private let sendDataAsJSON: Bool - - private let batchSize: Int - private let maxBatchTimeInterval: TimeInterval? - - let batch: NIOLockedValueBox = NIOLockedValueBox(nil) - - init(session: LokiSession, - headers: [String: String], - lokiURL: URL, - sendDataAsJSON: Bool, - batchSize: Int, - maxBatchTimeInterval: TimeInterval?) { - self.session = session - self.headers = headers - self.lokiURL = lokiURL - self.sendDataAsJSON = sendDataAsJSON - self.batchSize = batchSize - self.maxBatchTimeInterval = maxBatchTimeInterval - } - - func addEntryToBatch(_ log: LokiLog, with labels: LokiLabels) { - self.batch.withLockedValue { batch in - if batch != nil { - batch!.addEntry(log, with: labels) - } else { - batch = Batch(entries: []) - batch!.addEntry(log, with: labels) - } - } - } - - func sendBatchIfNeeded() { - self.batch.withLockedValue { safeBatch in - guard let batch = safeBatch else { return } - - if let maxBatchTimeInterval, batch.createdAt.addingTimeInterval(maxBatchTimeInterval) < Date() { - sendBatch(batch) - safeBatch = nil - return - } - - if batch.totalLogEntries >= batchSize { - sendBatch(batch) - safeBatch = nil - return - } - } - } - - private func sendBatch(_ batch: Batch) { - session.send(batch, url: lokiURL, headers: headers, sendAsJSON: sendDataAsJSON) { result in - if case .failure(let failure) = result { - debugPrint(failure) - } - } - } -} diff --git a/Sources/LoggingLoki/Documentation.docc/Documentation.md b/Sources/LoggingLoki/Documentation.docc/Documentation.md index 71c2fe9..1e606f8 100644 --- a/Sources/LoggingLoki/Documentation.docc/Documentation.md +++ b/Sources/LoggingLoki/Documentation.docc/Documentation.md @@ -2,15 +2,22 @@ This library can be used as an implementation of Apple's swift-log interface that captures console logs from apps or services and sends them to Grafana Loki. -## Overview +## Usage -LoggingLoki provides a logging backend for [swift-log](https://github.com/apple/swift-log) with support for sending logs to a [Grafana Loki](https://grafana.com/oss/loki) instance. It includes the following list of features. +You'll have to configure your Logger with a ``LokiLogHandler``. -- Supports Darwin (macOS), Linux platforms, iOS, watchOS and tvOS -- Different logging levels such as `trace`, `debug`, `info`, `notice`, `warning`, `error` and `critical` +The handler needs a ``LokiLogProcessor`` to send logs to your Loki server. +> Note: Logs can be sent to Loki as long as ``LokiLogProcessor/run()`` is not cancelled. + +@Snippet(path: "swift-log-loki/Snippets/BasicUsage", slice: "setup") ## Topics ### Essentials - ``LokiLogHandler`` +- ``LokiLogProcessor`` + +### Configuration + +- ``LokiLogProcessorConfiguration`` diff --git a/Sources/LoggingLoki/LokiError.swift b/Sources/LoggingLoki/LokiError.swift deleted file mode 100644 index c797b6a..0000000 --- a/Sources/LoggingLoki/LokiError.swift +++ /dev/null @@ -1,14 +0,0 @@ -import struct Foundation.Data -import protocol Foundation.LocalizedError - -enum LokiError: LocalizedError, Sendable { - case invalidResponse(Data?) - - var errorDescription: String? { - switch self { - case .invalidResponse(let data): - guard let data else { return nil } - return String(data: data, encoding: .utf8) - } - } -} diff --git a/Sources/LoggingLoki/LokiLog.swift b/Sources/LoggingLoki/LokiLog.swift new file mode 100644 index 0000000..0fe6936 --- /dev/null +++ b/Sources/LoggingLoki/LokiLog.swift @@ -0,0 +1,15 @@ +import struct Foundation.Date +import Logging + +struct LokiLog { + var timestamp: Date + var level: Logger.Level + var message: Logger.Message + var metadata: Logger.Metadata + + struct Transport { + var timestamp: Date + var line: String + var metadata: [String: String]? + } +} diff --git a/Sources/LoggingLoki/LokiLogHandler.swift b/Sources/LoggingLoki/LokiLogHandler.swift index 25377f4..cf64bd2 100644 --- a/Sources/LoggingLoki/LokiLogHandler.swift +++ b/Sources/LoggingLoki/LokiLogHandler.swift @@ -1,97 +1,43 @@ -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif +import class Foundation.ProcessInfo import Logging /// ``LokiLogHandler`` is a logging backend for `Logging`. -public struct LokiLogHandler: LogHandler, Sendable { +public struct LokiLogHandler: LogHandler, Sendable where Clock.Duration == Duration { - internal let session: LokiSession + private let processor: LokiLogProcessor - private let lokiURL: URL - private let sendDataAsJSON: Bool - - private let batchSize: Int - private let maxBatchTimeInterval: TimeInterval? - - private let batcher: Batcher - - /// The service label for the log handler instance. + /// The logger label for the log handler instance. /// - /// This value will be sent to Grafana Loki as the `service` label. + /// This value will be sent to Grafana Loki as the `logger` label. public var label: String - - /// This initializer is only used internally and for running Unit Tests. - internal init(label: String, - lokiURL: URL, - headers: [String: String] = [:], - sendAsJSON: Bool = false, - batchSize: Int = 10, - maxBatchTimeInterval: TimeInterval? = 5 * 60, - session: LokiSession) { - self.label = label - #if os(Linux) // this needs to be explicitly checked, otherwise the build will fail on linux - self.lokiURL = lokiURL.appendingPathComponent("/loki/api/v1/push") - #else - if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) { - self.lokiURL = lokiURL.appending(path: "/loki/api/v1/push") - } else { - self.lokiURL = lokiURL.appendingPathComponent("/loki/api/v1/push") - } - #endif - self.sendDataAsJSON = sendAsJSON - self.batchSize = batchSize - self.maxBatchTimeInterval = maxBatchTimeInterval - self.session = session - self.batcher = Batcher(session: self.session, - headers: headers, - lokiURL: self.lokiURL, - sendDataAsJSON: self.sendDataAsJSON, - batchSize: self.batchSize, - maxBatchTimeInterval: self.maxBatchTimeInterval) - } - - /// Initializes a ``LokiLogHandler`` with the provided parameters. + /// The service/program name. /// - /// The handler will send all logs it captures to the Grafana Loki instance the client has provided. If a request fails it will send a debugPrint to the the console. - /// The handler will not send the request again. It's basically fire and forget. + /// This value will be sent to Grafana Loki as the `service` label. + public var service: String + /// Static labels sent to Loki, which should not depend on the context of a log message. + public var lokiLabels: [String: String] + + /// Creates a log handler, which sends logs to Grafana Loki. /// - /// ```swift - /// LoggingSystem.bootstrap { - /// LokiLogHandler( - /// label: $0, - /// lokiURL: URL(string: "http://localhost:3100")! - /// ) - /// } - /// ``` + /// @Snippet(path: "swift-log-loki/Snippets/BasicUsage", slice: "setup") /// /// - Parameters: - /// - label: client supplied string describing the logger. Should be unique but not enforced - /// - lokiURL: client supplied Grafana Loki base URL - /// - headers: These headers will be added to all requests sent to Grafana Loki. - /// - sendAsJSON: Indicates if the logs should be sent to Loki as JSON. - /// This should not be required in most cases. By default this is false. - /// Logs will instead be sent as snappy compressed protobuf, - /// which is much smaller and should therefor use less bandwidth. - /// This is also the recommended way by Loki. - /// - batchSize: The size of a single batch of data. Once this limit is exceeded the batch of logs will be sent to Loki. - /// This is 10 log entries by default. - /// - maxBatchTimeInterval: The maximum amount of time in seconds to elapse until a batch is sent to Loki. - /// This limit is set to 5 minutes by default. If a batch is not "full" after the end of the interval, it will be sent to Loki. - /// The option should prevent leaving logs in memory for too long without sending them. - public init(label: String, - lokiURL: URL, - headers: [String: String] = [:], - sendAsJSON: Bool = false, - batchSize: Int = 10, - maxBatchTimeInterval: TimeInterval? = 5 * 60) { - self.init(label: label, - lokiURL: lokiURL, - headers: headers, - sendAsJSON: sendAsJSON, - batchSize: batchSize, - session: URLSession(configuration: .ephemeral)) + /// - label: Client supplied string describing the logger. Should be unique but not enforced. + /// It's also sent to Loki as the `logger` label. + /// - service: Client supplied string indicating the service/program name. + /// It will be sent to Loki as the `service` label. + /// - lokiLabels: Static labels sent to Loki, which should not depend on the context of a log message. + /// - processor: Backend service which manages and sends logs to Loki. + public init( + label: String, + service: String = ProcessInfo.processInfo.processName, + lokiLabels: [String: String] = [:], + processor: LokiLogProcessor + ) { + self.label = label + self.service = service + self.lokiLabels = lokiLabels + self.processor = processor } /// This method is called when a `LogHandler` must emit a log message. There is no need for the `LogHandler` to @@ -106,16 +52,36 @@ public struct LokiLogHandler: LogHandler, Sendable { /// - file: The file the log message was emitted from. /// - function: The function the log line was emitted from. /// - line: The line the log message was emitted from. - public func log(level: Logger.Level, message: Logger.Message, metadata: Logger.Metadata?, source: String, file: String, function: String, line: UInt) { - let prettyMetadata = metadata?.isEmpty ?? true ? prettyMetadata : prettify(self.metadata.merging(metadata!, uniquingKeysWith: { _, new in new })) - - let labels: LokiLabels = ["service": label, "source": source, "file": file, "function": function, "line": String(line)] - let timestamp = Date() - let message = "[\(level.rawValue.uppercased())]\(prettyMetadata.map { " \($0)"} ?? "") \(message)" - let log = (timestamp, message) - - batcher.addEntryToBatch(log, with: labels) - batcher.sendBatchIfNeeded() + public func log( + level: Logger.Level, + message: Logger.Message, + metadata explicitMetadata: Logger.Metadata?, + source: String, + file: String, + function: String, + line: UInt + ) { + let effectiveMetadata = Self.prepareMetadata( + base: self.metadata, + provider: self.metadataProvider, + explicit: explicitMetadata + ) + + let labels = [ + "service": service, + "logger": label, + "source": source, + "file": file, + "function": function, + "line": String(line) + ].merging(lokiLabels) { old, _ in old } // message specific labels win! + + processor.addEntryToBatch(.init( + timestamp: .init(), + level: level, + message: message, + metadata: effectiveMetadata + ), with: labels) } /// Add, remove, or change the logging metadata. @@ -140,11 +106,7 @@ public struct LokiLogHandler: LogHandler, Sendable { /// /// - note: `LogHandler`s must treat logging metadata as a value type. This means that the change in metadata must /// only affect this very `LogHandler`. - public var metadata = Logger.Metadata() { - didSet { - prettyMetadata = prettify(metadata) - } - } + public var metadata = Logger.Metadata() /// Get or set the configured log level. /// @@ -154,7 +116,25 @@ public struct LokiLogHandler: LogHandler, Sendable { /// `LogHandler`. public var logLevel: Logger.Level = .info - private func prettify(_ metadata: Logger.Metadata) -> String? { - !metadata.isEmpty ? metadata.map { "\($0)=\($1)" }.joined(separator: " ") : nil + internal static func prepareMetadata(base: Logger.Metadata, provider: Logger.MetadataProvider?, explicit: Logger.Metadata?) -> Logger.Metadata { + var metadata = base + + let provided = provider?.get() ?? [:] + + guard !provided.isEmpty || !((explicit ?? [:]).isEmpty) else { + // all per-log-statement values are empty + return base + } + + if !provided.isEmpty { + metadata.merge(provided, uniquingKeysWith: { _, provided in provided }) + } + + if let explicit = explicit, !explicit.isEmpty { + metadata.merge(explicit, uniquingKeysWith: { _, explicit in explicit }) + } + + return metadata } + } diff --git a/Sources/LoggingLoki/LokiLogProcessor.swift b/Sources/LoggingLoki/LokiLogProcessor.swift new file mode 100644 index 0000000..2d50256 --- /dev/null +++ b/Sources/LoggingLoki/LokiLogProcessor.swift @@ -0,0 +1,298 @@ +import Logging +import NIOHTTP1 +import AsyncHTTPClient +import ServiceLifecycle +import AsyncAlgorithms +import NIOConcurrencyHelpers + +/// A configuration object for ``LokiLogProcessor``. +public struct LokiLogProcessorConfiguration: Sendable { + /// The loki server URL, eg. `http://localhost:3100`. + public var lokiURL: String { + didSet { + _lokiURL = if lokiURL.hasSuffix("/") { + lokiURL + "loki/api/v1/push" + } else { + lokiURL + "/loki/api/v1/push" + } + } + } + internal private(set) var _lokiURL: String + /// HTTP headers to be sent to the Loki server. + /// + /// Especially useful for authentication purposes. + /// E.g. setting a `Authorization: Basic ...` header. + public var headers: [(String, String)] + + /// The format used to send logs to Loki. + public var logFormat: LogFormat + /// The size of a single batch of logs. + /// + /// Once this limit is exceeded the batch of logs will be sent to Loki. + public var batchSize: Int + /// The maximum amount of time in seconds to elapse until a batch of logs is sent to Loki. + /// + /// This limit is set to 5 minutes by default. Even if a batch is not "full" (``batchSize``) + /// after the end of the interval, it will be sent to Loki. + /// Setting this interval should prevent leaving logs in memory for too long without sending them. + public var maxBatchTimeInterval: Duration? + + /// An interval, which indicates the period in which the processor checks for logs to be sent. + public var exportInterval: Duration = .seconds(5) + /// A timeout until an export is cancelled. + public var exportTimeout: Duration = .seconds(30) + + /// Specifies the transport encoding of the payload sent to the Loki backend. + public var encoding: Encoding + + /// Indicates the format of log messages sent to Loki. + public struct LogFormat: Sendable { + public typealias CustomFormatter = @Sendable (Logger.Level, Logger.Message, Logger.Metadata) -> String + + enum Code { + case logfmt + case structured + case custom(CustomFormatter) + } + + let code: Code + + /// Sends `Logger.Metadata` as part of the log line in the logfmt format. + /// + ///The line content will be formatted like this: + /// ```log + /// [LEVEL] metadata_key=metadata_value msg="my log line content" + /// ``` + /// + /// See [https://brandur.org/logfmt](https://brandur.org/logfmt). + public static let logfmt = LogFormat(code: .logfmt) + /// Sends `Logger.Metadata` to Loki as structured metadata + /// and leaves it out of the log line itself. + /// + /// The line content will be formatted like this: + /// ```log + /// [LEVEL] my log line content + /// ``` + /// + /// Note, that the metadata is not part of the log line itself but will be sent as structured metadata. + /// + /// See [https://grafana.com/docs/loki/latest/get-started/labels/structured-metadata/](https://grafana.com/docs/loki/latest/get-started/labels/structured-metadata/). + public static let structured = LogFormat(code: .structured) + + /// A custom format provided by the user. + public static func custom(_ format: @escaping CustomFormatter) -> Self { + LogFormat(code: .custom(format)) + } + } + + /// Transport encoding (content-type) of the body which is sent to Loki. + public struct Encoding: Sendable { + enum Code { + case json + case protobuf + } + + let code: Code + + public static let json = Encoding(code: .json) + public static let protobuf = Encoding(code: .protobuf) + } + + /// Initializes a configuration. + /// - Parameters: + /// - lokiURL: The URL of the Loki server where to logs will be sent to. + /// - headers: A collection of key value pairs that will be sent as HTTP headers to the Loki server. + /// - batchSize: The limit of logs in a single batch until they will be sent to Loki. + /// - maxBatchTimeInterval: The maximum amount of time a batch of logs will remain in + /// memory, before it is sent to Loki, even if the batchSize is not exceeded. Will be omitted if `nil`. + /// - logFormat: The format of a log message/line. + public init( + lokiURL: String, + headers: [(String, String)] = [], + batchSize: Int = 20, + maxBatchTimeInterval: Duration? = .seconds(60), + logFormat: LogFormat = .structured + ) { + self.lokiURL = lokiURL + self._lokiURL = if lokiURL.hasSuffix("/") { + lokiURL + "loki/api/v1/push" + } else { + lokiURL + "/loki/api/v1/push" + } + self.headers = headers + self.batchSize = batchSize + self.maxBatchTimeInterval = maxBatchTimeInterval + self.encoding = .protobuf + self.logFormat = logFormat + } +} + +/// A service used to process logs and send them to Loki. +/// +/// The service is sending logs as long as ``LokiLogProcessor/run()`` is not cancelled. +/// +/// It conforms to ``ServiceLifecycle.Service``. +public struct LokiLogProcessor: Sendable, Service where Clock.Duration == Duration { + final class _Storage: Sendable { + fileprivate let _value: NIOLockedValueBox?> = NIOLockedValueBox(nil) + } + + public typealias Configuration = LokiLogProcessorConfiguration + + private let logger = Logger(label: "LokiLogProcessor") + + private let configuration: Configuration + + private let transport: LokiTransport + private let transformer: LokiTransformer + private let clock: Clock + + private let storage = _Storage() + + private let stream: AsyncStream<(LokiLog.Transport, [String: String])> + private let continuation: AsyncStream<(LokiLog.Transport, [String: String])>.Continuation + + init( + configuration: Configuration, + transport: LokiTransport, + transformer: LokiTransformer, + clock: Clock + ) { + self.configuration = configuration + self.transport = transport + self.transformer = transformer + self.clock = clock + + let (stream, continuation) = AsyncStream<(LokiLog.Transport, [String: String])>.makeStream() + self.stream = stream + self.continuation = continuation + } + + public func run() async throws { + try await withThrowingDiscardingTaskGroup { group in + group.addTask { + for try await _ in AsyncTimerSequence.repeating(every: configuration.exportInterval, clock: clock).cancelOnGracefulShutdown() { + await tick() + } + } + + group.addTask { + await withGracefulShutdownHandler { + for await (log, labels) in stream { + self.storage._value.withLockedValue { batch in + if batch != nil { + batch!.addEntry(log, with: labels) + } else { + batch = Batch(entries: [], createdAt: clock.now) + batch!.addEntry(log, with: labels) + } + } + } + } onGracefulShutdown: { + continuation.finish() + } + } + } + } + + private func tick() async { + let batch: Batch? = self.storage._value.withLockedValue { safeBatch in + guard let batch = safeBatch else { return nil } + + if let maxBatchTimeInterval = configuration.maxBatchTimeInterval, + batch.createdAt.advanced(by: maxBatchTimeInterval) <= clock.now { + safeBatch = nil + return batch + } + + if batch.totalLogEntries >= configuration.batchSize { + safeBatch = nil + return batch + } + + return nil + } + + guard let batch else { return } + do { + try await withTimeout(configuration.exportTimeout, clock: clock) { + try await sendBatch(batch) + } + } catch is CancellationError { + logger.warning("Timed out exporting logs.", metadata: ["timeout": "\(configuration.exportTimeout)"]) + } catch { + logger.error("Failed to export logs.", metadata: ["error": "\(error)"]) + } + } + + func addEntryToBatch(_ log: LokiLog, with labels: [String: String]) { + let log = makeLog(log) + continuation.yield((log, labels)) + } + + func makeLog(_ log: LokiLog) -> LokiLog.Transport { + switch configuration.logFormat.code { + case .logfmt: + var line = "[\(log.level.rawValue.uppercased())] message=\"\(log.message)\"" + if let metadata = prettify(log.metadata) { + line += " \(metadata)" + } + return .init(timestamp: .init(), line: line) + case .structured: + return .init( + timestamp: .init(), + line: "[\(log.level.rawValue.uppercased())] \(log.message)", + metadata: log.metadata.mapValues(\.description) + ) + case .custom(let customFormatter): + let line = customFormatter(log.level, log.message, log.metadata) + return .init(timestamp: .init(), line: line) + } + } + + private func sendBatch(_ batch: Batch) async throws { + var headers = HTTPHeaders(configuration.headers) + let buffer = try transformer.transform(batch.entries, headers: &headers) + try await transport + .transport(buffer, url: configuration._lokiURL, headers: headers) + } + + private func prettify(_ metadata: Logger.Metadata) -> String? { + if metadata.isEmpty { + return nil + } else { + return metadata.lazy.sorted(by: { $0.key < $1.key }).map { key, value in + if "\(value)".contains(" ") { + "\(key)=\"\(value)\"" + } else { + "\(key)=\(value)" + } + }.joined(separator: " ") + } + } + +} + +extension LokiLogProcessor where Clock == ContinuousClock { + /// Creates a new processor used to send logs to Loki with the given configuration. + /// + /// The processor can be used on multiple ``LokiLogHandler``s, + /// it will manage the logs accordingly. + /// + /// - Parameter configuration: A configuration object used to setup the processors behaviour. + public init(configuration: Configuration) { + let transformer: LokiTransformer = switch configuration.encoding.code { + case .json: + LokiJSONTransformer() + case .protobuf: + LokiProtobufTransformer() + } + let clock = ContinuousClock() + self.init( + configuration: configuration, + transport: HTTPClient.shared, + transformer: transformer, + clock: clock + ) + } +} diff --git a/Sources/LoggingLoki/LokiRequest.swift b/Sources/LoggingLoki/LokiRequest.swift index 99282bc..1ba5ac7 100644 --- a/Sources/LoggingLoki/LokiRequest.swift +++ b/Sources/LoggingLoki/LokiRequest.swift @@ -1,9 +1,9 @@ struct LokiRequest: Encodable, Sendable { var streams: [LokiStream] - static func fromBatch(_ batch: Batch) -> LokiRequest { + static func from(entries: [BatchEntry]) -> LokiRequest { var request = LokiRequest(streams: []) - for entry in batch.entries { + for entry in entries { request.streams.append(LokiStream(entry.logEntries, with: entry.labels)) } return request diff --git a/Sources/LoggingLoki/LokiSession.swift b/Sources/LoggingLoki/LokiSession.swift deleted file mode 100644 index c7701bf..0000000 --- a/Sources/LoggingLoki/LokiSession.swift +++ /dev/null @@ -1,72 +0,0 @@ -import Foundation -#if canImport(FoundationNetworking) -import FoundationNetworking -#endif -import Logging -import Snappy - -protocol LokiSession: Sendable { - func send(_ batch: Batch, - url: URL, - headers: [String: String], - sendAsJSON: Bool, - completion: @escaping (Result) -> Void) -} - -extension URLSession: LokiSession { - func send(_ batch: Batch, - url: URL, - headers: [String: String], - sendAsJSON: Bool = false, - completion: @escaping (Result) -> Void) { - do { - let data: Data - let contentType: String - - if sendAsJSON { - data = try JSONEncoder().encode(LokiRequest.fromBatch(batch)) - contentType = "application/json" - } else { - let proto = Logproto_PushRequest.with { request in - request.streams = batch.entries.map { batchEntry in - Logproto_StreamAdapter.with { stream in - stream.labels = "{" + batchEntry.labels.map { "\($0)=\"\($1)\"" }.joined(separator: ",") + "}" - stream.entries = batchEntry.logEntries.map { timestamp, message in - Logproto_EntryAdapter.with { entry in - entry.timestamp = .with { - $0.seconds = Int64(timestamp.timeIntervalSince1970.rounded(.down)) - $0.nanos = Int32(Int(timestamp.timeIntervalSince1970 * 1_000_000_000) % 1_000_000_000) - } - entry.line = message - } - } - } - } - } - data = try proto.serializedData().compressedUsingSnappy() - contentType = "application/x-protobuf" - } - - var request = URLRequest(url: url) - request.httpMethod = "POST" - request.httpBody = data - request.setValue(contentType, forHTTPHeaderField: "Content-Type") - for header in headers { - request.setValue(header.value, forHTTPHeaderField: header.key) - } - - let task = dataTask(with: request) { data, response, error in - if let error = error { - completion(.failure(error)) - } else if let httpResponse = response as? HTTPURLResponse, (200..<300).contains(httpResponse.statusCode) { - completion(.success(httpResponse.statusCode)) - } else { - completion(.failure(LokiError.invalidResponse(data))) - } - } - task.resume() - } catch { - completion(.failure(error)) - } - } -} diff --git a/Sources/LoggingLoki/LokiStream.swift b/Sources/LoggingLoki/LokiStream.swift index 5817064..7814fd5 100644 --- a/Sources/LoggingLoki/LokiStream.swift +++ b/Sources/LoggingLoki/LokiStream.swift @@ -1,24 +1,33 @@ -import class Foundation.NumberFormatter -import class Foundation.NSNumber - struct LokiStream: Encodable, Sendable { - var stream: Dictionary - var values: Array> + typealias Value = (String, String, [String: String]?) + + var stream: [String: String] + var values: [Value] - init(_ logs: [LokiLog], with labels: LokiLabels) { + init(_ logs: [LokiLog.Transport], with labels: [String: String]) { self.stream = labels - self.values = logs.compactMap { log in - let formatter = NumberFormatter() - formatter.numberStyle = .decimal - formatter.groupingSeparator = "" - #if os(macOS) || !canImport(Darwin) - formatter.thousandSeparator = "" - #endif - let timestamp = Int64(log.timestamp.timeIntervalSince1970 * 1_000_000_000) as NSNumber - guard let formattedTimestamp = formatter.string(from: timestamp) else { - return nil + self.values = logs.map { log -> Value in + let timestamp = Int64(log.timestamp.timeIntervalSince1970 * 1_000_000_000) + return ("\(timestamp)", log.line, log.metadata?.isEmpty == false ? log.metadata : nil) + } + } + + func encode(to encoder: any Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(stream, forKey: .stream) + var valuesContainer = container.nestedUnkeyedContainer(forKey: .values) + for value in values { + var singleValueContainer = valuesContainer.nestedUnkeyedContainer() + try singleValueContainer.encode(value.0) + try singleValueContainer.encode(value.1) + if let metadata = value.2 { + try singleValueContainer.encode(metadata) } - return [formattedTimestamp, log.message] } } + + enum CodingKeys: CodingKey { + case stream + case values + } } diff --git a/Sources/LoggingLoki/LokiTransformer.swift b/Sources/LoggingLoki/LokiTransformer.swift new file mode 100644 index 0000000..6aefb32 --- /dev/null +++ b/Sources/LoggingLoki/LokiTransformer.swift @@ -0,0 +1,59 @@ +import class Foundation.JSONEncoder +import NIOCore +import NIOHTTP1 +import NIOFoundationCompat +import Snappy + +protocol LokiTransformer: Sendable { + func transform(_ entries: [BatchEntry], headers: inout HTTPHeaders) throws -> ByteBuffer +} + +struct LokiJSONTransformer: LokiTransformer { + let encoder = JSONEncoder() + let allocator = ByteBufferAllocator() + + func transform( + _ entries: [BatchEntry], + headers: inout HTTPHeaders + ) throws -> ByteBuffer { + let buffer = try encoder.encodeAsByteBuffer( + LokiRequest.from(entries: entries), + allocator: allocator + ) + headers.replaceOrAdd(name: "Content-Type", value: "application/json") + return buffer + } +} + +struct LokiProtobufTransformer: LokiTransformer { + func transform( + _ entries: [BatchEntry], + headers: inout HTTPHeaders + ) throws -> ByteBuffer { + let proto = Logproto_PushRequest.with { request in + request.streams = entries.map { batchEntry in + Logproto_StreamAdapter.with { stream in + stream.labels = "{" + batchEntry.labels.map { "\($0)=\"\($1)\"" }.joined(separator: ",") + "}" + stream.entries = batchEntry.logEntries.map { log in + Logproto_EntryAdapter.with { entry in + entry.timestamp = .init(date: log.timestamp) + entry.line = log.line + if let metadata = log.metadata { + entry.structuredMetadata = metadata.map { key, value in + .with { pair in + pair.name = key + pair.value = value + } + } + } + } + } + } + } + } + + let data = try proto.serializedData().compressedUsingSnappy() + headers.replaceOrAdd(name: "Content-Type", value: "application/x-protobuf") + return ByteBuffer(data: data) + } +} diff --git a/Sources/LoggingLoki/LokiTransport.swift b/Sources/LoggingLoki/LokiTransport.swift new file mode 100644 index 0000000..96e2b69 --- /dev/null +++ b/Sources/LoggingLoki/LokiTransport.swift @@ -0,0 +1,30 @@ +import NIOCore +import NIOHTTP1 +import AsyncHTTPClient + +protocol LokiTransport: Sendable { + func transport(_ data: ByteBuffer, url: String, headers: HTTPHeaders) async throws +} + +extension HTTPClient: LokiTransport { + func transport(_ data: ByteBuffer, url: String, headers: HTTPHeaders) async throws { + var request = HTTPClientRequest(url: url) + request.headers = headers + request.body = .bytes(data) + request.method = .POST + let response = try await self.execute(request, timeout: .seconds(30)) + guard response.status.code / 100 == 2 else { + let body = try? await response.body.collect(upTo: 1024 * 1024) + let payload = body?.getString( + at: body?.readerIndex ?? 0, + length: body?.readableBytes ?? 0 + ) + throw LokiResponseError(response: response, payload: payload) + } + } +} + +struct LokiResponseError: Error { + var response: HTTPClientResponse + var payload: String? +} diff --git a/Sources/LoggingLoki/NIOLock.swift b/Sources/LoggingLoki/NIOLock.swift deleted file mode 100644 index aec0b59..0000000 --- a/Sources/LoggingLoki/NIOLock.swift +++ /dev/null @@ -1,268 +0,0 @@ -// Implementation vendored from SwiftNIO: -// https://github.com/apple/swift-nio - -//===----------------------------------------------------------------------===// -// -// This source file is part of the SwiftNIO open source project -// -// Copyright (c) 2017-2022 Apple Inc. and the SwiftNIO project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of SwiftNIO project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#if canImport(Darwin) -import Darwin -#elseif os(Windows) -import ucrt -import WinSDK -#elseif canImport(Glibc) -import Glibc -#elseif canImport(Musl) -import Musl -#else -#error("The concurrency NIOLock module was unable to identify your C library.") -#endif - -#if os(Windows) -@usableFromInline -typealias LockPrimitive = SRWLOCK -#else -@usableFromInline -typealias LockPrimitive = pthread_mutex_t -#endif - -@usableFromInline -enum LockOperations { } - -extension LockOperations { - @inlinable - static func create(_ mutex: UnsafeMutablePointer) { - mutex.assertValidAlignment() - -#if os(Windows) - InitializeSRWLock(mutex) -#else - var attr = pthread_mutexattr_t() - pthread_mutexattr_init(&attr) - debugOnly { - pthread_mutexattr_settype(&attr, .init(PTHREAD_MUTEX_ERRORCHECK)) - } - - let err = pthread_mutex_init(mutex, &attr) - precondition(err == 0, "\(#function) failed in pthread_mutex with error \(err)") -#endif - } - - @inlinable - static func destroy(_ mutex: UnsafeMutablePointer) { - mutex.assertValidAlignment() - -#if os(Windows) - // SRWLOCK does not need to be free'd -#else - let err = pthread_mutex_destroy(mutex) - precondition(err == 0, "\(#function) failed in pthread_mutex with error \(err)") -#endif - } - - @inlinable - static func lock(_ mutex: UnsafeMutablePointer) { - mutex.assertValidAlignment() - -#if os(Windows) - AcquireSRWLockExclusive(mutex) -#else - let err = pthread_mutex_lock(mutex) - precondition(err == 0, "\(#function) failed in pthread_mutex with error \(err)") -#endif - } - - @inlinable - static func unlock(_ mutex: UnsafeMutablePointer) { - mutex.assertValidAlignment() - -#if os(Windows) - ReleaseSRWLockExclusive(mutex) -#else - let err = pthread_mutex_unlock(mutex) - precondition(err == 0, "\(#function) failed in pthread_mutex with error \(err)") -#endif - } -} - -// Tail allocate both the mutex and a generic value using ManagedBuffer. -// Both the header pointer and the elements pointer are stable for -// the class's entire lifetime. -// -// However, for safety reasons, we elect to place the lock in the "elements" -// section of the buffer instead of the head. The reasoning here is subtle, -// so buckle in. -// -// _As a practical matter_, the implementation of ManagedBuffer ensures that -// the pointer to the header is stable across the lifetime of the class, and so -// each time you call `withUnsafeMutablePointers` or `withUnsafeMutablePointerToHeader` -// the value of the header pointer will be the same. This is because ManagedBuffer uses -// `Builtin.addressOf` to load the value of the header, and that does ~magic~ to ensure -// that it does not invoke any weird Swift accessors that might copy the value. -// -// _However_, the header is also available via the `.header` field on the ManagedBuffer. -// This presents a problem! The reason there's an issue is that `Builtin.addressOf` and friends -// do not interact with Swift's exclusivity model. That is, the various `with` functions do not -// conceptually trigger a mutating access to `.header`. For elements this isn't a concern because -// there's literally no other way to perform the access, but for `.header` it's entirely possible -// to accidentally recursively read it. -// -// Our implementation is free from these issues, so we don't _really_ need to worry about it. -// However, out of an abundance of caution, we store the Value in the header, and the LockPrimitive -// in the trailing elements. We still don't use `.header`, but it's better to be safe than sorry, -// and future maintainers will be happier that we were cautious. -// -// See also: https://github.com/apple/swift/pull/40000 -@usableFromInline -final class LockStorage: ManagedBuffer { - - @inlinable - static func create(value: Value) -> Self { - let buffer = Self.create(minimumCapacity: 1) { _ in - return value - } - let storage = unsafeDowncast(buffer, to: Self.self) - - storage.withUnsafeMutablePointers { _, lockPtr in - LockOperations.create(lockPtr) - } - - return storage - } - - @inlinable - func lock() { - self.withUnsafeMutablePointerToElements { lockPtr in - LockOperations.lock(lockPtr) - } - } - - @inlinable - func unlock() { - self.withUnsafeMutablePointerToElements { lockPtr in - LockOperations.unlock(lockPtr) - } - } - - @inlinable - deinit { - self.withUnsafeMutablePointerToElements { lockPtr in - LockOperations.destroy(lockPtr) - } - } - - @inlinable - func withLockPrimitive(_ body: (UnsafeMutablePointer) throws -> T) rethrows -> T { - try self.withUnsafeMutablePointerToElements { lockPtr in - return try body(lockPtr) - } - } - - @inlinable - func withLockedValue(_ mutate: (inout Value) throws -> T) rethrows -> T { - try self.withUnsafeMutablePointers { valuePtr, lockPtr in - LockOperations.lock(lockPtr) - defer { LockOperations.unlock(lockPtr) } - return try mutate(&valuePtr.pointee) - } - } -} - -extension LockStorage: @unchecked Sendable { } - -/// A threading lock based on `libpthread` instead of `libdispatch`. -/// -/// - note: ``NIOLock`` has reference semantics. -/// -/// This object provides a lock on top of a single `pthread_mutex_t`. This kind -/// of lock is safe to use with `libpthread`-based threading models, such as the -/// one used by NIO. On Windows, the lock is based on the substantially similar -/// `SRWLOCK` type. -@usableFromInline -struct NIOLock { - @usableFromInline - internal let _storage: LockStorage - - /// Create a new lock. - @inlinable - init() { - self._storage = .create(value: ()) - } - - /// Acquire the lock. - /// - /// Whenever possible, consider using `withLock` instead of this method and - /// `unlock`, to simplify lock handling. - @inlinable - func lock() { - self._storage.lock() - } - - /// Release the lock. - /// - /// Whenever possible, consider using `withLock` instead of this method and - /// `lock`, to simplify lock handling. - @inlinable - func unlock() { - self._storage.unlock() - } - - @inlinable - internal func withLockPrimitive(_ body: (UnsafeMutablePointer) throws -> T) rethrows -> T { - return try self._storage.withLockPrimitive(body) - } -} - -extension NIOLock { - /// Acquire the lock for the duration of the given block. - /// - /// This convenience method should be preferred to `lock` and `unlock` in - /// most situations, as it ensures that the lock will be released regardless - /// of how `body` exits. - /// - /// - Parameter body: The block to execute while holding the lock. - /// - Returns: The value returned by the block. - @inlinable - func withLock(_ body: () throws -> T) rethrows -> T { - self.lock() - defer { - self.unlock() - } - return try body() - } - - @inlinable - func withLockVoid(_ body: () throws -> Void) rethrows -> Void { - try self.withLock(body) - } -} - -extension NIOLock: Sendable {} - -extension UnsafeMutablePointer { - @inlinable - func assertValidAlignment() { - assert(UInt(bitPattern: self) % UInt(MemoryLayout.alignment) == 0) - } -} - -/// A utility function that runs the body code only in debug builds, without -/// emitting compiler warnings. -/// -/// This is currently the only way to do this in Swift: see -/// https://forums.swift.org/t/support-debug-only-code/11037 for a discussion. -@inlinable -internal func debugOnly(_ body: () -> Void) { - // FIXME: duplicated with NIO. - assert({ body(); return true }()) -} diff --git a/Sources/LoggingLoki/NIOLockedValueBox.swift b/Sources/LoggingLoki/NIOLockedValueBox.swift deleted file mode 100644 index e5a3e6a..0000000 --- a/Sources/LoggingLoki/NIOLockedValueBox.swift +++ /dev/null @@ -1,46 +0,0 @@ -// Implementation vendored from SwiftNIO: -// https://github.com/apple/swift-nio - -//===----------------------------------------------------------------------===// -// -// This source file is part of the SwiftNIO open source project -// -// Copyright (c) 2022 Apple Inc. and the SwiftNIO project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of SwiftNIO project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -/// Provides locked access to `Value`. -/// -/// - note: ``NIOLockedValueBox`` has reference semantics and holds the `Value` -/// alongside a lock behind a reference. -/// -/// This is no different than creating a ``Lock`` and protecting all -/// accesses to a value using the lock. But it's easy to forget to actually -/// acquire/release the lock in the correct place. ``NIOLockedValueBox`` makes -/// that much easier. -@usableFromInline -struct NIOLockedValueBox { - - @usableFromInline - internal let _storage: LockStorage - - /// Initialize the `Value`. - @inlinable - init(_ value: Value) { - self._storage = .create(value: value) - } - - /// Access the `Value`, allowing mutation of it. - @inlinable - func withLockedValue(_ mutate: (inout Value) throws -> T) rethrows -> T { - return try self._storage.withLockedValue(mutate) - } -} - -extension NIOLockedValueBox: Sendable where Value: Sendable {} diff --git a/Sources/LoggingLoki/Proto/descriptor.proto b/Sources/LoggingLoki/Proto/descriptor.proto deleted file mode 100644 index 6ddb6db..0000000 --- a/Sources/LoggingLoki/Proto/descriptor.proto +++ /dev/null @@ -1,921 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - -syntax = "proto2"; - -package google.protobuf; - -option go_package = "google.golang.org/protobuf/types/descriptorpb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "DescriptorProtos"; -option csharp_namespace = "Google.Protobuf.Reflection"; -option objc_class_prefix = "GPB"; -option cc_enable_arenas = true; - -// descriptor.proto must be optimized for speed because reflection-based -// algorithms don't work during bootstrapping. -option optimize_for = SPEED; - -// The protocol compiler can output a FileDescriptorSet containing the .proto -// files it parses. -message FileDescriptorSet { - repeated FileDescriptorProto file = 1; -} - -// Describes a complete .proto file. -message FileDescriptorProto { - optional string name = 1; // file name, relative to root of source tree - optional string package = 2; // e.g. "foo", "foo.bar", etc. - - // Names of files imported by this file. - repeated string dependency = 3; - // Indexes of the public imported files in the dependency list above. - repeated int32 public_dependency = 10; - // Indexes of the weak imported files in the dependency list. - // For Google-internal migration only. Do not use. - repeated int32 weak_dependency = 11; - - // All top-level definitions in this file. - repeated DescriptorProto message_type = 4; - repeated EnumDescriptorProto enum_type = 5; - repeated ServiceDescriptorProto service = 6; - repeated FieldDescriptorProto extension = 7; - - optional FileOptions options = 8; - - // This field contains optional information about the original source code. - // You may safely remove this entire field without harming runtime - // functionality of the descriptors -- the information is needed only by - // development tools. - optional SourceCodeInfo source_code_info = 9; - - // The syntax of the proto file. - // The supported values are "proto2", "proto3", and "editions". - // - // If `edition` is present, this value must be "editions". - optional string syntax = 12; - - // The edition of the proto file, which is an opaque string. - optional string edition = 13; -} - -// Describes a message type. -message DescriptorProto { - optional string name = 1; - - repeated FieldDescriptorProto field = 2; - repeated FieldDescriptorProto extension = 6; - - repeated DescriptorProto nested_type = 3; - repeated EnumDescriptorProto enum_type = 4; - - message ExtensionRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - - optional ExtensionRangeOptions options = 3; - } - repeated ExtensionRange extension_range = 5; - - repeated OneofDescriptorProto oneof_decl = 8; - - optional MessageOptions options = 7; - - // Range of reserved tag numbers. Reserved tag numbers may not be used by - // fields or extension ranges in the same message. Reserved ranges may - // not overlap. - message ReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Exclusive. - } - repeated ReservedRange reserved_range = 9; - // Reserved field names, which may not be used by fields in the same message. - // A given name may only be reserved once. - repeated string reserved_name = 10; -} - -message ExtensionRangeOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -// Describes a field within a message. -message FieldDescriptorProto { - enum Type { - // 0 is reserved for errors. - // Order is weird for historical reasons. - TYPE_DOUBLE = 1; - TYPE_FLOAT = 2; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - // negative values are likely. - TYPE_INT64 = 3; - TYPE_UINT64 = 4; - // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - // negative values are likely. - TYPE_INT32 = 5; - TYPE_FIXED64 = 6; - TYPE_FIXED32 = 7; - TYPE_BOOL = 8; - TYPE_STRING = 9; - // Tag-delimited aggregate. - // Group type is deprecated and not supported in proto3. However, Proto3 - // implementations should still be able to parse the group wire format and - // treat group fields as unknown fields. - TYPE_GROUP = 10; - TYPE_MESSAGE = 11; // Length-delimited aggregate. - - // New in version 2. - TYPE_BYTES = 12; - TYPE_UINT32 = 13; - TYPE_ENUM = 14; - TYPE_SFIXED32 = 15; - TYPE_SFIXED64 = 16; - TYPE_SINT32 = 17; // Uses ZigZag encoding. - TYPE_SINT64 = 18; // Uses ZigZag encoding. - } - - enum Label { - // 0 is reserved for errors - LABEL_OPTIONAL = 1; - LABEL_REQUIRED = 2; - LABEL_REPEATED = 3; - } - - optional string name = 1; - optional int32 number = 3; - optional Label label = 4; - - // If type_name is set, this need not be set. If both this and type_name - // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - optional Type type = 5; - - // For message and enum types, this is the name of the type. If the name - // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - // rules are used to find the type (i.e. first the nested types within this - // message are searched, then within the parent, on up to the root - // namespace). - optional string type_name = 6; - - // For extensions, this is the name of the type being extended. It is - // resolved in the same manner as type_name. - optional string extendee = 2; - - // For numeric types, contains the original text representation of the value. - // For booleans, "true" or "false". - // For strings, contains the default text contents (not escaped in any way). - // For bytes, contains the C escaped value. All bytes >= 128 are escaped. - optional string default_value = 7; - - // If set, gives the index of a oneof in the containing type's oneof_decl - // list. This field is a member of that oneof. - optional int32 oneof_index = 9; - - // JSON name of this field. The value is set by protocol compiler. If the - // user has set a "json_name" option on this field, that option's value - // will be used. Otherwise, it's deduced from the field's name by converting - // it to camelCase. - optional string json_name = 10; - - optional FieldOptions options = 8; - - // If true, this is a proto3 "optional". When a proto3 field is optional, it - // tracks presence regardless of field type. - // - // When proto3_optional is true, this field must be belong to a oneof to - // signal to old proto3 clients that presence is tracked for this field. This - // oneof is known as a "synthetic" oneof, and this field must be its sole - // member (each proto3 optional field gets its own synthetic oneof). Synthetic - // oneofs exist in the descriptor only, and do not generate any API. Synthetic - // oneofs must be ordered after all "real" oneofs. - // - // For message fields, proto3_optional doesn't create any semantic change, - // since non-repeated message fields always track presence. However it still - // indicates the semantic detail of whether the user wrote "optional" or not. - // This can be useful for round-tripping the .proto file. For consistency we - // give message fields a synthetic oneof also, even though it is not required - // to track presence. This is especially important because the parser can't - // tell if a field is a message or an enum, so it must always create a - // synthetic oneof. - // - // Proto2 optional fields do not set this flag, because they already indicate - // optional with `LABEL_OPTIONAL`. - optional bool proto3_optional = 17; -} - -// Describes a oneof. -message OneofDescriptorProto { - optional string name = 1; - optional OneofOptions options = 2; -} - -// Describes an enum type. -message EnumDescriptorProto { - optional string name = 1; - - repeated EnumValueDescriptorProto value = 2; - - optional EnumOptions options = 3; - - // Range of reserved numeric values. Reserved values may not be used by - // entries in the same enum. Reserved ranges may not overlap. - // - // Note that this is distinct from DescriptorProto.ReservedRange in that it - // is inclusive such that it can appropriately represent the entire int32 - // domain. - message EnumReservedRange { - optional int32 start = 1; // Inclusive. - optional int32 end = 2; // Inclusive. - } - - // Range of reserved numeric values. Reserved numeric values may not be used - // by enum values in the same enum declaration. Reserved ranges may not - // overlap. - repeated EnumReservedRange reserved_range = 4; - - // Reserved enum value names, which may not be reused. A given name may only - // be reserved once. - repeated string reserved_name = 5; -} - -// Describes a value within an enum. -message EnumValueDescriptorProto { - optional string name = 1; - optional int32 number = 2; - - optional EnumValueOptions options = 3; -} - -// Describes a service. -message ServiceDescriptorProto { - optional string name = 1; - repeated MethodDescriptorProto method = 2; - - optional ServiceOptions options = 3; -} - -// Describes a method of a service. -message MethodDescriptorProto { - optional string name = 1; - - // Input and output type names. These are resolved in the same way as - // FieldDescriptorProto.type_name, but must refer to a message type. - optional string input_type = 2; - optional string output_type = 3; - - optional MethodOptions options = 4; - - // Identifies if client streams multiple client messages - optional bool client_streaming = 5 [default = false]; - // Identifies if server streams multiple server messages - optional bool server_streaming = 6 [default = false]; -} - -// =================================================================== -// Options - -// Each of the definitions above may have "options" attached. These are -// just annotations which may cause code to be generated slightly differently -// or may contain hints for code that manipulates protocol messages. -// -// Clients may define custom options as extensions of the *Options messages. -// These extensions may not yet be known at parsing time, so the parser cannot -// store the values in them. Instead it stores them in a field in the *Options -// message called uninterpreted_option. This field must have the same name -// across all *Options messages. We then use this field to populate the -// extensions when we build a descriptor, at which point all protos have been -// parsed and so all extensions are known. -// -// Extension numbers for custom options may be chosen as follows: -// * For options which will only be used within a single application or -// organization, or for experimental options, use field numbers 50000 -// through 99999. It is up to you to ensure that you do not use the -// same number for multiple options. -// * For options which will be published and used publicly by multiple -// independent entities, e-mail protobuf-global-extension-registry@google.com -// to reserve extension numbers. Simply provide your project name (e.g. -// Objective-C plugin) and your project website (if available) -- there's no -// need to explain how you intend to use them. Usually you only need one -// extension number. You can declare multiple options with only one extension -// number by putting them in a sub-message. See the Custom Options section of -// the docs for examples: -// https://developers.google.com/protocol-buffers/docs/proto#options -// If this turns out to be popular, a web service will be set up -// to automatically assign option numbers. - -message FileOptions { - - // Sets the Java package where classes generated from this .proto will be - // placed. By default, the proto package is used, but this is often - // inappropriate because proto packages do not normally start with backwards - // domain names. - optional string java_package = 1; - - // Controls the name of the wrapper Java class generated for the .proto file. - // That class will always contain the .proto file's getDescriptor() method as - // well as any top-level extensions defined in the .proto file. - // If java_multiple_files is disabled, then all the other classes from the - // .proto file will be nested inside the single wrapper outer class. - optional string java_outer_classname = 8; - - // If enabled, then the Java code generator will generate a separate .java - // file for each top-level message, enum, and service defined in the .proto - // file. Thus, these types will *not* be nested inside the wrapper class - // named by java_outer_classname. However, the wrapper class will still be - // generated to contain the file's getDescriptor() method as well as any - // top-level extensions defined in the file. - optional bool java_multiple_files = 10 [default = false]; - - // This option does nothing. - optional bool java_generate_equals_and_hash = 20 [deprecated=true]; - - // If set true, then the Java2 code generator will generate code that - // throws an exception whenever an attempt is made to assign a non-UTF-8 - // byte sequence to a string field. - // Message reflection will do the same. - // However, an extension field still accepts non-UTF-8 byte sequences. - // This option has no effect on when used with the lite runtime. - optional bool java_string_check_utf8 = 27 [default = false]; - - // Generated classes can be optimized for speed or code size. - enum OptimizeMode { - SPEED = 1; // Generate complete code for parsing, serialization, - // etc. - CODE_SIZE = 2; // Use ReflectionOps to implement these methods. - LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. - } - optional OptimizeMode optimize_for = 9 [default = SPEED]; - - // Sets the Go package where structs generated from this .proto will be - // placed. If omitted, the Go package will be derived from the following: - // - The basename of the package import path, if provided. - // - Otherwise, the package statement in the .proto file, if present. - // - Otherwise, the basename of the .proto file, without extension. - optional string go_package = 11; - - // Should generic services be generated in each language? "Generic" services - // are not specific to any particular RPC system. They are generated by the - // main code generators in each language (without additional plugins). - // Generic services were the only kind of service generation supported by - // early versions of google.protobuf. - // - // Generic services are now considered deprecated in favor of using plugins - // that generate code specific to your particular RPC system. Therefore, - // these default to false. Old code which depends on generic services should - // explicitly set them to true. - optional bool cc_generic_services = 16 [default = false]; - optional bool java_generic_services = 17 [default = false]; - optional bool py_generic_services = 18 [default = false]; - optional bool php_generic_services = 42 [default = false]; - - // Is this file deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for everything in the file, or it will be completely ignored; in the very - // least, this is a formalization for deprecating files. - optional bool deprecated = 23 [default = false]; - - // Enables the use of arenas for the proto messages in this file. This applies - // only to generated classes for C++. - optional bool cc_enable_arenas = 31 [default = true]; - - // Sets the objective c class prefix which is prepended to all objective c - // generated classes from this .proto. There is no default. - optional string objc_class_prefix = 36; - - // Namespace for generated classes; defaults to the package. - optional string csharp_namespace = 37; - - // By default Swift generators will take the proto package and CamelCase it - // replacing '.' with underscore and use that to prefix the types/symbols - // defined. When this options is provided, they will use this value instead - // to prefix the types/symbols defined. - optional string swift_prefix = 39; - - // Sets the php class prefix which is prepended to all php generated classes - // from this .proto. Default is empty. - optional string php_class_prefix = 40; - - // Use this option to change the namespace of php generated classes. Default - // is empty. When this option is empty, the package name will be used for - // determining the namespace. - optional string php_namespace = 41; - - // Use this option to change the namespace of php generated metadata classes. - // Default is empty. When this option is empty, the proto file name will be - // used for determining the namespace. - optional string php_metadata_namespace = 44; - - // Use this option to change the package of ruby generated classes. Default - // is empty. When this option is not set, the package name will be used for - // determining the ruby package. - optional string ruby_package = 45; - - // The parser stores options it doesn't recognize here. - // See the documentation for the "Options" section above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. - // See the documentation for the "Options" section above. - extensions 1000 to max; - - reserved 38; -} - -message MessageOptions { - // Set true to use the old proto1 MessageSet wire format for extensions. - // This is provided for backwards-compatibility with the MessageSet wire - // format. You should not use this for any other reason: It's less - // efficient, has fewer features, and is more complicated. - // - // The message must be defined exactly as follows: - // message Foo { - // option message_set_wire_format = true; - // extensions 4 to max; - // } - // Note that the message cannot have any defined fields; MessageSets only - // have extensions. - // - // All extensions of your type must be singular messages; e.g. they cannot - // be int32s, enums, or repeated messages. - // - // Because this is an option, the above two restrictions are not enforced by - // the protocol compiler. - optional bool message_set_wire_format = 1 [default = false]; - - // Disables the generation of the standard "descriptor()" accessor, which can - // conflict with a field of the same name. This is meant to make migration - // from proto1 easier; new code should avoid fields named "descriptor". - optional bool no_standard_descriptor_accessor = 2 [default = false]; - - // Is this message deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the message, or it will be completely ignored; in the very least, - // this is a formalization for deprecating messages. - optional bool deprecated = 3 [default = false]; - - reserved 4, 5, 6; - - // NOTE: Do not set the option in .proto files. Always use the maps syntax - // instead. The option should only be implicitly set by the proto compiler - // parser. - // - // Whether the message is an automatically generated map entry type for the - // maps field. - // - // For maps fields: - // map map_field = 1; - // The parsed descriptor looks like: - // message MapFieldEntry { - // option map_entry = true; - // optional KeyType key = 1; - // optional ValueType value = 2; - // } - // repeated MapFieldEntry map_field = 1; - // - // Implementations may choose not to generate the map_entry=true message, but - // use a native map in the target language to hold the keys and values. - // The reflection APIs in such implementations still need to work as - // if the field is a repeated message field. - optional bool map_entry = 7; - - reserved 8; // javalite_serializable - reserved 9; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message FieldOptions { - // The ctype option instructs the C++ code generator to use a different - // representation of the field than it normally would. See the specific - // options below. This option is not yet implemented in the open source - // release -- sorry, we'll try to include it in a future version! - optional CType ctype = 1 [default = STRING]; - enum CType { - // Default mode. - STRING = 0; - - CORD = 1; - - STRING_PIECE = 2; - } - // The packed option can be enabled for repeated primitive fields to enable - // a more efficient representation on the wire. Rather than repeatedly - // writing the tag and type for each element, the entire array is encoded as - // a single length-delimited blob. In proto3, only explicit setting it to - // false will avoid using packed encoding. - optional bool packed = 2; - - // The jstype option determines the JavaScript type used for values of the - // field. The option is permitted only for 64 bit integral and fixed types - // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - // is represented as JavaScript string, which avoids loss of precision that - // can happen when a large value is converted to a floating point JavaScript. - // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - // use the JavaScript "number" type. The behavior of the default option - // JS_NORMAL is implementation dependent. - // - // This option is an enum to permit additional types to be added, e.g. - // goog.math.Integer. - optional JSType jstype = 6 [default = JS_NORMAL]; - enum JSType { - // Use the default type. - JS_NORMAL = 0; - - // Use JavaScript strings. - JS_STRING = 1; - - // Use JavaScript numbers. - JS_NUMBER = 2; - } - - // Should this field be parsed lazily? Lazy applies only to message-type - // fields. It means that when the outer message is initially parsed, the - // inner message's contents will not be parsed but instead stored in encoded - // form. The inner message will actually be parsed when it is first accessed. - // - // This is only a hint. Implementations are free to choose whether to use - // eager or lazy parsing regardless of the value of this option. However, - // setting this option true suggests that the protocol author believes that - // using lazy parsing on this field is worth the additional bookkeeping - // overhead typically needed to implement it. - // - // This option does not affect the public interface of any generated code; - // all method signatures remain the same. Furthermore, thread-safety of the - // interface is not affected by this option; const methods remain safe to - // call from multiple threads concurrently, while non-const methods continue - // to require exclusive access. - // - // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outer message - // may return true even if the inner message has missing required fields. - // This is necessary because otherwise the inner message would have to be - // parsed in order to perform the check, defeating the purpose of lazy - // parsing. An implementation which chooses not to check required fields - // must be consistent about it. That is, for any particular sub-message, the - // implementation must either *always* check its required fields, or *never* - // check its required fields, regardless of whether or not the message has - // been parsed. - // - // As of May 2022, lazy verifies the contents of the byte stream during - // parsing. An invalid byte stream will cause the overall parsing to fail. - optional bool lazy = 5 [default = false]; - - // unverified_lazy does no correctness checks on the byte stream. This should - // only be used where lazy with verification is prohibitive for performance - // reasons. - optional bool unverified_lazy = 15 [default = false]; - - // Is this field deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for accessors, or it will be completely ignored; in the very least, this - // is a formalization for deprecating fields. - optional bool deprecated = 3 [default = false]; - - // For Google-internal migration only. Do not use. - optional bool weak = 10 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; - - reserved 4; // removed jtype -} - -message OneofOptions { - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumOptions { - - // Set this option to true to allow mapping different tag names to the same - // value. - optional bool allow_alias = 2; - - // Is this enum deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum, or it will be completely ignored; in the very least, this - // is a formalization for deprecating enums. - optional bool deprecated = 3 [default = false]; - - reserved 5; // javanano_as_lite - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message EnumValueOptions { - // Is this enum value deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the enum value, or it will be completely ignored; in the very least, - // this is a formalization for deprecating enum values. - optional bool deprecated = 1 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message ServiceOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this service deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the service, or it will be completely ignored; in the very least, - // this is a formalization for deprecating services. - optional bool deprecated = 33 [default = false]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -message MethodOptions { - - // Note: Field numbers 1 through 32 are reserved for Google's internal RPC - // framework. We apologize for hoarding these numbers to ourselves, but - // we were already using them long before we decided to release Protocol - // Buffers. - - // Is this method deprecated? - // Depending on the target platform, this can emit Deprecated annotations - // for the method, or it will be completely ignored; in the very least, - // this is a formalization for deprecating methods. - optional bool deprecated = 33 [default = false]; - - // Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - // or neither? HTTP based RPC implementation may choose GET verb for safe - // methods, and PUT verb for idempotent methods instead of the default POST. - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0; - NO_SIDE_EFFECTS = 1; // implies idempotent - IDEMPOTENT = 2; // idempotent, but may have side effects - } - optional IdempotencyLevel idempotency_level = 34 - [default = IDEMPOTENCY_UNKNOWN]; - - // The parser stores options it doesn't recognize here. See above. - repeated UninterpretedOption uninterpreted_option = 999; - - // Clients can define custom options in extensions of this message. See above. - extensions 1000 to max; -} - -// A message representing a option the parser does not recognize. This only -// appears in options protos created by the compiler::Parser class. -// DescriptorPool resolves these when building Descriptor objects. Therefore, -// options protos in descriptor objects (e.g. returned by Descriptor::options(), -// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -// in them. -message UninterpretedOption { - // The name of the uninterpreted option. Each string represents a segment in - // a dot-separated name. is_extension is true iff a segment represents an - // extension (denoted with parentheses in options specs in .proto files). - // E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents - // "foo.(bar.baz).moo". - message NamePart { - required string name_part = 1; - required bool is_extension = 2; - } - repeated NamePart name = 2; - - // The value of the uninterpreted option, in whatever type the tokenizer - // identified it as during parsing. Exactly one of these should be set. - optional string identifier_value = 3; - optional uint64 positive_int_value = 4; - optional int64 negative_int_value = 5; - optional double double_value = 6; - optional bytes string_value = 7; - optional string aggregate_value = 8; -} - -// =================================================================== -// Optional source code info - -// Encapsulates information about the original source file from which a -// FileDescriptorProto was generated. -message SourceCodeInfo { - // A Location identifies a piece of source code in a .proto file which - // corresponds to a particular definition. This information is intended - // to be useful to IDEs, code indexers, documentation generators, and similar - // tools. - // - // For example, say we have a file like: - // message Foo { - // optional string foo = 1; - // } - // Let's look at just the field definition: - // optional string foo = 1; - // ^ ^^ ^^ ^ ^^^ - // a bc de f ghi - // We have the following locations: - // span path represents - // [a,i) [ 4, 0, 2, 0 ] The whole field definition. - // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - // - // Notes: - // - A location may refer to a repeated field itself (i.e. not to any - // particular index within it). This is used whenever a set of elements are - // logically enclosed in a single code segment. For example, an entire - // extend block (possibly containing multiple extension definitions) will - // have an outer location whose path refers to the "extensions" repeated - // field without an index. - // - Multiple locations may have the same path. This happens when a single - // logical declaration is spread out across multiple places. The most - // obvious example is the "extend" block again -- there may be multiple - // extend blocks in the same scope, each of which will have the same path. - // - A location's span is not always a subset of its parent's span. For - // example, the "extendee" of an extension declaration appears at the - // beginning of the "extend" block and is shared by all extensions within - // the block. - // - Just because a location's span is a subset of some other location's span - // does not mean that it is a descendant. For example, a "group" defines - // both a type and a field in a single declaration. Thus, the locations - // corresponding to the type and field and their components will overlap. - // - Code which tries to interpret locations should probably be designed to - // ignore those that it doesn't understand, as more types of locations could - // be recorded in the future. - repeated Location location = 1; - message Location { - // Identifies which part of the FileDescriptorProto was defined at this - // location. - // - // Each element is a field number or an index. They form a path from - // the root FileDescriptorProto to the place where the definition occurs. - // For example, this path: - // [ 4, 3, 2, 7, 1 ] - // refers to: - // file.message_type(3) // 4, 3 - // .field(7) // 2, 7 - // .name() // 1 - // This is because FileDescriptorProto.message_type has field number 4: - // repeated DescriptorProto message_type = 4; - // and DescriptorProto.field has field number 2: - // repeated FieldDescriptorProto field = 2; - // and FieldDescriptorProto.name has field number 1: - // optional string name = 1; - // - // Thus, the above path gives the location of a field name. If we removed - // the last element: - // [ 4, 3, 2, 7 ] - // this path refers to the whole field declaration (from the beginning - // of the label to the terminating semicolon). - repeated int32 path = 1 [packed = true]; - - // Always has exactly three or four elements: start line, start column, - // end line (optional, otherwise assumed same as start line), end column. - // These are packed into a single field for efficiency. Note that line - // and column numbers are zero-based -- typically you will want to add - // 1 to each before displaying to a user. - repeated int32 span = 2 [packed = true]; - - // If this SourceCodeInfo represents a complete declaration, these are any - // comments appearing before and after the declaration which appear to be - // attached to the declaration. - // - // A series of line comments appearing on consecutive lines, with no other - // tokens appearing on those lines, will be treated as a single comment. - // - // leading_detached_comments will keep paragraphs of comments that appear - // before (but not connected to) the current element. Each paragraph, - // separated by empty lines, will be one comment element in the repeated - // field. - // - // Only the comment content is provided; comment markers (e.g. //) are - // stripped out. For block comments, leading whitespace and an asterisk - // will be stripped from the beginning of each line other than the first. - // Newlines are included in the output. - // - // Examples: - // - // optional int32 foo = 1; // Comment attached to foo. - // // Comment attached to bar. - // optional int32 bar = 2; - // - // optional string baz = 3; - // // Comment attached to baz. - // // Another line attached to baz. - // - // // Comment attached to moo. - // // - // // Another line attached to moo. - // optional double moo = 4; - // - // // Detached comment for corge. This is not leading or trailing comments - // // to moo or corge because there are blank lines separating it from - // // both. - // - // // Detached comment for corge paragraph 2. - // - // optional string corge = 5; - // /* Block comment attached - // * to corge. Leading asterisks - // * will be removed. */ - // /* Block comment attached to - // * grault. */ - // optional int32 grault = 6; - // - // // ignored detached comments. - optional string leading_comments = 3; - optional string trailing_comments = 4; - repeated string leading_detached_comments = 6; - } -} - -// Describes the relationship between generated code and its original source -// file. A GeneratedCodeInfo message is associated with only one generated -// source file, but may contain references to different source .proto files. -message GeneratedCodeInfo { - // An Annotation connects some span of text in generated code to an element - // of its generating .proto file. - repeated Annotation annotation = 1; - message Annotation { - // Identifies the element in the original source .proto file. This field - // is formatted the same as SourceCodeInfo.Location.path. - repeated int32 path = 1 [packed = true]; - - // Identifies the filesystem path to the original source .proto. - optional string source_file = 2; - - // Identifies the starting offset in bytes in the generated code - // that relates to the identified object. - optional int32 begin = 3; - - // Identifies the ending offset in bytes in the generated code that - // relates to the identified object. The end offset should be one past - // the last relevant byte (so the length of the text = end - begin). - optional int32 end = 4; - - // Represents the identified object's effect on the element in the original - // .proto file. - enum Semantic { - // There is no effect or the effect is indescribable. - NONE = 0; - // The element is set or otherwise mutated. - SET = 1; - // An alias to the element is returned. - ALIAS = 2; - } - optional Semantic semantic = 5; - } -} \ No newline at end of file diff --git a/Sources/LoggingLoki/Proto/gen/swift/descriptor.pb.swift b/Sources/LoggingLoki/Proto/gen/swift/descriptor.pb.swift deleted file mode 100644 index fe27717..0000000 --- a/Sources/LoggingLoki/Proto/gen/swift/descriptor.pb.swift +++ /dev/null @@ -1,4070 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: descriptor.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Author: kenton@google.com (Kenton Varda) -// Based on original Protocol Buffers design by -// Sanjay Ghemawat, Jeff Dean, and others. -// -// The messages in this file describe the definitions found in .proto files. -// A valid .proto file can be translated directly to a FileDescriptorProto -// without any other information (e.g. without reading its imports). - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// The protocol compiler can output a FileDescriptorSet containing the .proto -/// files it parses. -struct Google_Protobuf_FileDescriptorSet { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var file: [Google_Protobuf_FileDescriptorProto] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// Describes a complete .proto file. -struct Google_Protobuf_FileDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// file name, relative to root of source tree - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - /// e.g. "foo", "foo.bar", etc. - var package: String { - get {return _package ?? String()} - set {_package = newValue} - } - /// Returns true if `package` has been explicitly set. - var hasPackage: Bool {return self._package != nil} - /// Clears the value of `package`. Subsequent reads from it will return its default value. - mutating func clearPackage() {self._package = nil} - - /// Names of files imported by this file. - var dependency: [String] = [] - - /// Indexes of the public imported files in the dependency list above. - var publicDependency: [Int32] = [] - - /// Indexes of the weak imported files in the dependency list. - /// For Google-internal migration only. Do not use. - var weakDependency: [Int32] = [] - - /// All top-level definitions in this file. - var messageType: [Google_Protobuf_DescriptorProto] = [] - - var enumType: [Google_Protobuf_EnumDescriptorProto] = [] - - var service: [Google_Protobuf_ServiceDescriptorProto] = [] - - var `extension`: [Google_Protobuf_FieldDescriptorProto] = [] - - var options: Google_Protobuf_FileOptions { - get {return _options ?? Google_Protobuf_FileOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - /// This field contains optional information about the original source code. - /// You may safely remove this entire field without harming runtime - /// functionality of the descriptors -- the information is needed only by - /// development tools. - var sourceCodeInfo: Google_Protobuf_SourceCodeInfo { - get {return _sourceCodeInfo ?? Google_Protobuf_SourceCodeInfo()} - set {_sourceCodeInfo = newValue} - } - /// Returns true if `sourceCodeInfo` has been explicitly set. - var hasSourceCodeInfo: Bool {return self._sourceCodeInfo != nil} - /// Clears the value of `sourceCodeInfo`. Subsequent reads from it will return its default value. - mutating func clearSourceCodeInfo() {self._sourceCodeInfo = nil} - - /// The syntax of the proto file. - /// The supported values are "proto2", "proto3", and "editions". - /// - /// If `edition` is present, this value must be "editions". - var syntax: String { - get {return _syntax ?? String()} - set {_syntax = newValue} - } - /// Returns true if `syntax` has been explicitly set. - var hasSyntax: Bool {return self._syntax != nil} - /// Clears the value of `syntax`. Subsequent reads from it will return its default value. - mutating func clearSyntax() {self._syntax = nil} - - /// The edition of the proto file, which is an opaque string. - var edition: String { - get {return _edition ?? String()} - set {_edition = newValue} - } - /// Returns true if `edition` has been explicitly set. - var hasEdition: Bool {return self._edition != nil} - /// Clears the value of `edition`. Subsequent reads from it will return its default value. - mutating func clearEdition() {self._edition = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _package: String? = nil - fileprivate var _options: Google_Protobuf_FileOptions? = nil - fileprivate var _sourceCodeInfo: Google_Protobuf_SourceCodeInfo? = nil - fileprivate var _syntax: String? = nil - fileprivate var _edition: String? = nil -} - -/// Describes a message type. -struct Google_Protobuf_DescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - var field: [Google_Protobuf_FieldDescriptorProto] = [] - - var `extension`: [Google_Protobuf_FieldDescriptorProto] = [] - - var nestedType: [Google_Protobuf_DescriptorProto] = [] - - var enumType: [Google_Protobuf_EnumDescriptorProto] = [] - - var extensionRange: [Google_Protobuf_DescriptorProto.ExtensionRange] = [] - - var oneofDecl: [Google_Protobuf_OneofDescriptorProto] = [] - - var options: Google_Protobuf_MessageOptions { - get {return _options ?? Google_Protobuf_MessageOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - var reservedRange: [Google_Protobuf_DescriptorProto.ReservedRange] = [] - - /// Reserved field names, which may not be used by fields in the same message. - /// A given name may only be reserved once. - var reservedName: [String] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - struct ExtensionRange { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Inclusive. - var start: Int32 { - get {return _start ?? 0} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - /// Exclusive. - var end: Int32 { - get {return _end ?? 0} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var options: Google_Protobuf_ExtensionRangeOptions { - get {return _options ?? Google_Protobuf_ExtensionRangeOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: Int32? = nil - fileprivate var _end: Int32? = nil - fileprivate var _options: Google_Protobuf_ExtensionRangeOptions? = nil - } - - /// Range of reserved tag numbers. Reserved tag numbers may not be used by - /// fields or extension ranges in the same message. Reserved ranges may - /// not overlap. - struct ReservedRange { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Inclusive. - var start: Int32 { - get {return _start ?? 0} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - /// Exclusive. - var end: Int32 { - get {return _end ?? 0} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: Int32? = nil - fileprivate var _end: Int32? = nil - } - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _options: Google_Protobuf_MessageOptions? = nil -} - -struct Google_Protobuf_ExtensionRangeOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() -} - -/// Describes a field within a message. -struct Google_Protobuf_FieldDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _storage._name ?? String()} - set {_uniqueStorage()._name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return _storage._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {_uniqueStorage()._name = nil} - - var number: Int32 { - get {return _storage._number ?? 0} - set {_uniqueStorage()._number = newValue} - } - /// Returns true if `number` has been explicitly set. - var hasNumber: Bool {return _storage._number != nil} - /// Clears the value of `number`. Subsequent reads from it will return its default value. - mutating func clearNumber() {_uniqueStorage()._number = nil} - - var label: Google_Protobuf_FieldDescriptorProto.Label { - get {return _storage._label ?? .optional} - set {_uniqueStorage()._label = newValue} - } - /// Returns true if `label` has been explicitly set. - var hasLabel: Bool {return _storage._label != nil} - /// Clears the value of `label`. Subsequent reads from it will return its default value. - mutating func clearLabel() {_uniqueStorage()._label = nil} - - /// If type_name is set, this need not be set. If both this and type_name - /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. - var type: Google_Protobuf_FieldDescriptorProto.TypeEnum { - get {return _storage._type ?? .double} - set {_uniqueStorage()._type = newValue} - } - /// Returns true if `type` has been explicitly set. - var hasType: Bool {return _storage._type != nil} - /// Clears the value of `type`. Subsequent reads from it will return its default value. - mutating func clearType() {_uniqueStorage()._type = nil} - - /// For message and enum types, this is the name of the type. If the name - /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping - /// rules are used to find the type (i.e. first the nested types within this - /// message are searched, then within the parent, on up to the root - /// namespace). - var typeName: String { - get {return _storage._typeName ?? String()} - set {_uniqueStorage()._typeName = newValue} - } - /// Returns true if `typeName` has been explicitly set. - var hasTypeName: Bool {return _storage._typeName != nil} - /// Clears the value of `typeName`. Subsequent reads from it will return its default value. - mutating func clearTypeName() {_uniqueStorage()._typeName = nil} - - /// For extensions, this is the name of the type being extended. It is - /// resolved in the same manner as type_name. - var extendee: String { - get {return _storage._extendee ?? String()} - set {_uniqueStorage()._extendee = newValue} - } - /// Returns true if `extendee` has been explicitly set. - var hasExtendee: Bool {return _storage._extendee != nil} - /// Clears the value of `extendee`. Subsequent reads from it will return its default value. - mutating func clearExtendee() {_uniqueStorage()._extendee = nil} - - /// For numeric types, contains the original text representation of the value. - /// For booleans, "true" or "false". - /// For strings, contains the default text contents (not escaped in any way). - /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. - var defaultValue: String { - get {return _storage._defaultValue ?? String()} - set {_uniqueStorage()._defaultValue = newValue} - } - /// Returns true if `defaultValue` has been explicitly set. - var hasDefaultValue: Bool {return _storage._defaultValue != nil} - /// Clears the value of `defaultValue`. Subsequent reads from it will return its default value. - mutating func clearDefaultValue() {_uniqueStorage()._defaultValue = nil} - - /// If set, gives the index of a oneof in the containing type's oneof_decl - /// list. This field is a member of that oneof. - var oneofIndex: Int32 { - get {return _storage._oneofIndex ?? 0} - set {_uniqueStorage()._oneofIndex = newValue} - } - /// Returns true if `oneofIndex` has been explicitly set. - var hasOneofIndex: Bool {return _storage._oneofIndex != nil} - /// Clears the value of `oneofIndex`. Subsequent reads from it will return its default value. - mutating func clearOneofIndex() {_uniqueStorage()._oneofIndex = nil} - - /// JSON name of this field. The value is set by protocol compiler. If the - /// user has set a "json_name" option on this field, that option's value - /// will be used. Otherwise, it's deduced from the field's name by converting - /// it to camelCase. - var jsonName: String { - get {return _storage._jsonName ?? String()} - set {_uniqueStorage()._jsonName = newValue} - } - /// Returns true if `jsonName` has been explicitly set. - var hasJsonName: Bool {return _storage._jsonName != nil} - /// Clears the value of `jsonName`. Subsequent reads from it will return its default value. - mutating func clearJsonName() {_uniqueStorage()._jsonName = nil} - - var options: Google_Protobuf_FieldOptions { - get {return _storage._options ?? Google_Protobuf_FieldOptions()} - set {_uniqueStorage()._options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return _storage._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {_uniqueStorage()._options = nil} - - /// If true, this is a proto3 "optional". When a proto3 field is optional, it - /// tracks presence regardless of field type. - /// - /// When proto3_optional is true, this field must be belong to a oneof to - /// signal to old proto3 clients that presence is tracked for this field. This - /// oneof is known as a "synthetic" oneof, and this field must be its sole - /// member (each proto3 optional field gets its own synthetic oneof). Synthetic - /// oneofs exist in the descriptor only, and do not generate any API. Synthetic - /// oneofs must be ordered after all "real" oneofs. - /// - /// For message fields, proto3_optional doesn't create any semantic change, - /// since non-repeated message fields always track presence. However it still - /// indicates the semantic detail of whether the user wrote "optional" or not. - /// This can be useful for round-tripping the .proto file. For consistency we - /// give message fields a synthetic oneof also, even though it is not required - /// to track presence. This is especially important because the parser can't - /// tell if a field is a message or an enum, so it must always create a - /// synthetic oneof. - /// - /// Proto2 optional fields do not set this flag, because they already indicate - /// optional with `LABEL_OPTIONAL`. - var proto3Optional: Bool { - get {return _storage._proto3Optional ?? false} - set {_uniqueStorage()._proto3Optional = newValue} - } - /// Returns true if `proto3Optional` has been explicitly set. - var hasProto3Optional: Bool {return _storage._proto3Optional != nil} - /// Clears the value of `proto3Optional`. Subsequent reads from it will return its default value. - mutating func clearProto3Optional() {_uniqueStorage()._proto3Optional = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - enum TypeEnum: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// 0 is reserved for errors. - /// Order is weird for historical reasons. - case double // = 1 - case float // = 2 - - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if - /// negative values are likely. - case int64 // = 3 - case uint64 // = 4 - - /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if - /// negative values are likely. - case int32 // = 5 - case fixed64 // = 6 - case fixed32 // = 7 - case bool // = 8 - case string // = 9 - - /// Tag-delimited aggregate. - /// Group type is deprecated and not supported in proto3. However, Proto3 - /// implementations should still be able to parse the group wire format and - /// treat group fields as unknown fields. - case group // = 10 - - /// Length-delimited aggregate. - case message // = 11 - - /// New in version 2. - case bytes // = 12 - case uint32 // = 13 - case `enum` // = 14 - case sfixed32 // = 15 - case sfixed64 // = 16 - - /// Uses ZigZag encoding. - case sint32 // = 17 - - /// Uses ZigZag encoding. - case sint64 // = 18 - - init() { - self = .double - } - - init?(rawValue: Int) { - switch rawValue { - case 1: self = .double - case 2: self = .float - case 3: self = .int64 - case 4: self = .uint64 - case 5: self = .int32 - case 6: self = .fixed64 - case 7: self = .fixed32 - case 8: self = .bool - case 9: self = .string - case 10: self = .group - case 11: self = .message - case 12: self = .bytes - case 13: self = .uint32 - case 14: self = .enum - case 15: self = .sfixed32 - case 16: self = .sfixed64 - case 17: self = .sint32 - case 18: self = .sint64 - default: return nil - } - } - - var rawValue: Int { - switch self { - case .double: return 1 - case .float: return 2 - case .int64: return 3 - case .uint64: return 4 - case .int32: return 5 - case .fixed64: return 6 - case .fixed32: return 7 - case .bool: return 8 - case .string: return 9 - case .group: return 10 - case .message: return 11 - case .bytes: return 12 - case .uint32: return 13 - case .enum: return 14 - case .sfixed32: return 15 - case .sfixed64: return 16 - case .sint32: return 17 - case .sint64: return 18 - } - } - - } - - enum Label: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// 0 is reserved for errors - case `optional` // = 1 - case `required` // = 2 - case repeated // = 3 - - init() { - self = .optional - } - - init?(rawValue: Int) { - switch rawValue { - case 1: self = .optional - case 2: self = .required - case 3: self = .repeated - default: return nil - } - } - - var rawValue: Int { - switch self { - case .optional: return 1 - case .required: return 2 - case .repeated: return 3 - } - } - - } - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -#if swift(>=4.2) - -extension Google_Protobuf_FieldDescriptorProto.TypeEnum: CaseIterable { - // Support synthesized by the compiler. -} - -extension Google_Protobuf_FieldDescriptorProto.Label: CaseIterable { - // Support synthesized by the compiler. -} - -#endif // swift(>=4.2) - -/// Describes a oneof. -struct Google_Protobuf_OneofDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - var options: Google_Protobuf_OneofOptions { - get {return _options ?? Google_Protobuf_OneofOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _options: Google_Protobuf_OneofOptions? = nil -} - -/// Describes an enum type. -struct Google_Protobuf_EnumDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - var value: [Google_Protobuf_EnumValueDescriptorProto] = [] - - var options: Google_Protobuf_EnumOptions { - get {return _options ?? Google_Protobuf_EnumOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - /// Range of reserved numeric values. Reserved numeric values may not be used - /// by enum values in the same enum declaration. Reserved ranges may not - /// overlap. - var reservedRange: [Google_Protobuf_EnumDescriptorProto.EnumReservedRange] = [] - - /// Reserved enum value names, which may not be reused. A given name may only - /// be reserved once. - var reservedName: [String] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// Range of reserved numeric values. Reserved values may not be used by - /// entries in the same enum. Reserved ranges may not overlap. - /// - /// Note that this is distinct from DescriptorProto.ReservedRange in that it - /// is inclusive such that it can appropriately represent the entire int32 - /// domain. - struct EnumReservedRange { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Inclusive. - var start: Int32 { - get {return _start ?? 0} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - /// Inclusive. - var end: Int32 { - get {return _end ?? 0} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: Int32? = nil - fileprivate var _end: Int32? = nil - } - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _options: Google_Protobuf_EnumOptions? = nil -} - -/// Describes a value within an enum. -struct Google_Protobuf_EnumValueDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - var number: Int32 { - get {return _number ?? 0} - set {_number = newValue} - } - /// Returns true if `number` has been explicitly set. - var hasNumber: Bool {return self._number != nil} - /// Clears the value of `number`. Subsequent reads from it will return its default value. - mutating func clearNumber() {self._number = nil} - - var options: Google_Protobuf_EnumValueOptions { - get {return _options ?? Google_Protobuf_EnumValueOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _number: Int32? = nil - fileprivate var _options: Google_Protobuf_EnumValueOptions? = nil -} - -/// Describes a service. -struct Google_Protobuf_ServiceDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - var method: [Google_Protobuf_MethodDescriptorProto] = [] - - var options: Google_Protobuf_ServiceOptions { - get {return _options ?? Google_Protobuf_ServiceOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _options: Google_Protobuf_ServiceOptions? = nil -} - -/// Describes a method of a service. -struct Google_Protobuf_MethodDescriptorProto { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String { - get {return _name ?? String()} - set {_name = newValue} - } - /// Returns true if `name` has been explicitly set. - var hasName: Bool {return self._name != nil} - /// Clears the value of `name`. Subsequent reads from it will return its default value. - mutating func clearName() {self._name = nil} - - /// Input and output type names. These are resolved in the same way as - /// FieldDescriptorProto.type_name, but must refer to a message type. - var inputType: String { - get {return _inputType ?? String()} - set {_inputType = newValue} - } - /// Returns true if `inputType` has been explicitly set. - var hasInputType: Bool {return self._inputType != nil} - /// Clears the value of `inputType`. Subsequent reads from it will return its default value. - mutating func clearInputType() {self._inputType = nil} - - var outputType: String { - get {return _outputType ?? String()} - set {_outputType = newValue} - } - /// Returns true if `outputType` has been explicitly set. - var hasOutputType: Bool {return self._outputType != nil} - /// Clears the value of `outputType`. Subsequent reads from it will return its default value. - mutating func clearOutputType() {self._outputType = nil} - - var options: Google_Protobuf_MethodOptions { - get {return _options ?? Google_Protobuf_MethodOptions()} - set {_options = newValue} - } - /// Returns true if `options` has been explicitly set. - var hasOptions: Bool {return self._options != nil} - /// Clears the value of `options`. Subsequent reads from it will return its default value. - mutating func clearOptions() {self._options = nil} - - /// Identifies if client streams multiple client messages - var clientStreaming: Bool { - get {return _clientStreaming ?? false} - set {_clientStreaming = newValue} - } - /// Returns true if `clientStreaming` has been explicitly set. - var hasClientStreaming: Bool {return self._clientStreaming != nil} - /// Clears the value of `clientStreaming`. Subsequent reads from it will return its default value. - mutating func clearClientStreaming() {self._clientStreaming = nil} - - /// Identifies if server streams multiple server messages - var serverStreaming: Bool { - get {return _serverStreaming ?? false} - set {_serverStreaming = newValue} - } - /// Returns true if `serverStreaming` has been explicitly set. - var hasServerStreaming: Bool {return self._serverStreaming != nil} - /// Clears the value of `serverStreaming`. Subsequent reads from it will return its default value. - mutating func clearServerStreaming() {self._serverStreaming = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _name: String? = nil - fileprivate var _inputType: String? = nil - fileprivate var _outputType: String? = nil - fileprivate var _options: Google_Protobuf_MethodOptions? = nil - fileprivate var _clientStreaming: Bool? = nil - fileprivate var _serverStreaming: Bool? = nil -} - -struct Google_Protobuf_FileOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Sets the Java package where classes generated from this .proto will be - /// placed. By default, the proto package is used, but this is often - /// inappropriate because proto packages do not normally start with backwards - /// domain names. - var javaPackage: String { - get {return _storage._javaPackage ?? String()} - set {_uniqueStorage()._javaPackage = newValue} - } - /// Returns true if `javaPackage` has been explicitly set. - var hasJavaPackage: Bool {return _storage._javaPackage != nil} - /// Clears the value of `javaPackage`. Subsequent reads from it will return its default value. - mutating func clearJavaPackage() {_uniqueStorage()._javaPackage = nil} - - /// Controls the name of the wrapper Java class generated for the .proto file. - /// That class will always contain the .proto file's getDescriptor() method as - /// well as any top-level extensions defined in the .proto file. - /// If java_multiple_files is disabled, then all the other classes from the - /// .proto file will be nested inside the single wrapper outer class. - var javaOuterClassname: String { - get {return _storage._javaOuterClassname ?? String()} - set {_uniqueStorage()._javaOuterClassname = newValue} - } - /// Returns true if `javaOuterClassname` has been explicitly set. - var hasJavaOuterClassname: Bool {return _storage._javaOuterClassname != nil} - /// Clears the value of `javaOuterClassname`. Subsequent reads from it will return its default value. - mutating func clearJavaOuterClassname() {_uniqueStorage()._javaOuterClassname = nil} - - /// If enabled, then the Java code generator will generate a separate .java - /// file for each top-level message, enum, and service defined in the .proto - /// file. Thus, these types will *not* be nested inside the wrapper class - /// named by java_outer_classname. However, the wrapper class will still be - /// generated to contain the file's getDescriptor() method as well as any - /// top-level extensions defined in the file. - var javaMultipleFiles: Bool { - get {return _storage._javaMultipleFiles ?? false} - set {_uniqueStorage()._javaMultipleFiles = newValue} - } - /// Returns true if `javaMultipleFiles` has been explicitly set. - var hasJavaMultipleFiles: Bool {return _storage._javaMultipleFiles != nil} - /// Clears the value of `javaMultipleFiles`. Subsequent reads from it will return its default value. - mutating func clearJavaMultipleFiles() {_uniqueStorage()._javaMultipleFiles = nil} - - /// This option does nothing. - var javaGenerateEqualsAndHash: Bool { - get {return _storage._javaGenerateEqualsAndHash ?? false} - set {_uniqueStorage()._javaGenerateEqualsAndHash = newValue} - } - /// Returns true if `javaGenerateEqualsAndHash` has been explicitly set. - var hasJavaGenerateEqualsAndHash: Bool {return _storage._javaGenerateEqualsAndHash != nil} - /// Clears the value of `javaGenerateEqualsAndHash`. Subsequent reads from it will return its default value. - mutating func clearJavaGenerateEqualsAndHash() {_uniqueStorage()._javaGenerateEqualsAndHash = nil} - - /// If set true, then the Java2 code generator will generate code that - /// throws an exception whenever an attempt is made to assign a non-UTF-8 - /// byte sequence to a string field. - /// Message reflection will do the same. - /// However, an extension field still accepts non-UTF-8 byte sequences. - /// This option has no effect on when used with the lite runtime. - var javaStringCheckUtf8: Bool { - get {return _storage._javaStringCheckUtf8 ?? false} - set {_uniqueStorage()._javaStringCheckUtf8 = newValue} - } - /// Returns true if `javaStringCheckUtf8` has been explicitly set. - var hasJavaStringCheckUtf8: Bool {return _storage._javaStringCheckUtf8 != nil} - /// Clears the value of `javaStringCheckUtf8`. Subsequent reads from it will return its default value. - mutating func clearJavaStringCheckUtf8() {_uniqueStorage()._javaStringCheckUtf8 = nil} - - var optimizeFor: Google_Protobuf_FileOptions.OptimizeMode { - get {return _storage._optimizeFor ?? .speed} - set {_uniqueStorage()._optimizeFor = newValue} - } - /// Returns true if `optimizeFor` has been explicitly set. - var hasOptimizeFor: Bool {return _storage._optimizeFor != nil} - /// Clears the value of `optimizeFor`. Subsequent reads from it will return its default value. - mutating func clearOptimizeFor() {_uniqueStorage()._optimizeFor = nil} - - /// Sets the Go package where structs generated from this .proto will be - /// placed. If omitted, the Go package will be derived from the following: - /// - The basename of the package import path, if provided. - /// - Otherwise, the package statement in the .proto file, if present. - /// - Otherwise, the basename of the .proto file, without extension. - var goPackage: String { - get {return _storage._goPackage ?? String()} - set {_uniqueStorage()._goPackage = newValue} - } - /// Returns true if `goPackage` has been explicitly set. - var hasGoPackage: Bool {return _storage._goPackage != nil} - /// Clears the value of `goPackage`. Subsequent reads from it will return its default value. - mutating func clearGoPackage() {_uniqueStorage()._goPackage = nil} - - /// Should generic services be generated in each language? "Generic" services - /// are not specific to any particular RPC system. They are generated by the - /// main code generators in each language (without additional plugins). - /// Generic services were the only kind of service generation supported by - /// early versions of google.protobuf. - /// - /// Generic services are now considered deprecated in favor of using plugins - /// that generate code specific to your particular RPC system. Therefore, - /// these default to false. Old code which depends on generic services should - /// explicitly set them to true. - var ccGenericServices: Bool { - get {return _storage._ccGenericServices ?? false} - set {_uniqueStorage()._ccGenericServices = newValue} - } - /// Returns true if `ccGenericServices` has been explicitly set. - var hasCcGenericServices: Bool {return _storage._ccGenericServices != nil} - /// Clears the value of `ccGenericServices`. Subsequent reads from it will return its default value. - mutating func clearCcGenericServices() {_uniqueStorage()._ccGenericServices = nil} - - var javaGenericServices: Bool { - get {return _storage._javaGenericServices ?? false} - set {_uniqueStorage()._javaGenericServices = newValue} - } - /// Returns true if `javaGenericServices` has been explicitly set. - var hasJavaGenericServices: Bool {return _storage._javaGenericServices != nil} - /// Clears the value of `javaGenericServices`. Subsequent reads from it will return its default value. - mutating func clearJavaGenericServices() {_uniqueStorage()._javaGenericServices = nil} - - var pyGenericServices: Bool { - get {return _storage._pyGenericServices ?? false} - set {_uniqueStorage()._pyGenericServices = newValue} - } - /// Returns true if `pyGenericServices` has been explicitly set. - var hasPyGenericServices: Bool {return _storage._pyGenericServices != nil} - /// Clears the value of `pyGenericServices`. Subsequent reads from it will return its default value. - mutating func clearPyGenericServices() {_uniqueStorage()._pyGenericServices = nil} - - var phpGenericServices: Bool { - get {return _storage._phpGenericServices ?? false} - set {_uniqueStorage()._phpGenericServices = newValue} - } - /// Returns true if `phpGenericServices` has been explicitly set. - var hasPhpGenericServices: Bool {return _storage._phpGenericServices != nil} - /// Clears the value of `phpGenericServices`. Subsequent reads from it will return its default value. - mutating func clearPhpGenericServices() {_uniqueStorage()._phpGenericServices = nil} - - /// Is this file deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for everything in the file, or it will be completely ignored; in the very - /// least, this is a formalization for deprecating files. - var deprecated: Bool { - get {return _storage._deprecated ?? false} - set {_uniqueStorage()._deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return _storage._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {_uniqueStorage()._deprecated = nil} - - /// Enables the use of arenas for the proto messages in this file. This applies - /// only to generated classes for C++. - var ccEnableArenas: Bool { - get {return _storage._ccEnableArenas ?? true} - set {_uniqueStorage()._ccEnableArenas = newValue} - } - /// Returns true if `ccEnableArenas` has been explicitly set. - var hasCcEnableArenas: Bool {return _storage._ccEnableArenas != nil} - /// Clears the value of `ccEnableArenas`. Subsequent reads from it will return its default value. - mutating func clearCcEnableArenas() {_uniqueStorage()._ccEnableArenas = nil} - - /// Sets the objective c class prefix which is prepended to all objective c - /// generated classes from this .proto. There is no default. - var objcClassPrefix: String { - get {return _storage._objcClassPrefix ?? String()} - set {_uniqueStorage()._objcClassPrefix = newValue} - } - /// Returns true if `objcClassPrefix` has been explicitly set. - var hasObjcClassPrefix: Bool {return _storage._objcClassPrefix != nil} - /// Clears the value of `objcClassPrefix`. Subsequent reads from it will return its default value. - mutating func clearObjcClassPrefix() {_uniqueStorage()._objcClassPrefix = nil} - - /// Namespace for generated classes; defaults to the package. - var csharpNamespace: String { - get {return _storage._csharpNamespace ?? String()} - set {_uniqueStorage()._csharpNamespace = newValue} - } - /// Returns true if `csharpNamespace` has been explicitly set. - var hasCsharpNamespace: Bool {return _storage._csharpNamespace != nil} - /// Clears the value of `csharpNamespace`. Subsequent reads from it will return its default value. - mutating func clearCsharpNamespace() {_uniqueStorage()._csharpNamespace = nil} - - /// By default Swift generators will take the proto package and CamelCase it - /// replacing '.' with underscore and use that to prefix the types/symbols - /// defined. When this options is provided, they will use this value instead - /// to prefix the types/symbols defined. - var swiftPrefix: String { - get {return _storage._swiftPrefix ?? String()} - set {_uniqueStorage()._swiftPrefix = newValue} - } - /// Returns true if `swiftPrefix` has been explicitly set. - var hasSwiftPrefix: Bool {return _storage._swiftPrefix != nil} - /// Clears the value of `swiftPrefix`. Subsequent reads from it will return its default value. - mutating func clearSwiftPrefix() {_uniqueStorage()._swiftPrefix = nil} - - /// Sets the php class prefix which is prepended to all php generated classes - /// from this .proto. Default is empty. - var phpClassPrefix: String { - get {return _storage._phpClassPrefix ?? String()} - set {_uniqueStorage()._phpClassPrefix = newValue} - } - /// Returns true if `phpClassPrefix` has been explicitly set. - var hasPhpClassPrefix: Bool {return _storage._phpClassPrefix != nil} - /// Clears the value of `phpClassPrefix`. Subsequent reads from it will return its default value. - mutating func clearPhpClassPrefix() {_uniqueStorage()._phpClassPrefix = nil} - - /// Use this option to change the namespace of php generated classes. Default - /// is empty. When this option is empty, the package name will be used for - /// determining the namespace. - var phpNamespace: String { - get {return _storage._phpNamespace ?? String()} - set {_uniqueStorage()._phpNamespace = newValue} - } - /// Returns true if `phpNamespace` has been explicitly set. - var hasPhpNamespace: Bool {return _storage._phpNamespace != nil} - /// Clears the value of `phpNamespace`. Subsequent reads from it will return its default value. - mutating func clearPhpNamespace() {_uniqueStorage()._phpNamespace = nil} - - /// Use this option to change the namespace of php generated metadata classes. - /// Default is empty. When this option is empty, the proto file name will be - /// used for determining the namespace. - var phpMetadataNamespace: String { - get {return _storage._phpMetadataNamespace ?? String()} - set {_uniqueStorage()._phpMetadataNamespace = newValue} - } - /// Returns true if `phpMetadataNamespace` has been explicitly set. - var hasPhpMetadataNamespace: Bool {return _storage._phpMetadataNamespace != nil} - /// Clears the value of `phpMetadataNamespace`. Subsequent reads from it will return its default value. - mutating func clearPhpMetadataNamespace() {_uniqueStorage()._phpMetadataNamespace = nil} - - /// Use this option to change the package of ruby generated classes. Default - /// is empty. When this option is not set, the package name will be used for - /// determining the ruby package. - var rubyPackage: String { - get {return _storage._rubyPackage ?? String()} - set {_uniqueStorage()._rubyPackage = newValue} - } - /// Returns true if `rubyPackage` has been explicitly set. - var hasRubyPackage: Bool {return _storage._rubyPackage != nil} - /// Clears the value of `rubyPackage`. Subsequent reads from it will return its default value. - mutating func clearRubyPackage() {_uniqueStorage()._rubyPackage = nil} - - /// The parser stores options it doesn't recognize here. - /// See the documentation for the "Options" section above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] { - get {return _storage._uninterpretedOption} - set {_uniqueStorage()._uninterpretedOption = newValue} - } - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// Generated classes can be optimized for speed or code size. - enum OptimizeMode: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// Generate complete code for parsing, serialization, - case speed // = 1 - - /// etc. - case codeSize // = 2 - - /// Generate code using MessageLite and the lite runtime. - case liteRuntime // = 3 - - init() { - self = .speed - } - - init?(rawValue: Int) { - switch rawValue { - case 1: self = .speed - case 2: self = .codeSize - case 3: self = .liteRuntime - default: return nil - } - } - - var rawValue: Int { - switch self { - case .speed: return 1 - case .codeSize: return 2 - case .liteRuntime: return 3 - } - } - - } - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _storage = _StorageClass.defaultInstance -} - -#if swift(>=4.2) - -extension Google_Protobuf_FileOptions.OptimizeMode: CaseIterable { - // Support synthesized by the compiler. -} - -#endif // swift(>=4.2) - -struct Google_Protobuf_MessageOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Set true to use the old proto1 MessageSet wire format for extensions. - /// This is provided for backwards-compatibility with the MessageSet wire - /// format. You should not use this for any other reason: It's less - /// efficient, has fewer features, and is more complicated. - /// - /// The message must be defined exactly as follows: - /// message Foo { - /// option message_set_wire_format = true; - /// extensions 4 to max; - /// } - /// Note that the message cannot have any defined fields; MessageSets only - /// have extensions. - /// - /// All extensions of your type must be singular messages; e.g. they cannot - /// be int32s, enums, or repeated messages. - /// - /// Because this is an option, the above two restrictions are not enforced by - /// the protocol compiler. - var messageSetWireFormat: Bool { - get {return _messageSetWireFormat ?? false} - set {_messageSetWireFormat = newValue} - } - /// Returns true if `messageSetWireFormat` has been explicitly set. - var hasMessageSetWireFormat: Bool {return self._messageSetWireFormat != nil} - /// Clears the value of `messageSetWireFormat`. Subsequent reads from it will return its default value. - mutating func clearMessageSetWireFormat() {self._messageSetWireFormat = nil} - - /// Disables the generation of the standard "descriptor()" accessor, which can - /// conflict with a field of the same name. This is meant to make migration - /// from proto1 easier; new code should avoid fields named "descriptor". - var noStandardDescriptorAccessor: Bool { - get {return _noStandardDescriptorAccessor ?? false} - set {_noStandardDescriptorAccessor = newValue} - } - /// Returns true if `noStandardDescriptorAccessor` has been explicitly set. - var hasNoStandardDescriptorAccessor: Bool {return self._noStandardDescriptorAccessor != nil} - /// Clears the value of `noStandardDescriptorAccessor`. Subsequent reads from it will return its default value. - mutating func clearNoStandardDescriptorAccessor() {self._noStandardDescriptorAccessor = nil} - - /// Is this message deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the message, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating messages. - var deprecated: Bool { - get {return _deprecated ?? false} - set {_deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return self._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {self._deprecated = nil} - - /// NOTE: Do not set the option in .proto files. Always use the maps syntax - /// instead. The option should only be implicitly set by the proto compiler - /// parser. - /// - /// Whether the message is an automatically generated map entry type for the - /// maps field. - /// - /// For maps fields: - /// map map_field = 1; - /// The parsed descriptor looks like: - /// message MapFieldEntry { - /// option map_entry = true; - /// optional KeyType key = 1; - /// optional ValueType value = 2; - /// } - /// repeated MapFieldEntry map_field = 1; - /// - /// Implementations may choose not to generate the map_entry=true message, but - /// use a native map in the target language to hold the keys and values. - /// The reflection APIs in such implementations still need to work as - /// if the field is a repeated message field. - var mapEntry: Bool { - get {return _mapEntry ?? false} - set {_mapEntry = newValue} - } - /// Returns true if `mapEntry` has been explicitly set. - var hasMapEntry: Bool {return self._mapEntry != nil} - /// Clears the value of `mapEntry`. Subsequent reads from it will return its default value. - mutating func clearMapEntry() {self._mapEntry = nil} - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _messageSetWireFormat: Bool? = nil - fileprivate var _noStandardDescriptorAccessor: Bool? = nil - fileprivate var _deprecated: Bool? = nil - fileprivate var _mapEntry: Bool? = nil -} - -struct Google_Protobuf_FieldOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The ctype option instructs the C++ code generator to use a different - /// representation of the field than it normally would. See the specific - /// options below. This option is not yet implemented in the open source - /// release -- sorry, we'll try to include it in a future version! - var ctype: Google_Protobuf_FieldOptions.CType { - get {return _ctype ?? .string} - set {_ctype = newValue} - } - /// Returns true if `ctype` has been explicitly set. - var hasCtype: Bool {return self._ctype != nil} - /// Clears the value of `ctype`. Subsequent reads from it will return its default value. - mutating func clearCtype() {self._ctype = nil} - - /// The packed option can be enabled for repeated primitive fields to enable - /// a more efficient representation on the wire. Rather than repeatedly - /// writing the tag and type for each element, the entire array is encoded as - /// a single length-delimited blob. In proto3, only explicit setting it to - /// false will avoid using packed encoding. - var packed: Bool { - get {return _packed ?? false} - set {_packed = newValue} - } - /// Returns true if `packed` has been explicitly set. - var hasPacked: Bool {return self._packed != nil} - /// Clears the value of `packed`. Subsequent reads from it will return its default value. - mutating func clearPacked() {self._packed = nil} - - /// The jstype option determines the JavaScript type used for values of the - /// field. The option is permitted only for 64 bit integral and fixed types - /// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING - /// is represented as JavaScript string, which avoids loss of precision that - /// can happen when a large value is converted to a floating point JavaScript. - /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to - /// use the JavaScript "number" type. The behavior of the default option - /// JS_NORMAL is implementation dependent. - /// - /// This option is an enum to permit additional types to be added, e.g. - /// goog.math.Integer. - var jstype: Google_Protobuf_FieldOptions.JSType { - get {return _jstype ?? .jsNormal} - set {_jstype = newValue} - } - /// Returns true if `jstype` has been explicitly set. - var hasJstype: Bool {return self._jstype != nil} - /// Clears the value of `jstype`. Subsequent reads from it will return its default value. - mutating func clearJstype() {self._jstype = nil} - - /// Should this field be parsed lazily? Lazy applies only to message-type - /// fields. It means that when the outer message is initially parsed, the - /// inner message's contents will not be parsed but instead stored in encoded - /// form. The inner message will actually be parsed when it is first accessed. - /// - /// This is only a hint. Implementations are free to choose whether to use - /// eager or lazy parsing regardless of the value of this option. However, - /// setting this option true suggests that the protocol author believes that - /// using lazy parsing on this field is worth the additional bookkeeping - /// overhead typically needed to implement it. - /// - /// This option does not affect the public interface of any generated code; - /// all method signatures remain the same. Furthermore, thread-safety of the - /// interface is not affected by this option; const methods remain safe to - /// call from multiple threads concurrently, while non-const methods continue - /// to require exclusive access. - /// - /// Note that implementations may choose not to check required fields within - /// a lazy sub-message. That is, calling IsInitialized() on the outer message - /// may return true even if the inner message has missing required fields. - /// This is necessary because otherwise the inner message would have to be - /// parsed in order to perform the check, defeating the purpose of lazy - /// parsing. An implementation which chooses not to check required fields - /// must be consistent about it. That is, for any particular sub-message, the - /// implementation must either *always* check its required fields, or *never* - /// check its required fields, regardless of whether or not the message has - /// been parsed. - /// - /// As of May 2022, lazy verifies the contents of the byte stream during - /// parsing. An invalid byte stream will cause the overall parsing to fail. - var lazy: Bool { - get {return _lazy ?? false} - set {_lazy = newValue} - } - /// Returns true if `lazy` has been explicitly set. - var hasLazy: Bool {return self._lazy != nil} - /// Clears the value of `lazy`. Subsequent reads from it will return its default value. - mutating func clearLazy() {self._lazy = nil} - - /// unverified_lazy does no correctness checks on the byte stream. This should - /// only be used where lazy with verification is prohibitive for performance - /// reasons. - var unverifiedLazy: Bool { - get {return _unverifiedLazy ?? false} - set {_unverifiedLazy = newValue} - } - /// Returns true if `unverifiedLazy` has been explicitly set. - var hasUnverifiedLazy: Bool {return self._unverifiedLazy != nil} - /// Clears the value of `unverifiedLazy`. Subsequent reads from it will return its default value. - mutating func clearUnverifiedLazy() {self._unverifiedLazy = nil} - - /// Is this field deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for accessors, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating fields. - var deprecated: Bool { - get {return _deprecated ?? false} - set {_deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return self._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {self._deprecated = nil} - - /// For Google-internal migration only. Do not use. - var weak: Bool { - get {return _weak ?? false} - set {_weak = newValue} - } - /// Returns true if `weak` has been explicitly set. - var hasWeak: Bool {return self._weak != nil} - /// Clears the value of `weak`. Subsequent reads from it will return its default value. - mutating func clearWeak() {self._weak = nil} - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - enum CType: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// Default mode. - case string // = 0 - case cord // = 1 - case stringPiece // = 2 - - init() { - self = .string - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .string - case 1: self = .cord - case 2: self = .stringPiece - default: return nil - } - } - - var rawValue: Int { - switch self { - case .string: return 0 - case .cord: return 1 - case .stringPiece: return 2 - } - } - - } - - enum JSType: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// Use the default type. - case jsNormal // = 0 - - /// Use JavaScript strings. - case jsString // = 1 - - /// Use JavaScript numbers. - case jsNumber // = 2 - - init() { - self = .jsNormal - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .jsNormal - case 1: self = .jsString - case 2: self = .jsNumber - default: return nil - } - } - - var rawValue: Int { - switch self { - case .jsNormal: return 0 - case .jsString: return 1 - case .jsNumber: return 2 - } - } - - } - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _ctype: Google_Protobuf_FieldOptions.CType? = nil - fileprivate var _packed: Bool? = nil - fileprivate var _jstype: Google_Protobuf_FieldOptions.JSType? = nil - fileprivate var _lazy: Bool? = nil - fileprivate var _unverifiedLazy: Bool? = nil - fileprivate var _deprecated: Bool? = nil - fileprivate var _weak: Bool? = nil -} - -#if swift(>=4.2) - -extension Google_Protobuf_FieldOptions.CType: CaseIterable { - // Support synthesized by the compiler. -} - -extension Google_Protobuf_FieldOptions.JSType: CaseIterable { - // Support synthesized by the compiler. -} - -#endif // swift(>=4.2) - -struct Google_Protobuf_OneofOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() -} - -struct Google_Protobuf_EnumOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Set this option to true to allow mapping different tag names to the same - /// value. - var allowAlias: Bool { - get {return _allowAlias ?? false} - set {_allowAlias = newValue} - } - /// Returns true if `allowAlias` has been explicitly set. - var hasAllowAlias: Bool {return self._allowAlias != nil} - /// Clears the value of `allowAlias`. Subsequent reads from it will return its default value. - mutating func clearAllowAlias() {self._allowAlias = nil} - - /// Is this enum deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum, or it will be completely ignored; in the very least, this - /// is a formalization for deprecating enums. - var deprecated: Bool { - get {return _deprecated ?? false} - set {_deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return self._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {self._deprecated = nil} - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _allowAlias: Bool? = nil - fileprivate var _deprecated: Bool? = nil -} - -struct Google_Protobuf_EnumValueOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Is this enum value deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the enum value, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating enum values. - var deprecated: Bool { - get {return _deprecated ?? false} - set {_deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return self._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {self._deprecated = nil} - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _deprecated: Bool? = nil -} - -struct Google_Protobuf_ServiceOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Is this service deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the service, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating services. - var deprecated: Bool { - get {return _deprecated ?? false} - set {_deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return self._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {self._deprecated = nil} - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _deprecated: Bool? = nil -} - -struct Google_Protobuf_MethodOptions: SwiftProtobuf.ExtensibleMessage { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Is this method deprecated? - /// Depending on the target platform, this can emit Deprecated annotations - /// for the method, or it will be completely ignored; in the very least, - /// this is a formalization for deprecating methods. - var deprecated: Bool { - get {return _deprecated ?? false} - set {_deprecated = newValue} - } - /// Returns true if `deprecated` has been explicitly set. - var hasDeprecated: Bool {return self._deprecated != nil} - /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. - mutating func clearDeprecated() {self._deprecated = nil} - - var idempotencyLevel: Google_Protobuf_MethodOptions.IdempotencyLevel { - get {return _idempotencyLevel ?? .idempotencyUnknown} - set {_idempotencyLevel = newValue} - } - /// Returns true if `idempotencyLevel` has been explicitly set. - var hasIdempotencyLevel: Bool {return self._idempotencyLevel != nil} - /// Clears the value of `idempotencyLevel`. Subsequent reads from it will return its default value. - mutating func clearIdempotencyLevel() {self._idempotencyLevel = nil} - - /// The parser stores options it doesn't recognize here. See above. - var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, - /// or neither? HTTP based RPC implementation may choose GET verb for safe - /// methods, and PUT verb for idempotent methods instead of the default POST. - enum IdempotencyLevel: SwiftProtobuf.Enum { - typealias RawValue = Int - case idempotencyUnknown // = 0 - - /// implies idempotent - case noSideEffects // = 1 - - /// idempotent, but may have side effects - case idempotent // = 2 - - init() { - self = .idempotencyUnknown - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .idempotencyUnknown - case 1: self = .noSideEffects - case 2: self = .idempotent - default: return nil - } - } - - var rawValue: Int { - switch self { - case .idempotencyUnknown: return 0 - case .noSideEffects: return 1 - case .idempotent: return 2 - } - } - - } - - init() {} - - var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() - fileprivate var _deprecated: Bool? = nil - fileprivate var _idempotencyLevel: Google_Protobuf_MethodOptions.IdempotencyLevel? = nil -} - -#if swift(>=4.2) - -extension Google_Protobuf_MethodOptions.IdempotencyLevel: CaseIterable { - // Support synthesized by the compiler. -} - -#endif // swift(>=4.2) - -/// A message representing a option the parser does not recognize. This only -/// appears in options protos created by the compiler::Parser class. -/// DescriptorPool resolves these when building Descriptor objects. Therefore, -/// options protos in descriptor objects (e.g. returned by Descriptor::options(), -/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions -/// in them. -struct Google_Protobuf_UninterpretedOption { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: [Google_Protobuf_UninterpretedOption.NamePart] = [] - - /// The value of the uninterpreted option, in whatever type the tokenizer - /// identified it as during parsing. Exactly one of these should be set. - var identifierValue: String { - get {return _identifierValue ?? String()} - set {_identifierValue = newValue} - } - /// Returns true if `identifierValue` has been explicitly set. - var hasIdentifierValue: Bool {return self._identifierValue != nil} - /// Clears the value of `identifierValue`. Subsequent reads from it will return its default value. - mutating func clearIdentifierValue() {self._identifierValue = nil} - - var positiveIntValue: UInt64 { - get {return _positiveIntValue ?? 0} - set {_positiveIntValue = newValue} - } - /// Returns true if `positiveIntValue` has been explicitly set. - var hasPositiveIntValue: Bool {return self._positiveIntValue != nil} - /// Clears the value of `positiveIntValue`. Subsequent reads from it will return its default value. - mutating func clearPositiveIntValue() {self._positiveIntValue = nil} - - var negativeIntValue: Int64 { - get {return _negativeIntValue ?? 0} - set {_negativeIntValue = newValue} - } - /// Returns true if `negativeIntValue` has been explicitly set. - var hasNegativeIntValue: Bool {return self._negativeIntValue != nil} - /// Clears the value of `negativeIntValue`. Subsequent reads from it will return its default value. - mutating func clearNegativeIntValue() {self._negativeIntValue = nil} - - var doubleValue: Double { - get {return _doubleValue ?? 0} - set {_doubleValue = newValue} - } - /// Returns true if `doubleValue` has been explicitly set. - var hasDoubleValue: Bool {return self._doubleValue != nil} - /// Clears the value of `doubleValue`. Subsequent reads from it will return its default value. - mutating func clearDoubleValue() {self._doubleValue = nil} - - var stringValue: Data { - get {return _stringValue ?? Data()} - set {_stringValue = newValue} - } - /// Returns true if `stringValue` has been explicitly set. - var hasStringValue: Bool {return self._stringValue != nil} - /// Clears the value of `stringValue`. Subsequent reads from it will return its default value. - mutating func clearStringValue() {self._stringValue = nil} - - var aggregateValue: String { - get {return _aggregateValue ?? String()} - set {_aggregateValue = newValue} - } - /// Returns true if `aggregateValue` has been explicitly set. - var hasAggregateValue: Bool {return self._aggregateValue != nil} - /// Clears the value of `aggregateValue`. Subsequent reads from it will return its default value. - mutating func clearAggregateValue() {self._aggregateValue = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// The name of the uninterpreted option. Each string represents a segment in - /// a dot-separated name. is_extension is true iff a segment represents an - /// extension (denoted with parentheses in options specs in .proto files). - /// E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents - /// "foo.(bar.baz).moo". - struct NamePart { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var namePart: String { - get {return _namePart ?? String()} - set {_namePart = newValue} - } - /// Returns true if `namePart` has been explicitly set. - var hasNamePart: Bool {return self._namePart != nil} - /// Clears the value of `namePart`. Subsequent reads from it will return its default value. - mutating func clearNamePart() {self._namePart = nil} - - var isExtension: Bool { - get {return _isExtension ?? false} - set {_isExtension = newValue} - } - /// Returns true if `isExtension` has been explicitly set. - var hasIsExtension: Bool {return self._isExtension != nil} - /// Clears the value of `isExtension`. Subsequent reads from it will return its default value. - mutating func clearIsExtension() {self._isExtension = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _namePart: String? = nil - fileprivate var _isExtension: Bool? = nil - } - - init() {} - - fileprivate var _identifierValue: String? = nil - fileprivate var _positiveIntValue: UInt64? = nil - fileprivate var _negativeIntValue: Int64? = nil - fileprivate var _doubleValue: Double? = nil - fileprivate var _stringValue: Data? = nil - fileprivate var _aggregateValue: String? = nil -} - -/// Encapsulates information about the original source file from which a -/// FileDescriptorProto was generated. -struct Google_Protobuf_SourceCodeInfo { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// A Location identifies a piece of source code in a .proto file which - /// corresponds to a particular definition. This information is intended - /// to be useful to IDEs, code indexers, documentation generators, and similar - /// tools. - /// - /// For example, say we have a file like: - /// message Foo { - /// optional string foo = 1; - /// } - /// Let's look at just the field definition: - /// optional string foo = 1; - /// ^ ^^ ^^ ^ ^^^ - /// a bc de f ghi - /// We have the following locations: - /// span path represents - /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. - /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). - /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). - /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). - /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). - /// - /// Notes: - /// - A location may refer to a repeated field itself (i.e. not to any - /// particular index within it). This is used whenever a set of elements are - /// logically enclosed in a single code segment. For example, an entire - /// extend block (possibly containing multiple extension definitions) will - /// have an outer location whose path refers to the "extensions" repeated - /// field without an index. - /// - Multiple locations may have the same path. This happens when a single - /// logical declaration is spread out across multiple places. The most - /// obvious example is the "extend" block again -- there may be multiple - /// extend blocks in the same scope, each of which will have the same path. - /// - A location's span is not always a subset of its parent's span. For - /// example, the "extendee" of an extension declaration appears at the - /// beginning of the "extend" block and is shared by all extensions within - /// the block. - /// - Just because a location's span is a subset of some other location's span - /// does not mean that it is a descendant. For example, a "group" defines - /// both a type and a field in a single declaration. Thus, the locations - /// corresponding to the type and field and their components will overlap. - /// - Code which tries to interpret locations should probably be designed to - /// ignore those that it doesn't understand, as more types of locations could - /// be recorded in the future. - var location: [Google_Protobuf_SourceCodeInfo.Location] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - struct Location { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Identifies which part of the FileDescriptorProto was defined at this - /// location. - /// - /// Each element is a field number or an index. They form a path from - /// the root FileDescriptorProto to the place where the definition occurs. - /// For example, this path: - /// [ 4, 3, 2, 7, 1 ] - /// refers to: - /// file.message_type(3) // 4, 3 - /// .field(7) // 2, 7 - /// .name() // 1 - /// This is because FileDescriptorProto.message_type has field number 4: - /// repeated DescriptorProto message_type = 4; - /// and DescriptorProto.field has field number 2: - /// repeated FieldDescriptorProto field = 2; - /// and FieldDescriptorProto.name has field number 1: - /// optional string name = 1; - /// - /// Thus, the above path gives the location of a field name. If we removed - /// the last element: - /// [ 4, 3, 2, 7 ] - /// this path refers to the whole field declaration (from the beginning - /// of the label to the terminating semicolon). - var path: [Int32] = [] - - /// Always has exactly three or four elements: start line, start column, - /// end line (optional, otherwise assumed same as start line), end column. - /// These are packed into a single field for efficiency. Note that line - /// and column numbers are zero-based -- typically you will want to add - /// 1 to each before displaying to a user. - var span: [Int32] = [] - - /// If this SourceCodeInfo represents a complete declaration, these are any - /// comments appearing before and after the declaration which appear to be - /// attached to the declaration. - /// - /// A series of line comments appearing on consecutive lines, with no other - /// tokens appearing on those lines, will be treated as a single comment. - /// - /// leading_detached_comments will keep paragraphs of comments that appear - /// before (but not connected to) the current element. Each paragraph, - /// separated by empty lines, will be one comment element in the repeated - /// field. - /// - /// Only the comment content is provided; comment markers (e.g. //) are - /// stripped out. For block comments, leading whitespace and an asterisk - /// will be stripped from the beginning of each line other than the first. - /// Newlines are included in the output. - /// - /// Examples: - /// - /// optional int32 foo = 1; // Comment attached to foo. - /// // Comment attached to bar. - /// optional int32 bar = 2; - /// - /// optional string baz = 3; - /// // Comment attached to baz. - /// // Another line attached to baz. - /// - /// // Comment attached to moo. - /// // - /// // Another line attached to moo. - /// optional double moo = 4; - /// - /// // Detached comment for corge. This is not leading or trailing comments - /// // to moo or corge because there are blank lines separating it from - /// // both. - /// - /// // Detached comment for corge paragraph 2. - /// - /// optional string corge = 5; - /// /* Block comment attached - /// * to corge. Leading asterisks - /// * will be removed. */ - /// /* Block comment attached to - /// * grault. */ - /// optional int32 grault = 6; - /// - /// // ignored detached comments. - var leadingComments: String { - get {return _leadingComments ?? String()} - set {_leadingComments = newValue} - } - /// Returns true if `leadingComments` has been explicitly set. - var hasLeadingComments: Bool {return self._leadingComments != nil} - /// Clears the value of `leadingComments`. Subsequent reads from it will return its default value. - mutating func clearLeadingComments() {self._leadingComments = nil} - - var trailingComments: String { - get {return _trailingComments ?? String()} - set {_trailingComments = newValue} - } - /// Returns true if `trailingComments` has been explicitly set. - var hasTrailingComments: Bool {return self._trailingComments != nil} - /// Clears the value of `trailingComments`. Subsequent reads from it will return its default value. - mutating func clearTrailingComments() {self._trailingComments = nil} - - var leadingDetachedComments: [String] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _leadingComments: String? = nil - fileprivate var _trailingComments: String? = nil - } - - init() {} -} - -/// Describes the relationship between generated code and its original source -/// file. A GeneratedCodeInfo message is associated with only one generated -/// source file, but may contain references to different source .proto files. -struct Google_Protobuf_GeneratedCodeInfo { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// An Annotation connects some span of text in generated code to an element - /// of its generating .proto file. - var annotation: [Google_Protobuf_GeneratedCodeInfo.Annotation] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - struct Annotation { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Identifies the element in the original source .proto file. This field - /// is formatted the same as SourceCodeInfo.Location.path. - var path: [Int32] = [] - - /// Identifies the filesystem path to the original source .proto. - var sourceFile: String { - get {return _sourceFile ?? String()} - set {_sourceFile = newValue} - } - /// Returns true if `sourceFile` has been explicitly set. - var hasSourceFile: Bool {return self._sourceFile != nil} - /// Clears the value of `sourceFile`. Subsequent reads from it will return its default value. - mutating func clearSourceFile() {self._sourceFile = nil} - - /// Identifies the starting offset in bytes in the generated code - /// that relates to the identified object. - var begin: Int32 { - get {return _begin ?? 0} - set {_begin = newValue} - } - /// Returns true if `begin` has been explicitly set. - var hasBegin: Bool {return self._begin != nil} - /// Clears the value of `begin`. Subsequent reads from it will return its default value. - mutating func clearBegin() {self._begin = nil} - - /// Identifies the ending offset in bytes in the generated code that - /// relates to the identified object. The end offset should be one past - /// the last relevant byte (so the length of the text = end - begin). - var end: Int32 { - get {return _end ?? 0} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var semantic: Google_Protobuf_GeneratedCodeInfo.Annotation.Semantic { - get {return _semantic ?? .none} - set {_semantic = newValue} - } - /// Returns true if `semantic` has been explicitly set. - var hasSemantic: Bool {return self._semantic != nil} - /// Clears the value of `semantic`. Subsequent reads from it will return its default value. - mutating func clearSemantic() {self._semantic = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - /// Represents the identified object's effect on the element in the original - /// .proto file. - enum Semantic: SwiftProtobuf.Enum { - typealias RawValue = Int - - /// There is no effect or the effect is indescribable. - case none // = 0 - - /// The element is set or otherwise mutated. - case set // = 1 - - /// An alias to the element is returned. - case alias // = 2 - - init() { - self = .none - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .none - case 1: self = .set - case 2: self = .alias - default: return nil - } - } - - var rawValue: Int { - switch self { - case .none: return 0 - case .set: return 1 - case .alias: return 2 - } - } - - } - - init() {} - - fileprivate var _sourceFile: String? = nil - fileprivate var _begin: Int32? = nil - fileprivate var _end: Int32? = nil - fileprivate var _semantic: Google_Protobuf_GeneratedCodeInfo.Annotation.Semantic? = nil - } - - init() {} -} - -#if swift(>=4.2) - -extension Google_Protobuf_GeneratedCodeInfo.Annotation.Semantic: CaseIterable { - // Support synthesized by the compiler. -} - -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension Google_Protobuf_FileDescriptorSet: @unchecked Sendable {} -extension Google_Protobuf_FileDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_DescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_DescriptorProto.ExtensionRange: @unchecked Sendable {} -extension Google_Protobuf_DescriptorProto.ReservedRange: @unchecked Sendable {} -extension Google_Protobuf_ExtensionRangeOptions: @unchecked Sendable {} -extension Google_Protobuf_FieldDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_FieldDescriptorProto.TypeEnum: @unchecked Sendable {} -extension Google_Protobuf_FieldDescriptorProto.Label: @unchecked Sendable {} -extension Google_Protobuf_OneofDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_EnumDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_EnumDescriptorProto.EnumReservedRange: @unchecked Sendable {} -extension Google_Protobuf_EnumValueDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_ServiceDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_MethodDescriptorProto: @unchecked Sendable {} -extension Google_Protobuf_FileOptions: @unchecked Sendable {} -extension Google_Protobuf_FileOptions.OptimizeMode: @unchecked Sendable {} -extension Google_Protobuf_MessageOptions: @unchecked Sendable {} -extension Google_Protobuf_FieldOptions: @unchecked Sendable {} -extension Google_Protobuf_FieldOptions.CType: @unchecked Sendable {} -extension Google_Protobuf_FieldOptions.JSType: @unchecked Sendable {} -extension Google_Protobuf_OneofOptions: @unchecked Sendable {} -extension Google_Protobuf_EnumOptions: @unchecked Sendable {} -extension Google_Protobuf_EnumValueOptions: @unchecked Sendable {} -extension Google_Protobuf_ServiceOptions: @unchecked Sendable {} -extension Google_Protobuf_MethodOptions: @unchecked Sendable {} -extension Google_Protobuf_MethodOptions.IdempotencyLevel: @unchecked Sendable {} -extension Google_Protobuf_UninterpretedOption: @unchecked Sendable {} -extension Google_Protobuf_UninterpretedOption.NamePart: @unchecked Sendable {} -extension Google_Protobuf_SourceCodeInfo: @unchecked Sendable {} -extension Google_Protobuf_SourceCodeInfo.Location: @unchecked Sendable {} -extension Google_Protobuf_GeneratedCodeInfo: @unchecked Sendable {} -extension Google_Protobuf_GeneratedCodeInfo.Annotation: @unchecked Sendable {} -extension Google_Protobuf_GeneratedCodeInfo.Annotation.Semantic: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "google.protobuf" - -extension Google_Protobuf_FileDescriptorSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".FileDescriptorSet" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "file"), - ] - - public var isInitialized: Bool { - if !SwiftProtobuf.Internal.areAllInitialized(self.file) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.file) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.file.isEmpty { - try visitor.visitRepeatedMessageField(value: self.file, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_FileDescriptorSet, rhs: Google_Protobuf_FileDescriptorSet) -> Bool { - if lhs.file != rhs.file {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_FileDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".FileDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "package"), - 3: .same(proto: "dependency"), - 10: .standard(proto: "public_dependency"), - 11: .standard(proto: "weak_dependency"), - 4: .standard(proto: "message_type"), - 5: .standard(proto: "enum_type"), - 6: .same(proto: "service"), - 7: .same(proto: "extension"), - 8: .same(proto: "options"), - 9: .standard(proto: "source_code_info"), - 12: .same(proto: "syntax"), - 13: .same(proto: "edition"), - ] - - public var isInitialized: Bool { - if !SwiftProtobuf.Internal.areAllInitialized(self.messageType) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.enumType) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.service) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.`extension`) {return false} - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeSingularStringField(value: &self._package) }() - case 3: try { try decoder.decodeRepeatedStringField(value: &self.dependency) }() - case 4: try { try decoder.decodeRepeatedMessageField(value: &self.messageType) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &self.enumType) }() - case 6: try { try decoder.decodeRepeatedMessageField(value: &self.service) }() - case 7: try { try decoder.decodeRepeatedMessageField(value: &self.`extension`) }() - case 8: try { try decoder.decodeSingularMessageField(value: &self._options) }() - case 9: try { try decoder.decodeSingularMessageField(value: &self._sourceCodeInfo) }() - case 10: try { try decoder.decodeRepeatedInt32Field(value: &self.publicDependency) }() - case 11: try { try decoder.decodeRepeatedInt32Field(value: &self.weakDependency) }() - case 12: try { try decoder.decodeSingularStringField(value: &self._syntax) }() - case 13: try { try decoder.decodeSingularStringField(value: &self._edition) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = self._package { - try visitor.visitSingularStringField(value: v, fieldNumber: 2) - } }() - if !self.dependency.isEmpty { - try visitor.visitRepeatedStringField(value: self.dependency, fieldNumber: 3) - } - if !self.messageType.isEmpty { - try visitor.visitRepeatedMessageField(value: self.messageType, fieldNumber: 4) - } - if !self.enumType.isEmpty { - try visitor.visitRepeatedMessageField(value: self.enumType, fieldNumber: 5) - } - if !self.service.isEmpty { - try visitor.visitRepeatedMessageField(value: self.service, fieldNumber: 6) - } - if !self.`extension`.isEmpty { - try visitor.visitRepeatedMessageField(value: self.`extension`, fieldNumber: 7) - } - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - } }() - try { if let v = self._sourceCodeInfo { - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - } }() - if !self.publicDependency.isEmpty { - try visitor.visitRepeatedInt32Field(value: self.publicDependency, fieldNumber: 10) - } - if !self.weakDependency.isEmpty { - try visitor.visitRepeatedInt32Field(value: self.weakDependency, fieldNumber: 11) - } - try { if let v = self._syntax { - try visitor.visitSingularStringField(value: v, fieldNumber: 12) - } }() - try { if let v = self._edition { - try visitor.visitSingularStringField(value: v, fieldNumber: 13) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_FileDescriptorProto, rhs: Google_Protobuf_FileDescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs._package != rhs._package {return false} - if lhs.dependency != rhs.dependency {return false} - if lhs.publicDependency != rhs.publicDependency {return false} - if lhs.weakDependency != rhs.weakDependency {return false} - if lhs.messageType != rhs.messageType {return false} - if lhs.enumType != rhs.enumType {return false} - if lhs.service != rhs.service {return false} - if lhs.`extension` != rhs.`extension` {return false} - if lhs._options != rhs._options {return false} - if lhs._sourceCodeInfo != rhs._sourceCodeInfo {return false} - if lhs._syntax != rhs._syntax {return false} - if lhs._edition != rhs._edition {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_DescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "field"), - 6: .same(proto: "extension"), - 3: .standard(proto: "nested_type"), - 4: .standard(proto: "enum_type"), - 5: .standard(proto: "extension_range"), - 8: .standard(proto: "oneof_decl"), - 7: .same(proto: "options"), - 9: .standard(proto: "reserved_range"), - 10: .standard(proto: "reserved_name"), - ] - - public var isInitialized: Bool { - if !SwiftProtobuf.Internal.areAllInitialized(self.field) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.`extension`) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.nestedType) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.enumType) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.extensionRange) {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.oneofDecl) {return false} - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.field) }() - case 3: try { try decoder.decodeRepeatedMessageField(value: &self.nestedType) }() - case 4: try { try decoder.decodeRepeatedMessageField(value: &self.enumType) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &self.extensionRange) }() - case 6: try { try decoder.decodeRepeatedMessageField(value: &self.`extension`) }() - case 7: try { try decoder.decodeSingularMessageField(value: &self._options) }() - case 8: try { try decoder.decodeRepeatedMessageField(value: &self.oneofDecl) }() - case 9: try { try decoder.decodeRepeatedMessageField(value: &self.reservedRange) }() - case 10: try { try decoder.decodeRepeatedStringField(value: &self.reservedName) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - if !self.field.isEmpty { - try visitor.visitRepeatedMessageField(value: self.field, fieldNumber: 2) - } - if !self.nestedType.isEmpty { - try visitor.visitRepeatedMessageField(value: self.nestedType, fieldNumber: 3) - } - if !self.enumType.isEmpty { - try visitor.visitRepeatedMessageField(value: self.enumType, fieldNumber: 4) - } - if !self.extensionRange.isEmpty { - try visitor.visitRepeatedMessageField(value: self.extensionRange, fieldNumber: 5) - } - if !self.`extension`.isEmpty { - try visitor.visitRepeatedMessageField(value: self.`extension`, fieldNumber: 6) - } - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 7) - } }() - if !self.oneofDecl.isEmpty { - try visitor.visitRepeatedMessageField(value: self.oneofDecl, fieldNumber: 8) - } - if !self.reservedRange.isEmpty { - try visitor.visitRepeatedMessageField(value: self.reservedRange, fieldNumber: 9) - } - if !self.reservedName.isEmpty { - try visitor.visitRepeatedStringField(value: self.reservedName, fieldNumber: 10) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_DescriptorProto, rhs: Google_Protobuf_DescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs.field != rhs.field {return false} - if lhs.`extension` != rhs.`extension` {return false} - if lhs.nestedType != rhs.nestedType {return false} - if lhs.enumType != rhs.enumType {return false} - if lhs.extensionRange != rhs.extensionRange {return false} - if lhs.oneofDecl != rhs.oneofDecl {return false} - if lhs._options != rhs._options {return false} - if lhs.reservedRange != rhs.reservedRange {return false} - if lhs.reservedName != rhs.reservedName {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_DescriptorProto.ExtensionRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Google_Protobuf_DescriptorProto.protoMessageName + ".ExtensionRange" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "start"), - 2: .same(proto: "end"), - 3: .same(proto: "options"), - ] - - public var isInitialized: Bool { - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt32Field(value: &self._start) }() - case 2: try { try decoder.decodeSingularInt32Field(value: &self._end) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._start { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) - } }() - try { if let v = self._end { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) - } }() - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_DescriptorProto.ExtensionRange, rhs: Google_Protobuf_DescriptorProto.ExtensionRange) -> Bool { - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs._options != rhs._options {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_DescriptorProto.ReservedRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Google_Protobuf_DescriptorProto.protoMessageName + ".ReservedRange" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "start"), - 2: .same(proto: "end"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt32Field(value: &self._start) }() - case 2: try { try decoder.decodeSingularInt32Field(value: &self._end) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._start { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) - } }() - try { if let v = self._end { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_DescriptorProto.ReservedRange, rhs: Google_Protobuf_DescriptorProto.ReservedRange) -> Bool { - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_ExtensionRangeOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ExtensionRangeOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_ExtensionRangeOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_ExtensionRangeOptions, rhs: Google_Protobuf_ExtensionRangeOptions) -> Bool { - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_FieldDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".FieldDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 3: .same(proto: "number"), - 4: .same(proto: "label"), - 5: .same(proto: "type"), - 6: .standard(proto: "type_name"), - 2: .same(proto: "extendee"), - 7: .standard(proto: "default_value"), - 9: .standard(proto: "oneof_index"), - 10: .standard(proto: "json_name"), - 8: .same(proto: "options"), - 17: .standard(proto: "proto3_optional"), - ] - - fileprivate class _StorageClass { - var _name: String? = nil - var _number: Int32? = nil - var _label: Google_Protobuf_FieldDescriptorProto.Label? = nil - var _type: Google_Protobuf_FieldDescriptorProto.TypeEnum? = nil - var _typeName: String? = nil - var _extendee: String? = nil - var _defaultValue: String? = nil - var _oneofIndex: Int32? = nil - var _jsonName: String? = nil - var _options: Google_Protobuf_FieldOptions? = nil - var _proto3Optional: Bool? = nil - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _name = source._name - _number = source._number - _label = source._label - _type = source._type - _typeName = source._typeName - _extendee = source._extendee - _defaultValue = source._defaultValue - _oneofIndex = source._oneofIndex - _jsonName = source._jsonName - _options = source._options - _proto3Optional = source._proto3Optional - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - public var isInitialized: Bool { - return withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if let v = _storage._options, !v.isInitialized {return false} - return true - } - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &_storage._name) }() - case 2: try { try decoder.decodeSingularStringField(value: &_storage._extendee) }() - case 3: try { try decoder.decodeSingularInt32Field(value: &_storage._number) }() - case 4: try { try decoder.decodeSingularEnumField(value: &_storage._label) }() - case 5: try { try decoder.decodeSingularEnumField(value: &_storage._type) }() - case 6: try { try decoder.decodeSingularStringField(value: &_storage._typeName) }() - case 7: try { try decoder.decodeSingularStringField(value: &_storage._defaultValue) }() - case 8: try { try decoder.decodeSingularMessageField(value: &_storage._options) }() - case 9: try { try decoder.decodeSingularInt32Field(value: &_storage._oneofIndex) }() - case 10: try { try decoder.decodeSingularStringField(value: &_storage._jsonName) }() - case 17: try { try decoder.decodeSingularBoolField(value: &_storage._proto3Optional) }() - default: break - } - } - } - } - - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = _storage._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = _storage._extendee { - try visitor.visitSingularStringField(value: v, fieldNumber: 2) - } }() - try { if let v = _storage._number { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) - } }() - try { if let v = _storage._label { - try visitor.visitSingularEnumField(value: v, fieldNumber: 4) - } }() - try { if let v = _storage._type { - try visitor.visitSingularEnumField(value: v, fieldNumber: 5) - } }() - try { if let v = _storage._typeName { - try visitor.visitSingularStringField(value: v, fieldNumber: 6) - } }() - try { if let v = _storage._defaultValue { - try visitor.visitSingularStringField(value: v, fieldNumber: 7) - } }() - try { if let v = _storage._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 8) - } }() - try { if let v = _storage._oneofIndex { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 9) - } }() - try { if let v = _storage._jsonName { - try visitor.visitSingularStringField(value: v, fieldNumber: 10) - } }() - try { if let v = _storage._proto3Optional { - try visitor.visitSingularBoolField(value: v, fieldNumber: 17) - } }() - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_FieldDescriptorProto, rhs: Google_Protobuf_FieldDescriptorProto) -> Bool { - if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in - let _storage = _args.0 - let rhs_storage = _args.1 - if _storage._name != rhs_storage._name {return false} - if _storage._number != rhs_storage._number {return false} - if _storage._label != rhs_storage._label {return false} - if _storage._type != rhs_storage._type {return false} - if _storage._typeName != rhs_storage._typeName {return false} - if _storage._extendee != rhs_storage._extendee {return false} - if _storage._defaultValue != rhs_storage._defaultValue {return false} - if _storage._oneofIndex != rhs_storage._oneofIndex {return false} - if _storage._jsonName != rhs_storage._jsonName {return false} - if _storage._options != rhs_storage._options {return false} - if _storage._proto3Optional != rhs_storage._proto3Optional {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_FieldDescriptorProto.TypeEnum: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "TYPE_DOUBLE"), - 2: .same(proto: "TYPE_FLOAT"), - 3: .same(proto: "TYPE_INT64"), - 4: .same(proto: "TYPE_UINT64"), - 5: .same(proto: "TYPE_INT32"), - 6: .same(proto: "TYPE_FIXED64"), - 7: .same(proto: "TYPE_FIXED32"), - 8: .same(proto: "TYPE_BOOL"), - 9: .same(proto: "TYPE_STRING"), - 10: .same(proto: "TYPE_GROUP"), - 11: .same(proto: "TYPE_MESSAGE"), - 12: .same(proto: "TYPE_BYTES"), - 13: .same(proto: "TYPE_UINT32"), - 14: .same(proto: "TYPE_ENUM"), - 15: .same(proto: "TYPE_SFIXED32"), - 16: .same(proto: "TYPE_SFIXED64"), - 17: .same(proto: "TYPE_SINT32"), - 18: .same(proto: "TYPE_SINT64"), - ] -} - -extension Google_Protobuf_FieldDescriptorProto.Label: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "LABEL_OPTIONAL"), - 2: .same(proto: "LABEL_REQUIRED"), - 3: .same(proto: "LABEL_REPEATED"), - ] -} - -extension Google_Protobuf_OneofDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".OneofDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "options"), - ] - - public var isInitialized: Bool { - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._options) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_OneofDescriptorProto, rhs: Google_Protobuf_OneofDescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs._options != rhs._options {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_EnumDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EnumDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "value"), - 3: .same(proto: "options"), - 4: .standard(proto: "reserved_range"), - 5: .standard(proto: "reserved_name"), - ] - - public var isInitialized: Bool { - if !SwiftProtobuf.Internal.areAllInitialized(self.value) {return false} - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.value) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() - case 4: try { try decoder.decodeRepeatedMessageField(value: &self.reservedRange) }() - case 5: try { try decoder.decodeRepeatedStringField(value: &self.reservedName) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - if !self.value.isEmpty { - try visitor.visitRepeatedMessageField(value: self.value, fieldNumber: 2) - } - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - if !self.reservedRange.isEmpty { - try visitor.visitRepeatedMessageField(value: self.reservedRange, fieldNumber: 4) - } - if !self.reservedName.isEmpty { - try visitor.visitRepeatedStringField(value: self.reservedName, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_EnumDescriptorProto, rhs: Google_Protobuf_EnumDescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs.value != rhs.value {return false} - if lhs._options != rhs._options {return false} - if lhs.reservedRange != rhs.reservedRange {return false} - if lhs.reservedName != rhs.reservedName {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_EnumDescriptorProto.EnumReservedRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Google_Protobuf_EnumDescriptorProto.protoMessageName + ".EnumReservedRange" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "start"), - 2: .same(proto: "end"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt32Field(value: &self._start) }() - case 2: try { try decoder.decodeSingularInt32Field(value: &self._end) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._start { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) - } }() - try { if let v = self._end { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_EnumDescriptorProto.EnumReservedRange, rhs: Google_Protobuf_EnumDescriptorProto.EnumReservedRange) -> Bool { - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_EnumValueDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EnumValueDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "number"), - 3: .same(proto: "options"), - ] - - public var isInitialized: Bool { - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeSingularInt32Field(value: &self._number) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = self._number { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) - } }() - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_EnumValueDescriptorProto, rhs: Google_Protobuf_EnumValueDescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs._number != rhs._number {return false} - if lhs._options != rhs._options {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_ServiceDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ServiceDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "method"), - 3: .same(proto: "options"), - ] - - public var isInitialized: Bool { - if !SwiftProtobuf.Internal.areAllInitialized(self.method) {return false} - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.method) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - if !self.method.isEmpty { - try visitor.visitRepeatedMessageField(value: self.method, fieldNumber: 2) - } - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_ServiceDescriptorProto, rhs: Google_Protobuf_ServiceDescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs.method != rhs.method {return false} - if lhs._options != rhs._options {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_MethodDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MethodDescriptorProto" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .standard(proto: "input_type"), - 3: .standard(proto: "output_type"), - 4: .same(proto: "options"), - 5: .standard(proto: "client_streaming"), - 6: .standard(proto: "server_streaming"), - ] - - public var isInitialized: Bool { - if let v = self._options, !v.isInitialized {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() - case 2: try { try decoder.decodeSingularStringField(value: &self._inputType) }() - case 3: try { try decoder.decodeSingularStringField(value: &self._outputType) }() - case 4: try { try decoder.decodeSingularMessageField(value: &self._options) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self._clientStreaming) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self._serverStreaming) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._name { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = self._inputType { - try visitor.visitSingularStringField(value: v, fieldNumber: 2) - } }() - try { if let v = self._outputType { - try visitor.visitSingularStringField(value: v, fieldNumber: 3) - } }() - try { if let v = self._options { - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - } }() - try { if let v = self._clientStreaming { - try visitor.visitSingularBoolField(value: v, fieldNumber: 5) - } }() - try { if let v = self._serverStreaming { - try visitor.visitSingularBoolField(value: v, fieldNumber: 6) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_MethodDescriptorProto, rhs: Google_Protobuf_MethodDescriptorProto) -> Bool { - if lhs._name != rhs._name {return false} - if lhs._inputType != rhs._inputType {return false} - if lhs._outputType != rhs._outputType {return false} - if lhs._options != rhs._options {return false} - if lhs._clientStreaming != rhs._clientStreaming {return false} - if lhs._serverStreaming != rhs._serverStreaming {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".FileOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "java_package"), - 8: .standard(proto: "java_outer_classname"), - 10: .standard(proto: "java_multiple_files"), - 20: .standard(proto: "java_generate_equals_and_hash"), - 27: .standard(proto: "java_string_check_utf8"), - 9: .standard(proto: "optimize_for"), - 11: .standard(proto: "go_package"), - 16: .standard(proto: "cc_generic_services"), - 17: .standard(proto: "java_generic_services"), - 18: .standard(proto: "py_generic_services"), - 42: .standard(proto: "php_generic_services"), - 23: .same(proto: "deprecated"), - 31: .standard(proto: "cc_enable_arenas"), - 36: .standard(proto: "objc_class_prefix"), - 37: .standard(proto: "csharp_namespace"), - 39: .standard(proto: "swift_prefix"), - 40: .standard(proto: "php_class_prefix"), - 41: .standard(proto: "php_namespace"), - 44: .standard(proto: "php_metadata_namespace"), - 45: .standard(proto: "ruby_package"), - 999: .standard(proto: "uninterpreted_option"), - ] - - fileprivate class _StorageClass { - var _javaPackage: String? = nil - var _javaOuterClassname: String? = nil - var _javaMultipleFiles: Bool? = nil - var _javaGenerateEqualsAndHash: Bool? = nil - var _javaStringCheckUtf8: Bool? = nil - var _optimizeFor: Google_Protobuf_FileOptions.OptimizeMode? = nil - var _goPackage: String? = nil - var _ccGenericServices: Bool? = nil - var _javaGenericServices: Bool? = nil - var _pyGenericServices: Bool? = nil - var _phpGenericServices: Bool? = nil - var _deprecated: Bool? = nil - var _ccEnableArenas: Bool? = nil - var _objcClassPrefix: String? = nil - var _csharpNamespace: String? = nil - var _swiftPrefix: String? = nil - var _phpClassPrefix: String? = nil - var _phpNamespace: String? = nil - var _phpMetadataNamespace: String? = nil - var _rubyPackage: String? = nil - var _uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _javaPackage = source._javaPackage - _javaOuterClassname = source._javaOuterClassname - _javaMultipleFiles = source._javaMultipleFiles - _javaGenerateEqualsAndHash = source._javaGenerateEqualsAndHash - _javaStringCheckUtf8 = source._javaStringCheckUtf8 - _optimizeFor = source._optimizeFor - _goPackage = source._goPackage - _ccGenericServices = source._ccGenericServices - _javaGenericServices = source._javaGenericServices - _pyGenericServices = source._pyGenericServices - _phpGenericServices = source._phpGenericServices - _deprecated = source._deprecated - _ccEnableArenas = source._ccEnableArenas - _objcClassPrefix = source._objcClassPrefix - _csharpNamespace = source._csharpNamespace - _swiftPrefix = source._swiftPrefix - _phpClassPrefix = source._phpClassPrefix - _phpNamespace = source._phpNamespace - _phpMetadataNamespace = source._phpMetadataNamespace - _rubyPackage = source._rubyPackage - _uninterpretedOption = source._uninterpretedOption - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - return withExtendedLifetime(_storage) { (_storage: _StorageClass) in - if !SwiftProtobuf.Internal.areAllInitialized(_storage._uninterpretedOption) {return false} - return true - } - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &_storage._javaPackage) }() - case 8: try { try decoder.decodeSingularStringField(value: &_storage._javaOuterClassname) }() - case 9: try { try decoder.decodeSingularEnumField(value: &_storage._optimizeFor) }() - case 10: try { try decoder.decodeSingularBoolField(value: &_storage._javaMultipleFiles) }() - case 11: try { try decoder.decodeSingularStringField(value: &_storage._goPackage) }() - case 16: try { try decoder.decodeSingularBoolField(value: &_storage._ccGenericServices) }() - case 17: try { try decoder.decodeSingularBoolField(value: &_storage._javaGenericServices) }() - case 18: try { try decoder.decodeSingularBoolField(value: &_storage._pyGenericServices) }() - case 20: try { try decoder.decodeSingularBoolField(value: &_storage._javaGenerateEqualsAndHash) }() - case 23: try { try decoder.decodeSingularBoolField(value: &_storage._deprecated) }() - case 27: try { try decoder.decodeSingularBoolField(value: &_storage._javaStringCheckUtf8) }() - case 31: try { try decoder.decodeSingularBoolField(value: &_storage._ccEnableArenas) }() - case 36: try { try decoder.decodeSingularStringField(value: &_storage._objcClassPrefix) }() - case 37: try { try decoder.decodeSingularStringField(value: &_storage._csharpNamespace) }() - case 39: try { try decoder.decodeSingularStringField(value: &_storage._swiftPrefix) }() - case 40: try { try decoder.decodeSingularStringField(value: &_storage._phpClassPrefix) }() - case 41: try { try decoder.decodeSingularStringField(value: &_storage._phpNamespace) }() - case 42: try { try decoder.decodeSingularBoolField(value: &_storage._phpGenericServices) }() - case 44: try { try decoder.decodeSingularStringField(value: &_storage._phpMetadataNamespace) }() - case 45: try { try decoder.decodeSingularStringField(value: &_storage._rubyPackage) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &_storage._uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_FileOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - } - - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = _storage._javaPackage { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = _storage._javaOuterClassname { - try visitor.visitSingularStringField(value: v, fieldNumber: 8) - } }() - try { if let v = _storage._optimizeFor { - try visitor.visitSingularEnumField(value: v, fieldNumber: 9) - } }() - try { if let v = _storage._javaMultipleFiles { - try visitor.visitSingularBoolField(value: v, fieldNumber: 10) - } }() - try { if let v = _storage._goPackage { - try visitor.visitSingularStringField(value: v, fieldNumber: 11) - } }() - try { if let v = _storage._ccGenericServices { - try visitor.visitSingularBoolField(value: v, fieldNumber: 16) - } }() - try { if let v = _storage._javaGenericServices { - try visitor.visitSingularBoolField(value: v, fieldNumber: 17) - } }() - try { if let v = _storage._pyGenericServices { - try visitor.visitSingularBoolField(value: v, fieldNumber: 18) - } }() - try { if let v = _storage._javaGenerateEqualsAndHash { - try visitor.visitSingularBoolField(value: v, fieldNumber: 20) - } }() - try { if let v = _storage._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 23) - } }() - try { if let v = _storage._javaStringCheckUtf8 { - try visitor.visitSingularBoolField(value: v, fieldNumber: 27) - } }() - try { if let v = _storage._ccEnableArenas { - try visitor.visitSingularBoolField(value: v, fieldNumber: 31) - } }() - try { if let v = _storage._objcClassPrefix { - try visitor.visitSingularStringField(value: v, fieldNumber: 36) - } }() - try { if let v = _storage._csharpNamespace { - try visitor.visitSingularStringField(value: v, fieldNumber: 37) - } }() - try { if let v = _storage._swiftPrefix { - try visitor.visitSingularStringField(value: v, fieldNumber: 39) - } }() - try { if let v = _storage._phpClassPrefix { - try visitor.visitSingularStringField(value: v, fieldNumber: 40) - } }() - try { if let v = _storage._phpNamespace { - try visitor.visitSingularStringField(value: v, fieldNumber: 41) - } }() - try { if let v = _storage._phpGenericServices { - try visitor.visitSingularBoolField(value: v, fieldNumber: 42) - } }() - try { if let v = _storage._phpMetadataNamespace { - try visitor.visitSingularStringField(value: v, fieldNumber: 44) - } }() - try { if let v = _storage._rubyPackage { - try visitor.visitSingularStringField(value: v, fieldNumber: 45) - } }() - if !_storage._uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: _storage._uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_FileOptions, rhs: Google_Protobuf_FileOptions) -> Bool { - if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in - let _storage = _args.0 - let rhs_storage = _args.1 - if _storage._javaPackage != rhs_storage._javaPackage {return false} - if _storage._javaOuterClassname != rhs_storage._javaOuterClassname {return false} - if _storage._javaMultipleFiles != rhs_storage._javaMultipleFiles {return false} - if _storage._javaGenerateEqualsAndHash != rhs_storage._javaGenerateEqualsAndHash {return false} - if _storage._javaStringCheckUtf8 != rhs_storage._javaStringCheckUtf8 {return false} - if _storage._optimizeFor != rhs_storage._optimizeFor {return false} - if _storage._goPackage != rhs_storage._goPackage {return false} - if _storage._ccGenericServices != rhs_storage._ccGenericServices {return false} - if _storage._javaGenericServices != rhs_storage._javaGenericServices {return false} - if _storage._pyGenericServices != rhs_storage._pyGenericServices {return false} - if _storage._phpGenericServices != rhs_storage._phpGenericServices {return false} - if _storage._deprecated != rhs_storage._deprecated {return false} - if _storage._ccEnableArenas != rhs_storage._ccEnableArenas {return false} - if _storage._objcClassPrefix != rhs_storage._objcClassPrefix {return false} - if _storage._csharpNamespace != rhs_storage._csharpNamespace {return false} - if _storage._swiftPrefix != rhs_storage._swiftPrefix {return false} - if _storage._phpClassPrefix != rhs_storage._phpClassPrefix {return false} - if _storage._phpNamespace != rhs_storage._phpNamespace {return false} - if _storage._phpMetadataNamespace != rhs_storage._phpMetadataNamespace {return false} - if _storage._rubyPackage != rhs_storage._rubyPackage {return false} - if _storage._uninterpretedOption != rhs_storage._uninterpretedOption {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_FileOptions.OptimizeMode: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "SPEED"), - 2: .same(proto: "CODE_SIZE"), - 3: .same(proto: "LITE_RUNTIME"), - ] -} - -extension Google_Protobuf_MessageOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MessageOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "message_set_wire_format"), - 2: .standard(proto: "no_standard_descriptor_accessor"), - 3: .same(proto: "deprecated"), - 7: .standard(proto: "map_entry"), - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularBoolField(value: &self._messageSetWireFormat) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self._noStandardDescriptorAccessor) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() - case 7: try { try decoder.decodeSingularBoolField(value: &self._mapEntry) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_MessageOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._messageSetWireFormat { - try visitor.visitSingularBoolField(value: v, fieldNumber: 1) - } }() - try { if let v = self._noStandardDescriptorAccessor { - try visitor.visitSingularBoolField(value: v, fieldNumber: 2) - } }() - try { if let v = self._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 3) - } }() - try { if let v = self._mapEntry { - try visitor.visitSingularBoolField(value: v, fieldNumber: 7) - } }() - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_MessageOptions, rhs: Google_Protobuf_MessageOptions) -> Bool { - if lhs._messageSetWireFormat != rhs._messageSetWireFormat {return false} - if lhs._noStandardDescriptorAccessor != rhs._noStandardDescriptorAccessor {return false} - if lhs._deprecated != rhs._deprecated {return false} - if lhs._mapEntry != rhs._mapEntry {return false} - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_FieldOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".FieldOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "ctype"), - 2: .same(proto: "packed"), - 6: .same(proto: "jstype"), - 5: .same(proto: "lazy"), - 15: .standard(proto: "unverified_lazy"), - 3: .same(proto: "deprecated"), - 10: .same(proto: "weak"), - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularEnumField(value: &self._ctype) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self._packed) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() - case 5: try { try decoder.decodeSingularBoolField(value: &self._lazy) }() - case 6: try { try decoder.decodeSingularEnumField(value: &self._jstype) }() - case 10: try { try decoder.decodeSingularBoolField(value: &self._weak) }() - case 15: try { try decoder.decodeSingularBoolField(value: &self._unverifiedLazy) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_FieldOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._ctype { - try visitor.visitSingularEnumField(value: v, fieldNumber: 1) - } }() - try { if let v = self._packed { - try visitor.visitSingularBoolField(value: v, fieldNumber: 2) - } }() - try { if let v = self._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 3) - } }() - try { if let v = self._lazy { - try visitor.visitSingularBoolField(value: v, fieldNumber: 5) - } }() - try { if let v = self._jstype { - try visitor.visitSingularEnumField(value: v, fieldNumber: 6) - } }() - try { if let v = self._weak { - try visitor.visitSingularBoolField(value: v, fieldNumber: 10) - } }() - try { if let v = self._unverifiedLazy { - try visitor.visitSingularBoolField(value: v, fieldNumber: 15) - } }() - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_FieldOptions, rhs: Google_Protobuf_FieldOptions) -> Bool { - if lhs._ctype != rhs._ctype {return false} - if lhs._packed != rhs._packed {return false} - if lhs._jstype != rhs._jstype {return false} - if lhs._lazy != rhs._lazy {return false} - if lhs._unverifiedLazy != rhs._unverifiedLazy {return false} - if lhs._deprecated != rhs._deprecated {return false} - if lhs._weak != rhs._weak {return false} - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_FieldOptions.CType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "STRING"), - 1: .same(proto: "CORD"), - 2: .same(proto: "STRING_PIECE"), - ] -} - -extension Google_Protobuf_FieldOptions.JSType: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "JS_NORMAL"), - 1: .same(proto: "JS_STRING"), - 2: .same(proto: "JS_NUMBER"), - ] -} - -extension Google_Protobuf_OneofOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".OneofOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_OneofOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_OneofOptions, rhs: Google_Protobuf_OneofOptions) -> Bool { - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_EnumOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EnumOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 2: .standard(proto: "allow_alias"), - 3: .same(proto: "deprecated"), - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 2: try { try decoder.decodeSingularBoolField(value: &self._allowAlias) }() - case 3: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_EnumOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._allowAlias { - try visitor.visitSingularBoolField(value: v, fieldNumber: 2) - } }() - try { if let v = self._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 3) - } }() - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_EnumOptions, rhs: Google_Protobuf_EnumOptions) -> Bool { - if lhs._allowAlias != rhs._allowAlias {return false} - if lhs._deprecated != rhs._deprecated {return false} - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_EnumValueOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EnumValueOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "deprecated"), - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_EnumValueOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 1) - } }() - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_EnumValueOptions, rhs: Google_Protobuf_EnumValueOptions) -> Bool { - if lhs._deprecated != rhs._deprecated {return false} - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_ServiceOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ServiceOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 33: .same(proto: "deprecated"), - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 33: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_ServiceOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 33) - } }() - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_ServiceOptions, rhs: Google_Protobuf_ServiceOptions) -> Bool { - if lhs._deprecated != rhs._deprecated {return false} - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_MethodOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".MethodOptions" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 33: .same(proto: "deprecated"), - 34: .standard(proto: "idempotency_level"), - 999: .standard(proto: "uninterpreted_option"), - ] - - public var isInitialized: Bool { - if !_protobuf_extensionFieldValues.isInitialized {return false} - if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 33: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() - case 34: try { try decoder.decodeSingularEnumField(value: &self._idempotencyLevel) }() - case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() - case 1000..<536870912: - try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_MethodOptions.self, fieldNumber: fieldNumber) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._deprecated { - try visitor.visitSingularBoolField(value: v, fieldNumber: 33) - } }() - try { if let v = self._idempotencyLevel { - try visitor.visitSingularEnumField(value: v, fieldNumber: 34) - } }() - if !self.uninterpretedOption.isEmpty { - try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) - } - try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_MethodOptions, rhs: Google_Protobuf_MethodOptions) -> Bool { - if lhs._deprecated != rhs._deprecated {return false} - if lhs._idempotencyLevel != rhs._idempotencyLevel {return false} - if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} - return true - } -} - -extension Google_Protobuf_MethodOptions.IdempotencyLevel: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "IDEMPOTENCY_UNKNOWN"), - 1: .same(proto: "NO_SIDE_EFFECTS"), - 2: .same(proto: "IDEMPOTENT"), - ] -} - -extension Google_Protobuf_UninterpretedOption: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".UninterpretedOption" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 2: .same(proto: "name"), - 3: .standard(proto: "identifier_value"), - 4: .standard(proto: "positive_int_value"), - 5: .standard(proto: "negative_int_value"), - 6: .standard(proto: "double_value"), - 7: .standard(proto: "string_value"), - 8: .standard(proto: "aggregate_value"), - ] - - public var isInitialized: Bool { - if !SwiftProtobuf.Internal.areAllInitialized(self.name) {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.name) }() - case 3: try { try decoder.decodeSingularStringField(value: &self._identifierValue) }() - case 4: try { try decoder.decodeSingularUInt64Field(value: &self._positiveIntValue) }() - case 5: try { try decoder.decodeSingularInt64Field(value: &self._negativeIntValue) }() - case 6: try { try decoder.decodeSingularDoubleField(value: &self._doubleValue) }() - case 7: try { try decoder.decodeSingularBytesField(value: &self._stringValue) }() - case 8: try { try decoder.decodeSingularStringField(value: &self._aggregateValue) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.name.isEmpty { - try visitor.visitRepeatedMessageField(value: self.name, fieldNumber: 2) - } - try { if let v = self._identifierValue { - try visitor.visitSingularStringField(value: v, fieldNumber: 3) - } }() - try { if let v = self._positiveIntValue { - try visitor.visitSingularUInt64Field(value: v, fieldNumber: 4) - } }() - try { if let v = self._negativeIntValue { - try visitor.visitSingularInt64Field(value: v, fieldNumber: 5) - } }() - try { if let v = self._doubleValue { - try visitor.visitSingularDoubleField(value: v, fieldNumber: 6) - } }() - try { if let v = self._stringValue { - try visitor.visitSingularBytesField(value: v, fieldNumber: 7) - } }() - try { if let v = self._aggregateValue { - try visitor.visitSingularStringField(value: v, fieldNumber: 8) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_UninterpretedOption, rhs: Google_Protobuf_UninterpretedOption) -> Bool { - if lhs.name != rhs.name {return false} - if lhs._identifierValue != rhs._identifierValue {return false} - if lhs._positiveIntValue != rhs._positiveIntValue {return false} - if lhs._negativeIntValue != rhs._negativeIntValue {return false} - if lhs._doubleValue != rhs._doubleValue {return false} - if lhs._stringValue != rhs._stringValue {return false} - if lhs._aggregateValue != rhs._aggregateValue {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_UninterpretedOption.NamePart: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Google_Protobuf_UninterpretedOption.protoMessageName + ".NamePart" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "name_part"), - 2: .standard(proto: "is_extension"), - ] - - public var isInitialized: Bool { - if self._namePart == nil {return false} - if self._isExtension == nil {return false} - return true - } - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self._namePart) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self._isExtension) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._namePart { - try visitor.visitSingularStringField(value: v, fieldNumber: 1) - } }() - try { if let v = self._isExtension { - try visitor.visitSingularBoolField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_UninterpretedOption.NamePart, rhs: Google_Protobuf_UninterpretedOption.NamePart) -> Bool { - if lhs._namePart != rhs._namePart {return false} - if lhs._isExtension != rhs._isExtension {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_SourceCodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SourceCodeInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "location"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.location) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.location.isEmpty { - try visitor.visitRepeatedMessageField(value: self.location, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_SourceCodeInfo, rhs: Google_Protobuf_SourceCodeInfo) -> Bool { - if lhs.location != rhs.location {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_SourceCodeInfo.Location: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Google_Protobuf_SourceCodeInfo.protoMessageName + ".Location" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "path"), - 2: .same(proto: "span"), - 3: .standard(proto: "leading_comments"), - 4: .standard(proto: "trailing_comments"), - 6: .standard(proto: "leading_detached_comments"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.path) }() - case 2: try { try decoder.decodeRepeatedInt32Field(value: &self.span) }() - case 3: try { try decoder.decodeSingularStringField(value: &self._leadingComments) }() - case 4: try { try decoder.decodeSingularStringField(value: &self._trailingComments) }() - case 6: try { try decoder.decodeRepeatedStringField(value: &self.leadingDetachedComments) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.path.isEmpty { - try visitor.visitPackedInt32Field(value: self.path, fieldNumber: 1) - } - if !self.span.isEmpty { - try visitor.visitPackedInt32Field(value: self.span, fieldNumber: 2) - } - try { if let v = self._leadingComments { - try visitor.visitSingularStringField(value: v, fieldNumber: 3) - } }() - try { if let v = self._trailingComments { - try visitor.visitSingularStringField(value: v, fieldNumber: 4) - } }() - if !self.leadingDetachedComments.isEmpty { - try visitor.visitRepeatedStringField(value: self.leadingDetachedComments, fieldNumber: 6) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_SourceCodeInfo.Location, rhs: Google_Protobuf_SourceCodeInfo.Location) -> Bool { - if lhs.path != rhs.path {return false} - if lhs.span != rhs.span {return false} - if lhs._leadingComments != rhs._leadingComments {return false} - if lhs._trailingComments != rhs._trailingComments {return false} - if lhs.leadingDetachedComments != rhs.leadingDetachedComments {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_GeneratedCodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GeneratedCodeInfo" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "annotation"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.annotation) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.annotation.isEmpty { - try visitor.visitRepeatedMessageField(value: self.annotation, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_GeneratedCodeInfo, rhs: Google_Protobuf_GeneratedCodeInfo) -> Bool { - if lhs.annotation != rhs.annotation {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_GeneratedCodeInfo.Annotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = Google_Protobuf_GeneratedCodeInfo.protoMessageName + ".Annotation" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "path"), - 2: .standard(proto: "source_file"), - 3: .same(proto: "begin"), - 4: .same(proto: "end"), - 5: .same(proto: "semantic"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.path) }() - case 2: try { try decoder.decodeSingularStringField(value: &self._sourceFile) }() - case 3: try { try decoder.decodeSingularInt32Field(value: &self._begin) }() - case 4: try { try decoder.decodeSingularInt32Field(value: &self._end) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self._semantic) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.path.isEmpty { - try visitor.visitPackedInt32Field(value: self.path, fieldNumber: 1) - } - try { if let v = self._sourceFile { - try visitor.visitSingularStringField(value: v, fieldNumber: 2) - } }() - try { if let v = self._begin { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) - } }() - try { if let v = self._end { - try visitor.visitSingularInt32Field(value: v, fieldNumber: 4) - } }() - try { if let v = self._semantic { - try visitor.visitSingularEnumField(value: v, fieldNumber: 5) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_GeneratedCodeInfo.Annotation, rhs: Google_Protobuf_GeneratedCodeInfo.Annotation) -> Bool { - if lhs.path != rhs.path {return false} - if lhs._sourceFile != rhs._sourceFile {return false} - if lhs._begin != rhs._begin {return false} - if lhs._end != rhs._end {return false} - if lhs._semantic != rhs._semantic {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Google_Protobuf_GeneratedCodeInfo.Annotation.Semantic: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "NONE"), - 1: .same(proto: "SET"), - 2: .same(proto: "ALIAS"), - ] -} diff --git a/Sources/LoggingLoki/Proto/gen/swift/gogo.pb.swift b/Sources/LoggingLoki/Proto/gen/swift/gogo.pb.swift deleted file mode 100644 index 7495a8e..0000000 --- a/Sources/LoggingLoki/Proto/gen/swift/gogo.pb.swift +++ /dev/null @@ -1,1683 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: gogo.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -// MARK: - Extension support defined in gogo.proto. - -// MARK: - Extension Properties - -// Swift Extensions on the exteneded Messages to add easy access to the declared -// extension fields. The names are based on the extension field name from the proto -// declaration. To avoid naming collisions, the names are prefixed with the name of -// the scope where the extend directive occurs. - -extension SwiftProtobuf.Google_Protobuf_EnumOptions { - - var Gogoproto_goprotoEnumPrefix: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_enum_prefix` - /// has been explicitly set. - var hasGogoproto_goprotoEnumPrefix: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_enum_prefix`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoEnumPrefix() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix) - } - - var Gogoproto_goprotoEnumStringer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_enum_stringer` - /// has been explicitly set. - var hasGogoproto_goprotoEnumStringer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_enum_stringer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoEnumStringer() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer) - } - - var Gogoproto_enumStringer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_enum_stringer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_enum_stringer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_enum_stringer` - /// has been explicitly set. - var hasGogoproto_enumStringer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_enum_stringer) - } - /// Clears the value of extension `Gogoproto_Extensions_enum_stringer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_enumStringer() { - clearExtensionValue(ext: Gogoproto_Extensions_enum_stringer) - } - - var Gogoproto_enumCustomname: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_enum_customname) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_enum_customname, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_enum_customname` - /// has been explicitly set. - var hasGogoproto_enumCustomname: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_enum_customname) - } - /// Clears the value of extension `Gogoproto_Extensions_enum_customname`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_enumCustomname() { - clearExtensionValue(ext: Gogoproto_Extensions_enum_customname) - } - - var Gogoproto_enumdecl: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_enumdecl) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_enumdecl, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_enumdecl` - /// has been explicitly set. - var hasGogoproto_enumdecl: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_enumdecl) - } - /// Clears the value of extension `Gogoproto_Extensions_enumdecl`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_enumdecl() { - clearExtensionValue(ext: Gogoproto_Extensions_enumdecl) - } -} - -extension SwiftProtobuf.Google_Protobuf_EnumValueOptions { - - var Gogoproto_enumvalueCustomname: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_enumvalue_customname) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_enumvalue_customname, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_enumvalue_customname` - /// has been explicitly set. - var hasGogoproto_enumvalueCustomname: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_enumvalue_customname) - } - /// Clears the value of extension `Gogoproto_Extensions_enumvalue_customname`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_enumvalueCustomname() { - clearExtensionValue(ext: Gogoproto_Extensions_enumvalue_customname) - } -} - -extension SwiftProtobuf.Google_Protobuf_FieldOptions { - - var Gogoproto_nullable: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_nullable) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_nullable, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_nullable` - /// has been explicitly set. - var hasGogoproto_nullable: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_nullable) - } - /// Clears the value of extension `Gogoproto_Extensions_nullable`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_nullable() { - clearExtensionValue(ext: Gogoproto_Extensions_nullable) - } - - var Gogoproto_embed: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_embed) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_embed, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_embed` - /// has been explicitly set. - var hasGogoproto_embed: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_embed) - } - /// Clears the value of extension `Gogoproto_Extensions_embed`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_embed() { - clearExtensionValue(ext: Gogoproto_Extensions_embed) - } - - var Gogoproto_customtype: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_customtype) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_customtype, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_customtype` - /// has been explicitly set. - var hasGogoproto_customtype: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_customtype) - } - /// Clears the value of extension `Gogoproto_Extensions_customtype`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_customtype() { - clearExtensionValue(ext: Gogoproto_Extensions_customtype) - } - - var Gogoproto_customname: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_customname) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_customname, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_customname` - /// has been explicitly set. - var hasGogoproto_customname: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_customname) - } - /// Clears the value of extension `Gogoproto_Extensions_customname`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_customname() { - clearExtensionValue(ext: Gogoproto_Extensions_customname) - } - - var Gogoproto_jsontag: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_jsontag) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_jsontag, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_jsontag` - /// has been explicitly set. - var hasGogoproto_jsontag: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_jsontag) - } - /// Clears the value of extension `Gogoproto_Extensions_jsontag`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_jsontag() { - clearExtensionValue(ext: Gogoproto_Extensions_jsontag) - } - - var Gogoproto_moretags: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_moretags) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_moretags, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_moretags` - /// has been explicitly set. - var hasGogoproto_moretags: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_moretags) - } - /// Clears the value of extension `Gogoproto_Extensions_moretags`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_moretags() { - clearExtensionValue(ext: Gogoproto_Extensions_moretags) - } - - var Gogoproto_casttype: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_casttype) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_casttype, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_casttype` - /// has been explicitly set. - var hasGogoproto_casttype: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_casttype) - } - /// Clears the value of extension `Gogoproto_Extensions_casttype`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_casttype() { - clearExtensionValue(ext: Gogoproto_Extensions_casttype) - } - - var Gogoproto_castkey: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_castkey) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_castkey, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_castkey` - /// has been explicitly set. - var hasGogoproto_castkey: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_castkey) - } - /// Clears the value of extension `Gogoproto_Extensions_castkey`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_castkey() { - clearExtensionValue(ext: Gogoproto_Extensions_castkey) - } - - var Gogoproto_castvalue: String { - get {return getExtensionValue(ext: Gogoproto_Extensions_castvalue) ?? String()} - set {setExtensionValue(ext: Gogoproto_Extensions_castvalue, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_castvalue` - /// has been explicitly set. - var hasGogoproto_castvalue: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_castvalue) - } - /// Clears the value of extension `Gogoproto_Extensions_castvalue`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_castvalue() { - clearExtensionValue(ext: Gogoproto_Extensions_castvalue) - } - - var Gogoproto_stdtime: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_stdtime) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_stdtime, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_stdtime` - /// has been explicitly set. - var hasGogoproto_stdtime: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_stdtime) - } - /// Clears the value of extension `Gogoproto_Extensions_stdtime`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_stdtime() { - clearExtensionValue(ext: Gogoproto_Extensions_stdtime) - } - - var Gogoproto_stdduration: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_stdduration) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_stdduration, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_stdduration` - /// has been explicitly set. - var hasGogoproto_stdduration: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_stdduration) - } - /// Clears the value of extension `Gogoproto_Extensions_stdduration`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_stdduration() { - clearExtensionValue(ext: Gogoproto_Extensions_stdduration) - } - - var Gogoproto_wktpointer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_wktpointer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_wktpointer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_wktpointer` - /// has been explicitly set. - var hasGogoproto_wktpointer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_wktpointer) - } - /// Clears the value of extension `Gogoproto_Extensions_wktpointer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_wktpointer() { - clearExtensionValue(ext: Gogoproto_Extensions_wktpointer) - } -} - -extension SwiftProtobuf.Google_Protobuf_FileOptions { - - var Gogoproto_goprotoGettersAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_getters_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_getters_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_getters_all` - /// has been explicitly set. - var hasGogoproto_goprotoGettersAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_getters_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_getters_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoGettersAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_getters_all) - } - - var Gogoproto_goprotoEnumPrefixAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_enum_prefix_all` - /// has been explicitly set. - var hasGogoproto_goprotoEnumPrefixAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_enum_prefix_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoEnumPrefixAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_enum_prefix_all) - } - - var Gogoproto_goprotoStringerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_stringer_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_stringer_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_stringer_all` - /// has been explicitly set. - var hasGogoproto_goprotoStringerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_stringer_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_stringer_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoStringerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_stringer_all) - } - - var Gogoproto_verboseEqualAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_verbose_equal_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_verbose_equal_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_verbose_equal_all` - /// has been explicitly set. - var hasGogoproto_verboseEqualAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_verbose_equal_all) - } - /// Clears the value of extension `Gogoproto_Extensions_verbose_equal_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_verboseEqualAll() { - clearExtensionValue(ext: Gogoproto_Extensions_verbose_equal_all) - } - - var Gogoproto_faceAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_face_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_face_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_face_all` - /// has been explicitly set. - var hasGogoproto_faceAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_face_all) - } - /// Clears the value of extension `Gogoproto_Extensions_face_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_faceAll() { - clearExtensionValue(ext: Gogoproto_Extensions_face_all) - } - - var Gogoproto_gostringAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_gostring_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_gostring_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_gostring_all` - /// has been explicitly set. - var hasGogoproto_gostringAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_gostring_all) - } - /// Clears the value of extension `Gogoproto_Extensions_gostring_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_gostringAll() { - clearExtensionValue(ext: Gogoproto_Extensions_gostring_all) - } - - var Gogoproto_populateAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_populate_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_populate_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_populate_all` - /// has been explicitly set. - var hasGogoproto_populateAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_populate_all) - } - /// Clears the value of extension `Gogoproto_Extensions_populate_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_populateAll() { - clearExtensionValue(ext: Gogoproto_Extensions_populate_all) - } - - var Gogoproto_stringerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_stringer_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_stringer_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_stringer_all` - /// has been explicitly set. - var hasGogoproto_stringerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_stringer_all) - } - /// Clears the value of extension `Gogoproto_Extensions_stringer_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_stringerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_stringer_all) - } - - var Gogoproto_onlyoneAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_onlyone_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_onlyone_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_onlyone_all` - /// has been explicitly set. - var hasGogoproto_onlyoneAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_onlyone_all) - } - /// Clears the value of extension `Gogoproto_Extensions_onlyone_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_onlyoneAll() { - clearExtensionValue(ext: Gogoproto_Extensions_onlyone_all) - } - - var Gogoproto_equalAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_equal_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_equal_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_equal_all` - /// has been explicitly set. - var hasGogoproto_equalAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_equal_all) - } - /// Clears the value of extension `Gogoproto_Extensions_equal_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_equalAll() { - clearExtensionValue(ext: Gogoproto_Extensions_equal_all) - } - - var Gogoproto_descriptionAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_description_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_description_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_description_all` - /// has been explicitly set. - var hasGogoproto_descriptionAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_description_all) - } - /// Clears the value of extension `Gogoproto_Extensions_description_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_descriptionAll() { - clearExtensionValue(ext: Gogoproto_Extensions_description_all) - } - - var Gogoproto_testgenAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_testgen_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_testgen_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_testgen_all` - /// has been explicitly set. - var hasGogoproto_testgenAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_testgen_all) - } - /// Clears the value of extension `Gogoproto_Extensions_testgen_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_testgenAll() { - clearExtensionValue(ext: Gogoproto_Extensions_testgen_all) - } - - var Gogoproto_benchgenAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_benchgen_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_benchgen_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_benchgen_all` - /// has been explicitly set. - var hasGogoproto_benchgenAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_benchgen_all) - } - /// Clears the value of extension `Gogoproto_Extensions_benchgen_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_benchgenAll() { - clearExtensionValue(ext: Gogoproto_Extensions_benchgen_all) - } - - var Gogoproto_marshalerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_marshaler_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_marshaler_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_marshaler_all` - /// has been explicitly set. - var hasGogoproto_marshalerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_marshaler_all) - } - /// Clears the value of extension `Gogoproto_Extensions_marshaler_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_marshalerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_marshaler_all) - } - - var Gogoproto_unmarshalerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_unmarshaler_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_unmarshaler_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_unmarshaler_all` - /// has been explicitly set. - var hasGogoproto_unmarshalerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_unmarshaler_all) - } - /// Clears the value of extension `Gogoproto_Extensions_unmarshaler_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_unmarshalerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_unmarshaler_all) - } - - var Gogoproto_stableMarshalerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_stable_marshaler_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_stable_marshaler_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_stable_marshaler_all` - /// has been explicitly set. - var hasGogoproto_stableMarshalerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_stable_marshaler_all) - } - /// Clears the value of extension `Gogoproto_Extensions_stable_marshaler_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_stableMarshalerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_stable_marshaler_all) - } - - var Gogoproto_sizerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_sizer_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_sizer_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_sizer_all` - /// has been explicitly set. - var hasGogoproto_sizerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_sizer_all) - } - /// Clears the value of extension `Gogoproto_Extensions_sizer_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_sizerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_sizer_all) - } - - var Gogoproto_goprotoEnumStringerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_enum_stringer_all` - /// has been explicitly set. - var hasGogoproto_goprotoEnumStringerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_enum_stringer_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoEnumStringerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_enum_stringer_all) - } - - var Gogoproto_enumStringerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_enum_stringer_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_enum_stringer_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_enum_stringer_all` - /// has been explicitly set. - var hasGogoproto_enumStringerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_enum_stringer_all) - } - /// Clears the value of extension `Gogoproto_Extensions_enum_stringer_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_enumStringerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_enum_stringer_all) - } - - var Gogoproto_unsafeMarshalerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_unsafe_marshaler_all` - /// has been explicitly set. - var hasGogoproto_unsafeMarshalerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler_all) - } - /// Clears the value of extension `Gogoproto_Extensions_unsafe_marshaler_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_unsafeMarshalerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler_all) - } - - var Gogoproto_unsafeUnmarshalerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_unsafe_unmarshaler_all` - /// has been explicitly set. - var hasGogoproto_unsafeUnmarshalerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler_all) - } - /// Clears the value of extension `Gogoproto_Extensions_unsafe_unmarshaler_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_unsafeUnmarshalerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler_all) - } - - var Gogoproto_goprotoExtensionsMapAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_extensions_map_all` - /// has been explicitly set. - var hasGogoproto_goprotoExtensionsMapAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_extensions_map_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoExtensionsMapAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map_all) - } - - var Gogoproto_goprotoUnrecognizedAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_unrecognized_all` - /// has been explicitly set. - var hasGogoproto_goprotoUnrecognizedAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_unrecognized_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoUnrecognizedAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized_all) - } - - var Gogoproto_gogoprotoImport: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_gogoproto_import) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_gogoproto_import, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_gogoproto_import` - /// has been explicitly set. - var hasGogoproto_gogoprotoImport: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_gogoproto_import) - } - /// Clears the value of extension `Gogoproto_Extensions_gogoproto_import`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_gogoprotoImport() { - clearExtensionValue(ext: Gogoproto_Extensions_gogoproto_import) - } - - var Gogoproto_protosizerAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_protosizer_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_protosizer_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_protosizer_all` - /// has been explicitly set. - var hasGogoproto_protosizerAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_protosizer_all) - } - /// Clears the value of extension `Gogoproto_Extensions_protosizer_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_protosizerAll() { - clearExtensionValue(ext: Gogoproto_Extensions_protosizer_all) - } - - var Gogoproto_compareAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_compare_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_compare_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_compare_all` - /// has been explicitly set. - var hasGogoproto_compareAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_compare_all) - } - /// Clears the value of extension `Gogoproto_Extensions_compare_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_compareAll() { - clearExtensionValue(ext: Gogoproto_Extensions_compare_all) - } - - var Gogoproto_typedeclAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_typedecl_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_typedecl_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_typedecl_all` - /// has been explicitly set. - var hasGogoproto_typedeclAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_typedecl_all) - } - /// Clears the value of extension `Gogoproto_Extensions_typedecl_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_typedeclAll() { - clearExtensionValue(ext: Gogoproto_Extensions_typedecl_all) - } - - var Gogoproto_enumdeclAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_enumdecl_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_enumdecl_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_enumdecl_all` - /// has been explicitly set. - var hasGogoproto_enumdeclAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_enumdecl_all) - } - /// Clears the value of extension `Gogoproto_Extensions_enumdecl_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_enumdeclAll() { - clearExtensionValue(ext: Gogoproto_Extensions_enumdecl_all) - } - - var Gogoproto_goprotoRegistration: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_registration) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_registration, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_registration` - /// has been explicitly set. - var hasGogoproto_goprotoRegistration: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_registration) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_registration`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoRegistration() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_registration) - } - - var Gogoproto_messagenameAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_messagename_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_messagename_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_messagename_all` - /// has been explicitly set. - var hasGogoproto_messagenameAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_messagename_all) - } - /// Clears the value of extension `Gogoproto_Extensions_messagename_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_messagenameAll() { - clearExtensionValue(ext: Gogoproto_Extensions_messagename_all) - } - - var Gogoproto_goprotoSizecacheAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_sizecache_all` - /// has been explicitly set. - var hasGogoproto_goprotoSizecacheAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_sizecache_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoSizecacheAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache_all) - } - - var Gogoproto_goprotoUnkeyedAll: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed_all) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed_all, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_unkeyed_all` - /// has been explicitly set. - var hasGogoproto_goprotoUnkeyedAll: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed_all) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_unkeyed_all`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoUnkeyedAll() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed_all) - } -} - -extension SwiftProtobuf.Google_Protobuf_MessageOptions { - - var Gogoproto_goprotoGetters: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_getters) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_getters, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_getters` - /// has been explicitly set. - var hasGogoproto_goprotoGetters: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_getters) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_getters`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoGetters() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_getters) - } - - var Gogoproto_goprotoStringer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_stringer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_stringer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_stringer` - /// has been explicitly set. - var hasGogoproto_goprotoStringer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_stringer) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_stringer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoStringer() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_stringer) - } - - var Gogoproto_verboseEqual: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_verbose_equal) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_verbose_equal, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_verbose_equal` - /// has been explicitly set. - var hasGogoproto_verboseEqual: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_verbose_equal) - } - /// Clears the value of extension `Gogoproto_Extensions_verbose_equal`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_verboseEqual() { - clearExtensionValue(ext: Gogoproto_Extensions_verbose_equal) - } - - var Gogoproto_face: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_face) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_face, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_face` - /// has been explicitly set. - var hasGogoproto_face: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_face) - } - /// Clears the value of extension `Gogoproto_Extensions_face`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_face() { - clearExtensionValue(ext: Gogoproto_Extensions_face) - } - - var Gogoproto_gostring: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_gostring) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_gostring, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_gostring` - /// has been explicitly set. - var hasGogoproto_gostring: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_gostring) - } - /// Clears the value of extension `Gogoproto_Extensions_gostring`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_gostring() { - clearExtensionValue(ext: Gogoproto_Extensions_gostring) - } - - var Gogoproto_populate: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_populate) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_populate, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_populate` - /// has been explicitly set. - var hasGogoproto_populate: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_populate) - } - /// Clears the value of extension `Gogoproto_Extensions_populate`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_populate() { - clearExtensionValue(ext: Gogoproto_Extensions_populate) - } - - var Gogoproto_stringer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_stringer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_stringer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_stringer` - /// has been explicitly set. - var hasGogoproto_stringer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_stringer) - } - /// Clears the value of extension `Gogoproto_Extensions_stringer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_stringer() { - clearExtensionValue(ext: Gogoproto_Extensions_stringer) - } - - var Gogoproto_onlyone: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_onlyone) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_onlyone, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_onlyone` - /// has been explicitly set. - var hasGogoproto_onlyone: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_onlyone) - } - /// Clears the value of extension `Gogoproto_Extensions_onlyone`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_onlyone() { - clearExtensionValue(ext: Gogoproto_Extensions_onlyone) - } - - var Gogoproto_equal: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_equal) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_equal, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_equal` - /// has been explicitly set. - var hasGogoproto_equal: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_equal) - } - /// Clears the value of extension `Gogoproto_Extensions_equal`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_equal() { - clearExtensionValue(ext: Gogoproto_Extensions_equal) - } - - var Gogoproto_description: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_description) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_description, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_description` - /// has been explicitly set. - var hasGogoproto_description: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_description) - } - /// Clears the value of extension `Gogoproto_Extensions_description`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_description() { - clearExtensionValue(ext: Gogoproto_Extensions_description) - } - - var Gogoproto_testgen: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_testgen) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_testgen, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_testgen` - /// has been explicitly set. - var hasGogoproto_testgen: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_testgen) - } - /// Clears the value of extension `Gogoproto_Extensions_testgen`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_testgen() { - clearExtensionValue(ext: Gogoproto_Extensions_testgen) - } - - var Gogoproto_benchgen: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_benchgen) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_benchgen, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_benchgen` - /// has been explicitly set. - var hasGogoproto_benchgen: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_benchgen) - } - /// Clears the value of extension `Gogoproto_Extensions_benchgen`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_benchgen() { - clearExtensionValue(ext: Gogoproto_Extensions_benchgen) - } - - var Gogoproto_marshaler: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_marshaler) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_marshaler, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_marshaler` - /// has been explicitly set. - var hasGogoproto_marshaler: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_marshaler) - } - /// Clears the value of extension `Gogoproto_Extensions_marshaler`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_marshaler() { - clearExtensionValue(ext: Gogoproto_Extensions_marshaler) - } - - var Gogoproto_unmarshaler: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_unmarshaler) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_unmarshaler, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_unmarshaler` - /// has been explicitly set. - var hasGogoproto_unmarshaler: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_unmarshaler) - } - /// Clears the value of extension `Gogoproto_Extensions_unmarshaler`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_unmarshaler() { - clearExtensionValue(ext: Gogoproto_Extensions_unmarshaler) - } - - var Gogoproto_stableMarshaler: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_stable_marshaler) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_stable_marshaler, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_stable_marshaler` - /// has been explicitly set. - var hasGogoproto_stableMarshaler: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_stable_marshaler) - } - /// Clears the value of extension `Gogoproto_Extensions_stable_marshaler`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_stableMarshaler() { - clearExtensionValue(ext: Gogoproto_Extensions_stable_marshaler) - } - - var Gogoproto_sizer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_sizer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_sizer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_sizer` - /// has been explicitly set. - var hasGogoproto_sizer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_sizer) - } - /// Clears the value of extension `Gogoproto_Extensions_sizer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_sizer() { - clearExtensionValue(ext: Gogoproto_Extensions_sizer) - } - - var Gogoproto_unsafeMarshaler: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_unsafe_marshaler` - /// has been explicitly set. - var hasGogoproto_unsafeMarshaler: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler) - } - /// Clears the value of extension `Gogoproto_Extensions_unsafe_marshaler`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_unsafeMarshaler() { - clearExtensionValue(ext: Gogoproto_Extensions_unsafe_marshaler) - } - - var Gogoproto_unsafeUnmarshaler: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_unsafe_unmarshaler` - /// has been explicitly set. - var hasGogoproto_unsafeUnmarshaler: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler) - } - /// Clears the value of extension `Gogoproto_Extensions_unsafe_unmarshaler`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_unsafeUnmarshaler() { - clearExtensionValue(ext: Gogoproto_Extensions_unsafe_unmarshaler) - } - - var Gogoproto_goprotoExtensionsMap: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_extensions_map` - /// has been explicitly set. - var hasGogoproto_goprotoExtensionsMap: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_extensions_map`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoExtensionsMap() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_extensions_map) - } - - var Gogoproto_goprotoUnrecognized: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_unrecognized` - /// has been explicitly set. - var hasGogoproto_goprotoUnrecognized: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_unrecognized`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoUnrecognized() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_unrecognized) - } - - var Gogoproto_protosizer: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_protosizer) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_protosizer, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_protosizer` - /// has been explicitly set. - var hasGogoproto_protosizer: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_protosizer) - } - /// Clears the value of extension `Gogoproto_Extensions_protosizer`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_protosizer() { - clearExtensionValue(ext: Gogoproto_Extensions_protosizer) - } - - var Gogoproto_compare: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_compare) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_compare, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_compare` - /// has been explicitly set. - var hasGogoproto_compare: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_compare) - } - /// Clears the value of extension `Gogoproto_Extensions_compare`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_compare() { - clearExtensionValue(ext: Gogoproto_Extensions_compare) - } - - var Gogoproto_typedecl: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_typedecl) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_typedecl, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_typedecl` - /// has been explicitly set. - var hasGogoproto_typedecl: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_typedecl) - } - /// Clears the value of extension `Gogoproto_Extensions_typedecl`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_typedecl() { - clearExtensionValue(ext: Gogoproto_Extensions_typedecl) - } - - var Gogoproto_messagename: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_messagename) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_messagename, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_messagename` - /// has been explicitly set. - var hasGogoproto_messagename: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_messagename) - } - /// Clears the value of extension `Gogoproto_Extensions_messagename`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_messagename() { - clearExtensionValue(ext: Gogoproto_Extensions_messagename) - } - - var Gogoproto_goprotoSizecache: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_sizecache` - /// has been explicitly set. - var hasGogoproto_goprotoSizecache: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_sizecache`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoSizecache() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_sizecache) - } - - var Gogoproto_goprotoUnkeyed: Bool { - get {return getExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed) ?? false} - set {setExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed, value: newValue)} - } - /// Returns true if extension `Gogoproto_Extensions_goproto_unkeyed` - /// has been explicitly set. - var hasGogoproto_goprotoUnkeyed: Bool { - return hasExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed) - } - /// Clears the value of extension `Gogoproto_Extensions_goproto_unkeyed`. - /// Subsequent reads from it will return its default value. - mutating func clearGogoproto_goprotoUnkeyed() { - clearExtensionValue(ext: Gogoproto_Extensions_goproto_unkeyed) - } - -} - -// MARK: - File's ExtensionMap: Gogoproto_Gogo_Extensions - -/// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by -/// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed -/// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create -/// a larger `SwiftProtobuf.SimpleExtensionMap`. -let Gogoproto_Gogo_Extensions: SwiftProtobuf.SimpleExtensionMap = [ - Gogoproto_Extensions_goproto_enum_prefix, - Gogoproto_Extensions_goproto_enum_stringer, - Gogoproto_Extensions_enum_stringer, - Gogoproto_Extensions_enum_customname, - Gogoproto_Extensions_enumdecl, - Gogoproto_Extensions_enumvalue_customname, - Gogoproto_Extensions_goproto_getters_all, - Gogoproto_Extensions_goproto_enum_prefix_all, - Gogoproto_Extensions_goproto_stringer_all, - Gogoproto_Extensions_verbose_equal_all, - Gogoproto_Extensions_face_all, - Gogoproto_Extensions_gostring_all, - Gogoproto_Extensions_populate_all, - Gogoproto_Extensions_stringer_all, - Gogoproto_Extensions_onlyone_all, - Gogoproto_Extensions_equal_all, - Gogoproto_Extensions_description_all, - Gogoproto_Extensions_testgen_all, - Gogoproto_Extensions_benchgen_all, - Gogoproto_Extensions_marshaler_all, - Gogoproto_Extensions_unmarshaler_all, - Gogoproto_Extensions_stable_marshaler_all, - Gogoproto_Extensions_sizer_all, - Gogoproto_Extensions_goproto_enum_stringer_all, - Gogoproto_Extensions_enum_stringer_all, - Gogoproto_Extensions_unsafe_marshaler_all, - Gogoproto_Extensions_unsafe_unmarshaler_all, - Gogoproto_Extensions_goproto_extensions_map_all, - Gogoproto_Extensions_goproto_unrecognized_all, - Gogoproto_Extensions_gogoproto_import, - Gogoproto_Extensions_protosizer_all, - Gogoproto_Extensions_compare_all, - Gogoproto_Extensions_typedecl_all, - Gogoproto_Extensions_enumdecl_all, - Gogoproto_Extensions_goproto_registration, - Gogoproto_Extensions_messagename_all, - Gogoproto_Extensions_goproto_sizecache_all, - Gogoproto_Extensions_goproto_unkeyed_all, - Gogoproto_Extensions_goproto_getters, - Gogoproto_Extensions_goproto_stringer, - Gogoproto_Extensions_verbose_equal, - Gogoproto_Extensions_face, - Gogoproto_Extensions_gostring, - Gogoproto_Extensions_populate, - Gogoproto_Extensions_stringer, - Gogoproto_Extensions_onlyone, - Gogoproto_Extensions_equal, - Gogoproto_Extensions_description, - Gogoproto_Extensions_testgen, - Gogoproto_Extensions_benchgen, - Gogoproto_Extensions_marshaler, - Gogoproto_Extensions_unmarshaler, - Gogoproto_Extensions_stable_marshaler, - Gogoproto_Extensions_sizer, - Gogoproto_Extensions_unsafe_marshaler, - Gogoproto_Extensions_unsafe_unmarshaler, - Gogoproto_Extensions_goproto_extensions_map, - Gogoproto_Extensions_goproto_unrecognized, - Gogoproto_Extensions_protosizer, - Gogoproto_Extensions_compare, - Gogoproto_Extensions_typedecl, - Gogoproto_Extensions_messagename, - Gogoproto_Extensions_goproto_sizecache, - Gogoproto_Extensions_goproto_unkeyed, - Gogoproto_Extensions_nullable, - Gogoproto_Extensions_embed, - Gogoproto_Extensions_customtype, - Gogoproto_Extensions_customname, - Gogoproto_Extensions_jsontag, - Gogoproto_Extensions_moretags, - Gogoproto_Extensions_casttype, - Gogoproto_Extensions_castkey, - Gogoproto_Extensions_castvalue, - Gogoproto_Extensions_stdtime, - Gogoproto_Extensions_stdduration, - Gogoproto_Extensions_wktpointer -] - -// Extension Objects - The only reason these might be needed is when manually -// constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_ -// accessors for the extension fields on the messages directly. - -let Gogoproto_Extensions_goproto_enum_prefix = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_EnumOptions>( - _protobuf_fieldNumber: 62001, - fieldName: "gogoproto.goproto_enum_prefix" -) - -let Gogoproto_Extensions_goproto_enum_stringer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_EnumOptions>( - _protobuf_fieldNumber: 62021, - fieldName: "gogoproto.goproto_enum_stringer" -) - -let Gogoproto_Extensions_enum_stringer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_EnumOptions>( - _protobuf_fieldNumber: 62022, - fieldName: "gogoproto.enum_stringer" -) - -let Gogoproto_Extensions_enum_customname = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_EnumOptions>( - _protobuf_fieldNumber: 62023, - fieldName: "gogoproto.enum_customname" -) - -let Gogoproto_Extensions_enumdecl = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_EnumOptions>( - _protobuf_fieldNumber: 62024, - fieldName: "gogoproto.enumdecl" -) - -let Gogoproto_Extensions_enumvalue_customname = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_EnumValueOptions>( - _protobuf_fieldNumber: 66001, - fieldName: "gogoproto.enumvalue_customname" -) - -let Gogoproto_Extensions_goproto_getters_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63001, - fieldName: "gogoproto.goproto_getters_all" -) - -let Gogoproto_Extensions_goproto_enum_prefix_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63002, - fieldName: "gogoproto.goproto_enum_prefix_all" -) - -let Gogoproto_Extensions_goproto_stringer_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63003, - fieldName: "gogoproto.goproto_stringer_all" -) - -let Gogoproto_Extensions_verbose_equal_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63004, - fieldName: "gogoproto.verbose_equal_all" -) - -let Gogoproto_Extensions_face_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63005, - fieldName: "gogoproto.face_all" -) - -let Gogoproto_Extensions_gostring_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63006, - fieldName: "gogoproto.gostring_all" -) - -let Gogoproto_Extensions_populate_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63007, - fieldName: "gogoproto.populate_all" -) - -let Gogoproto_Extensions_stringer_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63008, - fieldName: "gogoproto.stringer_all" -) - -let Gogoproto_Extensions_onlyone_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63009, - fieldName: "gogoproto.onlyone_all" -) - -let Gogoproto_Extensions_equal_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63013, - fieldName: "gogoproto.equal_all" -) - -let Gogoproto_Extensions_description_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63014, - fieldName: "gogoproto.description_all" -) - -let Gogoproto_Extensions_testgen_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63015, - fieldName: "gogoproto.testgen_all" -) - -let Gogoproto_Extensions_benchgen_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63016, - fieldName: "gogoproto.benchgen_all" -) - -let Gogoproto_Extensions_marshaler_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63017, - fieldName: "gogoproto.marshaler_all" -) - -let Gogoproto_Extensions_unmarshaler_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63018, - fieldName: "gogoproto.unmarshaler_all" -) - -let Gogoproto_Extensions_stable_marshaler_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63019, - fieldName: "gogoproto.stable_marshaler_all" -) - -let Gogoproto_Extensions_sizer_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63020, - fieldName: "gogoproto.sizer_all" -) - -let Gogoproto_Extensions_goproto_enum_stringer_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63021, - fieldName: "gogoproto.goproto_enum_stringer_all" -) - -let Gogoproto_Extensions_enum_stringer_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63022, - fieldName: "gogoproto.enum_stringer_all" -) - -let Gogoproto_Extensions_unsafe_marshaler_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63023, - fieldName: "gogoproto.unsafe_marshaler_all" -) - -let Gogoproto_Extensions_unsafe_unmarshaler_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63024, - fieldName: "gogoproto.unsafe_unmarshaler_all" -) - -let Gogoproto_Extensions_goproto_extensions_map_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63025, - fieldName: "gogoproto.goproto_extensions_map_all" -) - -let Gogoproto_Extensions_goproto_unrecognized_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63026, - fieldName: "gogoproto.goproto_unrecognized_all" -) - -let Gogoproto_Extensions_gogoproto_import = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63027, - fieldName: "gogoproto.gogoproto_import" -) - -let Gogoproto_Extensions_protosizer_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63028, - fieldName: "gogoproto.protosizer_all" -) - -let Gogoproto_Extensions_compare_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63029, - fieldName: "gogoproto.compare_all" -) - -let Gogoproto_Extensions_typedecl_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63030, - fieldName: "gogoproto.typedecl_all" -) - -let Gogoproto_Extensions_enumdecl_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63031, - fieldName: "gogoproto.enumdecl_all" -) - -let Gogoproto_Extensions_goproto_registration = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63032, - fieldName: "gogoproto.goproto_registration" -) - -let Gogoproto_Extensions_messagename_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63033, - fieldName: "gogoproto.messagename_all" -) - -let Gogoproto_Extensions_goproto_sizecache_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63034, - fieldName: "gogoproto.goproto_sizecache_all" -) - -let Gogoproto_Extensions_goproto_unkeyed_all = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FileOptions>( - _protobuf_fieldNumber: 63035, - fieldName: "gogoproto.goproto_unkeyed_all" -) - -let Gogoproto_Extensions_goproto_getters = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64001, - fieldName: "gogoproto.goproto_getters" -) - -let Gogoproto_Extensions_goproto_stringer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64003, - fieldName: "gogoproto.goproto_stringer" -) - -let Gogoproto_Extensions_verbose_equal = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64004, - fieldName: "gogoproto.verbose_equal" -) - -let Gogoproto_Extensions_face = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64005, - fieldName: "gogoproto.face" -) - -let Gogoproto_Extensions_gostring = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64006, - fieldName: "gogoproto.gostring" -) - -let Gogoproto_Extensions_populate = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64007, - fieldName: "gogoproto.populate" -) - -let Gogoproto_Extensions_stringer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 67008, - fieldName: "gogoproto.stringer" -) - -let Gogoproto_Extensions_onlyone = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64009, - fieldName: "gogoproto.onlyone" -) - -let Gogoproto_Extensions_equal = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64013, - fieldName: "gogoproto.equal" -) - -let Gogoproto_Extensions_description = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64014, - fieldName: "gogoproto.description" -) - -let Gogoproto_Extensions_testgen = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64015, - fieldName: "gogoproto.testgen" -) - -let Gogoproto_Extensions_benchgen = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64016, - fieldName: "gogoproto.benchgen" -) - -let Gogoproto_Extensions_marshaler = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64017, - fieldName: "gogoproto.marshaler" -) - -let Gogoproto_Extensions_unmarshaler = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64018, - fieldName: "gogoproto.unmarshaler" -) - -let Gogoproto_Extensions_stable_marshaler = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64019, - fieldName: "gogoproto.stable_marshaler" -) - -let Gogoproto_Extensions_sizer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64020, - fieldName: "gogoproto.sizer" -) - -let Gogoproto_Extensions_unsafe_marshaler = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64023, - fieldName: "gogoproto.unsafe_marshaler" -) - -let Gogoproto_Extensions_unsafe_unmarshaler = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64024, - fieldName: "gogoproto.unsafe_unmarshaler" -) - -let Gogoproto_Extensions_goproto_extensions_map = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64025, - fieldName: "gogoproto.goproto_extensions_map" -) - -let Gogoproto_Extensions_goproto_unrecognized = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64026, - fieldName: "gogoproto.goproto_unrecognized" -) - -let Gogoproto_Extensions_protosizer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64028, - fieldName: "gogoproto.protosizer" -) - -let Gogoproto_Extensions_compare = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64029, - fieldName: "gogoproto.compare" -) - -let Gogoproto_Extensions_typedecl = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64030, - fieldName: "gogoproto.typedecl" -) - -let Gogoproto_Extensions_messagename = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64033, - fieldName: "gogoproto.messagename" -) - -let Gogoproto_Extensions_goproto_sizecache = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64034, - fieldName: "gogoproto.goproto_sizecache" -) - -let Gogoproto_Extensions_goproto_unkeyed = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_MessageOptions>( - _protobuf_fieldNumber: 64035, - fieldName: "gogoproto.goproto_unkeyed" -) - -let Gogoproto_Extensions_nullable = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65001, - fieldName: "gogoproto.nullable" -) - -let Gogoproto_Extensions_embed = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65002, - fieldName: "gogoproto.embed" -) - -let Gogoproto_Extensions_customtype = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65003, - fieldName: "gogoproto.customtype" -) - -let Gogoproto_Extensions_customname = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65004, - fieldName: "gogoproto.customname" -) - -let Gogoproto_Extensions_jsontag = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65005, - fieldName: "gogoproto.jsontag" -) - -let Gogoproto_Extensions_moretags = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65006, - fieldName: "gogoproto.moretags" -) - -let Gogoproto_Extensions_casttype = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65007, - fieldName: "gogoproto.casttype" -) - -let Gogoproto_Extensions_castkey = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65008, - fieldName: "gogoproto.castkey" -) - -let Gogoproto_Extensions_castvalue = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65009, - fieldName: "gogoproto.castvalue" -) - -let Gogoproto_Extensions_stdtime = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65010, - fieldName: "gogoproto.stdtime" -) - -let Gogoproto_Extensions_stdduration = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65011, - fieldName: "gogoproto.stdduration" -) - -let Gogoproto_Extensions_wktpointer = SwiftProtobuf.MessageExtension, SwiftProtobuf.Google_Protobuf_FieldOptions>( - _protobuf_fieldNumber: 65012, - fieldName: "gogoproto.wktpointer" -) diff --git a/Sources/LoggingLoki/Proto/gen/swift/logproto.pb.swift b/Sources/LoggingLoki/Proto/gen/swift/logproto.pb.swift deleted file mode 100644 index 2fbe5b9..0000000 --- a/Sources/LoggingLoki/Proto/gen/swift/logproto.pb.swift +++ /dev/null @@ -1,2843 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: logproto.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -enum Logproto_Direction: SwiftProtobuf.Enum { - typealias RawValue = Int - case forward // = 0 - case backward // = 1 - case UNRECOGNIZED(Int) - - init() { - self = .forward - } - - init?(rawValue: Int) { - switch rawValue { - case 0: self = .forward - case 1: self = .backward - default: self = .UNRECOGNIZED(rawValue) - } - } - - var rawValue: Int { - switch self { - case .forward: return 0 - case .backward: return 1 - case .UNRECOGNIZED(let i): return i - } - } - -} - -#if swift(>=4.2) - -extension Logproto_Direction: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. - static var allCases: [Logproto_Direction] = [ - .forward, - .backward, - ] -} - -#endif // swift(>=4.2) - -struct Logproto_StreamRatesRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_StreamRatesResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var streamRates: [Logproto_StreamRate] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_StreamRate { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var streamHash: UInt64 = 0 - - var streamHashNoShard: UInt64 = 0 - - /// rate in plain bytes. - var rate: Int64 = 0 - - var tenant: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_PushRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var streams: [Logproto_StreamAdapter] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_PushResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_QueryRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var selector: String = String() - - var limit: UInt32 = 0 - - var start: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _start ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - var end: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _end ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var direction: Logproto_Direction = .forward - - var shards: [String] = [] - - var deletes: [Logproto_Delete] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _end: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_SampleQueryRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var selector: String = String() - - var start: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _start ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - var end: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _end ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var shards: [String] = [] - - var deletes: [Logproto_Delete] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _end: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_Delete { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var selector: String = String() - - var start: Int64 = 0 - - var end: Int64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_QueryResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var streams: [Logproto_StreamAdapter] = [] - - var stats: Stats_Ingester { - get {return _stats ?? Stats_Ingester()} - set {_stats = newValue} - } - /// Returns true if `stats` has been explicitly set. - var hasStats: Bool {return self._stats != nil} - /// Clears the value of `stats`. Subsequent reads from it will return its default value. - mutating func clearStats() {self._stats = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _stats: Stats_Ingester? = nil -} - -struct Logproto_SampleQueryResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var series: [Logproto_Series] = [] - - var stats: Stats_Ingester { - get {return _stats ?? Stats_Ingester()} - set {_stats = newValue} - } - /// Returns true if `stats` has been explicitly set. - var hasStats: Bool {return self._stats != nil} - /// Clears the value of `stats`. Subsequent reads from it will return its default value. - mutating func clearStats() {self._stats = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _stats: Stats_Ingester? = nil -} - -struct Logproto_LabelRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String = String() - - /// True to fetch label values, false for fetch labels names. - var values: Bool = false - - var start: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _start ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - var end: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _end ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _end: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_LabelResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var values: [String] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_StreamAdapter { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var labels: String = String() - - var entries: [Logproto_EntryAdapter] = [] - - /// hash contains the original hash of the stream. - var hash: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_EntryAdapter { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_timestamp = newValue} - } - /// Returns true if `timestamp` has been explicitly set. - var hasTimestamp: Bool {return self._timestamp != nil} - /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. - mutating func clearTimestamp() {self._timestamp = nil} - - var line: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_Sample { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var timestamp: Int64 = 0 - - var value: Double = 0 - - var hash: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// LegacySample exists for backwards compatibility reasons and is deprecated. Do not use. -struct Logproto_LegacySample { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var value: Double = 0 - - var timestampMs: Int64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_Series { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var labels: String = String() - - var samples: [Logproto_Sample] = [] - - var streamHash: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_TailRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var query: String = String() - - var delayFor: UInt32 = 0 - - var limit: UInt32 = 0 - - var start: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _start ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_TailResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var stream: Logproto_StreamAdapter { - get {return _stream ?? Logproto_StreamAdapter()} - set {_stream = newValue} - } - /// Returns true if `stream` has been explicitly set. - var hasStream: Bool {return self._stream != nil} - /// Clears the value of `stream`. Subsequent reads from it will return its default value. - mutating func clearStream() {self._stream = nil} - - var droppedStreams: [Logproto_DroppedStream] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _stream: Logproto_StreamAdapter? = nil -} - -struct Logproto_SeriesRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var start: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _start ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - var end: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _end ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var groups: [String] = [] - - var shards: [String] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _end: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_SeriesResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var series: [Logproto_SeriesIdentifier] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_SeriesIdentifier { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var labels: Dictionary = [:] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_DroppedStream { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var from: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _from ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_from = newValue} - } - /// Returns true if `from` has been explicitly set. - var hasFrom: Bool {return self._from != nil} - /// Clears the value of `from`. Subsequent reads from it will return its default value. - mutating func clearFrom() {self._from = nil} - - var to: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _to ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_to = newValue} - } - /// Returns true if `to` has been explicitly set. - var hasTo: Bool {return self._to != nil} - /// Clears the value of `to`. Subsequent reads from it will return its default value. - mutating func clearTo() {self._to = nil} - - var labels: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _from: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _to: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_TimeSeriesChunk { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var fromIngesterID: String = String() - - var userID: String = String() - - var labels: [Logproto_LabelPair] = [] - - var chunks: [Logproto_Chunk] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_LabelPair { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: String = String() - - var value: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// LegacyLabelPair exists for backwards compatibility reasons and is deprecated. Do not use. -struct Logproto_LegacyLabelPair { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var name: Data = Data() - - var value: Data = Data() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_Chunk { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var data: Data = Data() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_TransferChunksResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_TailersCountRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_TailersCountResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var count: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_GetChunkIDsRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var matchers: String = String() - - var start: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _start ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_start = newValue} - } - /// Returns true if `start` has been explicitly set. - var hasStart: Bool {return self._start != nil} - /// Clears the value of `start`. Subsequent reads from it will return its default value. - mutating func clearStart() {self._start = nil} - - var end: SwiftProtobuf.Google_Protobuf_Timestamp { - get {return _end ?? SwiftProtobuf.Google_Protobuf_Timestamp()} - set {_end = newValue} - } - /// Returns true if `end` has been explicitly set. - var hasEnd: Bool {return self._end != nil} - /// Clears the value of `end`. Subsequent reads from it will return its default value. - mutating func clearEnd() {self._end = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _start: SwiftProtobuf.Google_Protobuf_Timestamp? = nil - fileprivate var _end: SwiftProtobuf.Google_Protobuf_Timestamp? = nil -} - -struct Logproto_GetChunkIDsResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var chunkIds: [String] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// ChunkRef contains the metadata to reference a Chunk. -/// It is embedded by the Chunk type itself and used to generate the Chunk -/// checksum. So it is imported to take care of the JSON representation of the -/// resulting Go struct. -struct Logproto_ChunkRef { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var fingerprint: UInt64 = 0 - - var userID: String = String() - - var from: Int64 = 0 - - var through: Int64 = 0 - - /// The checksum is not written to the external storage. We use crc32, - /// Castagnoli table. See http://www.evanjones.ca/crc32c.html. - var checksum: UInt32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_LabelValuesForMetricNameRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var metricName: String = String() - - var labelName: String = String() - - var from: Int64 = 0 - - var through: Int64 = 0 - - var matchers: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_LabelNamesForMetricNameRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var metricName: String = String() - - var from: Int64 = 0 - - var through: Int64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_GetChunkRefRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var from: Int64 = 0 - - var through: Int64 = 0 - - var matchers: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_GetChunkRefResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var refs: [Logproto_ChunkRef] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_GetSeriesRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var from: Int64 = 0 - - var through: Int64 = 0 - - var matchers: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_GetSeriesResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var series: [Logproto_IndexSeries] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -/// Series calls to the TSDB Index -struct Logproto_IndexSeries { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var labels: [Logproto_LabelPair] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_QueryIndexResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var queryKey: String = String() - - var rows: [Logproto_Row] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_Row { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var rangeValue: Data = Data() - - var value: Data = Data() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_QueryIndexRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var queries: [Logproto_IndexQuery] = [] - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_IndexQuery { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var tableName: String = String() - - var hashValue_p: String = String() - - var rangeValuePrefix: Data = Data() - - var rangeValueStart: Data = Data() - - var valueEqual: Data = Data() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_IndexStatsRequest { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var from: Int64 = 0 - - var through: Int64 = 0 - - /// TODO(owen-d): add shards to grpc calls so we don't have - /// to extract via labels - var matchers: String = String() - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Logproto_IndexStatsResponse { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var streams: UInt64 = 0 - - var chunks: UInt64 = 0 - - var bytes: UInt64 = 0 - - var entries: UInt64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Logproto_Direction: @unchecked Sendable {} -extension Logproto_StreamRatesRequest: @unchecked Sendable {} -extension Logproto_StreamRatesResponse: @unchecked Sendable {} -extension Logproto_StreamRate: @unchecked Sendable {} -extension Logproto_PushRequest: @unchecked Sendable {} -extension Logproto_PushResponse: @unchecked Sendable {} -extension Logproto_QueryRequest: @unchecked Sendable {} -extension Logproto_SampleQueryRequest: @unchecked Sendable {} -extension Logproto_Delete: @unchecked Sendable {} -extension Logproto_QueryResponse: @unchecked Sendable {} -extension Logproto_SampleQueryResponse: @unchecked Sendable {} -extension Logproto_LabelRequest: @unchecked Sendable {} -extension Logproto_LabelResponse: @unchecked Sendable {} -extension Logproto_StreamAdapter: @unchecked Sendable {} -extension Logproto_EntryAdapter: @unchecked Sendable {} -extension Logproto_Sample: @unchecked Sendable {} -extension Logproto_LegacySample: @unchecked Sendable {} -extension Logproto_Series: @unchecked Sendable {} -extension Logproto_TailRequest: @unchecked Sendable {} -extension Logproto_TailResponse: @unchecked Sendable {} -extension Logproto_SeriesRequest: @unchecked Sendable {} -extension Logproto_SeriesResponse: @unchecked Sendable {} -extension Logproto_SeriesIdentifier: @unchecked Sendable {} -extension Logproto_DroppedStream: @unchecked Sendable {} -extension Logproto_TimeSeriesChunk: @unchecked Sendable {} -extension Logproto_LabelPair: @unchecked Sendable {} -extension Logproto_LegacyLabelPair: @unchecked Sendable {} -extension Logproto_Chunk: @unchecked Sendable {} -extension Logproto_TransferChunksResponse: @unchecked Sendable {} -extension Logproto_TailersCountRequest: @unchecked Sendable {} -extension Logproto_TailersCountResponse: @unchecked Sendable {} -extension Logproto_GetChunkIDsRequest: @unchecked Sendable {} -extension Logproto_GetChunkIDsResponse: @unchecked Sendable {} -extension Logproto_ChunkRef: @unchecked Sendable {} -extension Logproto_LabelValuesForMetricNameRequest: @unchecked Sendable {} -extension Logproto_LabelNamesForMetricNameRequest: @unchecked Sendable {} -extension Logproto_GetChunkRefRequest: @unchecked Sendable {} -extension Logproto_GetChunkRefResponse: @unchecked Sendable {} -extension Logproto_GetSeriesRequest: @unchecked Sendable {} -extension Logproto_GetSeriesResponse: @unchecked Sendable {} -extension Logproto_IndexSeries: @unchecked Sendable {} -extension Logproto_QueryIndexResponse: @unchecked Sendable {} -extension Logproto_Row: @unchecked Sendable {} -extension Logproto_QueryIndexRequest: @unchecked Sendable {} -extension Logproto_IndexQuery: @unchecked Sendable {} -extension Logproto_IndexStatsRequest: @unchecked Sendable {} -extension Logproto_IndexStatsResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "logproto" - -extension Logproto_Direction: SwiftProtobuf._ProtoNameProviding { - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 0: .same(proto: "FORWARD"), - 1: .same(proto: "BACKWARD"), - ] -} - -extension Logproto_StreamRatesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".StreamRatesRequest" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() - - mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } - } - - func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_StreamRatesRequest, rhs: Logproto_StreamRatesRequest) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_StreamRatesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".StreamRatesResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "streamRates"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.streamRates) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.streamRates.isEmpty { - try visitor.visitRepeatedMessageField(value: self.streamRates, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_StreamRatesResponse, rhs: Logproto_StreamRatesResponse) -> Bool { - if lhs.streamRates != rhs.streamRates {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_StreamRate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".StreamRate" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "streamHash"), - 2: .same(proto: "streamHashNoShard"), - 3: .same(proto: "rate"), - 4: .same(proto: "tenant"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularUInt64Field(value: &self.streamHash) }() - case 2: try { try decoder.decodeSingularUInt64Field(value: &self.streamHashNoShard) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.rate) }() - case 4: try { try decoder.decodeSingularStringField(value: &self.tenant) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.streamHash != 0 { - try visitor.visitSingularUInt64Field(value: self.streamHash, fieldNumber: 1) - } - if self.streamHashNoShard != 0 { - try visitor.visitSingularUInt64Field(value: self.streamHashNoShard, fieldNumber: 2) - } - if self.rate != 0 { - try visitor.visitSingularInt64Field(value: self.rate, fieldNumber: 3) - } - if !self.tenant.isEmpty { - try visitor.visitSingularStringField(value: self.tenant, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_StreamRate, rhs: Logproto_StreamRate) -> Bool { - if lhs.streamHash != rhs.streamHash {return false} - if lhs.streamHashNoShard != rhs.streamHashNoShard {return false} - if lhs.rate != rhs.rate {return false} - if lhs.tenant != rhs.tenant {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_PushRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".PushRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "streams"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.streams) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.streams.isEmpty { - try visitor.visitRepeatedMessageField(value: self.streams, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_PushRequest, rhs: Logproto_PushRequest) -> Bool { - if lhs.streams != rhs.streams {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_PushResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".PushResponse" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() - - mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } - } - - func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_PushResponse, rhs: Logproto_PushResponse) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_QueryRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".QueryRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "selector"), - 2: .same(proto: "limit"), - 3: .same(proto: "start"), - 4: .same(proto: "end"), - 5: .same(proto: "direction"), - 7: .same(proto: "shards"), - 8: .same(proto: "deletes"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.selector) }() - case 2: try { try decoder.decodeSingularUInt32Field(value: &self.limit) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._start) }() - case 4: try { try decoder.decodeSingularMessageField(value: &self._end) }() - case 5: try { try decoder.decodeSingularEnumField(value: &self.direction) }() - case 7: try { try decoder.decodeRepeatedStringField(value: &self.shards) }() - case 8: try { try decoder.decodeRepeatedMessageField(value: &self.deletes) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.selector.isEmpty { - try visitor.visitSingularStringField(value: self.selector, fieldNumber: 1) - } - if self.limit != 0 { - try visitor.visitSingularUInt32Field(value: self.limit, fieldNumber: 2) - } - try { if let v = self._start { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try { if let v = self._end { - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - } }() - if self.direction != .forward { - try visitor.visitSingularEnumField(value: self.direction, fieldNumber: 5) - } - if !self.shards.isEmpty { - try visitor.visitRepeatedStringField(value: self.shards, fieldNumber: 7) - } - if !self.deletes.isEmpty { - try visitor.visitRepeatedMessageField(value: self.deletes, fieldNumber: 8) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_QueryRequest, rhs: Logproto_QueryRequest) -> Bool { - if lhs.selector != rhs.selector {return false} - if lhs.limit != rhs.limit {return false} - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.direction != rhs.direction {return false} - if lhs.shards != rhs.shards {return false} - if lhs.deletes != rhs.deletes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_SampleQueryRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SampleQueryRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "selector"), - 2: .same(proto: "start"), - 3: .same(proto: "end"), - 4: .same(proto: "shards"), - 5: .same(proto: "deletes"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.selector) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._start) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._end) }() - case 4: try { try decoder.decodeRepeatedStringField(value: &self.shards) }() - case 5: try { try decoder.decodeRepeatedMessageField(value: &self.deletes) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.selector.isEmpty { - try visitor.visitSingularStringField(value: self.selector, fieldNumber: 1) - } - try { if let v = self._start { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try { if let v = self._end { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - if !self.shards.isEmpty { - try visitor.visitRepeatedStringField(value: self.shards, fieldNumber: 4) - } - if !self.deletes.isEmpty { - try visitor.visitRepeatedMessageField(value: self.deletes, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_SampleQueryRequest, rhs: Logproto_SampleQueryRequest) -> Bool { - if lhs.selector != rhs.selector {return false} - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.shards != rhs.shards {return false} - if lhs.deletes != rhs.deletes {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_Delete: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Delete" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "selector"), - 2: .same(proto: "start"), - 3: .same(proto: "end"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.selector) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.start) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.end) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.selector.isEmpty { - try visitor.visitSingularStringField(value: self.selector, fieldNumber: 1) - } - if self.start != 0 { - try visitor.visitSingularInt64Field(value: self.start, fieldNumber: 2) - } - if self.end != 0 { - try visitor.visitSingularInt64Field(value: self.end, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_Delete, rhs: Logproto_Delete) -> Bool { - if lhs.selector != rhs.selector {return false} - if lhs.start != rhs.start {return false} - if lhs.end != rhs.end {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_QueryResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".QueryResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "streams"), - 2: .same(proto: "stats"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.streams) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._stats) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.streams.isEmpty { - try visitor.visitRepeatedMessageField(value: self.streams, fieldNumber: 1) - } - try { if let v = self._stats { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_QueryResponse, rhs: Logproto_QueryResponse) -> Bool { - if lhs.streams != rhs.streams {return false} - if lhs._stats != rhs._stats {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_SampleQueryResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SampleQueryResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "series"), - 2: .same(proto: "stats"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.series) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._stats) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.series.isEmpty { - try visitor.visitRepeatedMessageField(value: self.series, fieldNumber: 1) - } - try { if let v = self._stats { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_SampleQueryResponse, rhs: Logproto_SampleQueryResponse) -> Bool { - if lhs.series != rhs.series {return false} - if lhs._stats != rhs._stats {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LabelRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LabelRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "values"), - 3: .same(proto: "start"), - 4: .same(proto: "end"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 2: try { try decoder.decodeSingularBoolField(value: &self.values) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._start) }() - case 4: try { try decoder.decodeSingularMessageField(value: &self._end) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) - } - if self.values != false { - try visitor.visitSingularBoolField(value: self.values, fieldNumber: 2) - } - try { if let v = self._start { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try { if let v = self._end { - try visitor.visitSingularMessageField(value: v, fieldNumber: 4) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LabelRequest, rhs: Logproto_LabelRequest) -> Bool { - if lhs.name != rhs.name {return false} - if lhs.values != rhs.values {return false} - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LabelResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LabelResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "values"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedStringField(value: &self.values) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.values.isEmpty { - try visitor.visitRepeatedStringField(value: self.values, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LabelResponse, rhs: Logproto_LabelResponse) -> Bool { - if lhs.values != rhs.values {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_StreamAdapter: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".StreamAdapter" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "labels"), - 2: .same(proto: "entries"), - 3: .same(proto: "hash"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.labels) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &self.hash) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.labels.isEmpty { - try visitor.visitSingularStringField(value: self.labels, fieldNumber: 1) - } - if !self.entries.isEmpty { - try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 2) - } - if self.hash != 0 { - try visitor.visitSingularUInt64Field(value: self.hash, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_StreamAdapter, rhs: Logproto_StreamAdapter) -> Bool { - if lhs.labels != rhs.labels {return false} - if lhs.entries != rhs.entries {return false} - if lhs.hash != rhs.hash {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_EntryAdapter: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".EntryAdapter" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "timestamp"), - 2: .same(proto: "line"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.line) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._timestamp { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.line.isEmpty { - try visitor.visitSingularStringField(value: self.line, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_EntryAdapter, rhs: Logproto_EntryAdapter) -> Bool { - if lhs._timestamp != rhs._timestamp {return false} - if lhs.line != rhs.line {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_Sample: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Sample" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "timestamp"), - 2: .same(proto: "value"), - 3: .same(proto: "hash"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.timestamp) }() - case 2: try { try decoder.decodeSingularDoubleField(value: &self.value) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &self.hash) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.timestamp != 0 { - try visitor.visitSingularInt64Field(value: self.timestamp, fieldNumber: 1) - } - if self.value != 0 { - try visitor.visitSingularDoubleField(value: self.value, fieldNumber: 2) - } - if self.hash != 0 { - try visitor.visitSingularUInt64Field(value: self.hash, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_Sample, rhs: Logproto_Sample) -> Bool { - if lhs.timestamp != rhs.timestamp {return false} - if lhs.value != rhs.value {return false} - if lhs.hash != rhs.hash {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LegacySample: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LegacySample" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "value"), - 2: .standard(proto: "timestamp_ms"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularDoubleField(value: &self.value) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.timestampMs) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.value != 0 { - try visitor.visitSingularDoubleField(value: self.value, fieldNumber: 1) - } - if self.timestampMs != 0 { - try visitor.visitSingularInt64Field(value: self.timestampMs, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LegacySample, rhs: Logproto_LegacySample) -> Bool { - if lhs.value != rhs.value {return false} - if lhs.timestampMs != rhs.timestampMs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_Series: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Series" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "labels"), - 2: .same(proto: "samples"), - 3: .same(proto: "streamHash"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.labels) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.samples) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &self.streamHash) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.labels.isEmpty { - try visitor.visitSingularStringField(value: self.labels, fieldNumber: 1) - } - if !self.samples.isEmpty { - try visitor.visitRepeatedMessageField(value: self.samples, fieldNumber: 2) - } - if self.streamHash != 0 { - try visitor.visitSingularUInt64Field(value: self.streamHash, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_Series, rhs: Logproto_Series) -> Bool { - if lhs.labels != rhs.labels {return false} - if lhs.samples != rhs.samples {return false} - if lhs.streamHash != rhs.streamHash {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_TailRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TailRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "query"), - 3: .same(proto: "delayFor"), - 4: .same(proto: "limit"), - 5: .same(proto: "start"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.query) }() - case 3: try { try decoder.decodeSingularUInt32Field(value: &self.delayFor) }() - case 4: try { try decoder.decodeSingularUInt32Field(value: &self.limit) }() - case 5: try { try decoder.decodeSingularMessageField(value: &self._start) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.query.isEmpty { - try visitor.visitSingularStringField(value: self.query, fieldNumber: 1) - } - if self.delayFor != 0 { - try visitor.visitSingularUInt32Field(value: self.delayFor, fieldNumber: 3) - } - if self.limit != 0 { - try visitor.visitSingularUInt32Field(value: self.limit, fieldNumber: 4) - } - try { if let v = self._start { - try visitor.visitSingularMessageField(value: v, fieldNumber: 5) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_TailRequest, rhs: Logproto_TailRequest) -> Bool { - if lhs.query != rhs.query {return false} - if lhs.delayFor != rhs.delayFor {return false} - if lhs.limit != rhs.limit {return false} - if lhs._start != rhs._start {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_TailResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TailResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "stream"), - 2: .same(proto: "droppedStreams"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._stream) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.droppedStreams) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._stream { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if !self.droppedStreams.isEmpty { - try visitor.visitRepeatedMessageField(value: self.droppedStreams, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_TailResponse, rhs: Logproto_TailResponse) -> Bool { - if lhs._stream != rhs._stream {return false} - if lhs.droppedStreams != rhs.droppedStreams {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_SeriesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SeriesRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "start"), - 2: .same(proto: "end"), - 3: .same(proto: "groups"), - 4: .same(proto: "shards"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._start) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._end) }() - case 3: try { try decoder.decodeRepeatedStringField(value: &self.groups) }() - case 4: try { try decoder.decodeRepeatedStringField(value: &self.shards) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._start { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = self._end { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if !self.groups.isEmpty { - try visitor.visitRepeatedStringField(value: self.groups, fieldNumber: 3) - } - if !self.shards.isEmpty { - try visitor.visitRepeatedStringField(value: self.shards, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_SeriesRequest, rhs: Logproto_SeriesRequest) -> Bool { - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.groups != rhs.groups {return false} - if lhs.shards != rhs.shards {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_SeriesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SeriesResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "series"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.series) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.series.isEmpty { - try visitor.visitRepeatedMessageField(value: self.series, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_SeriesResponse, rhs: Logproto_SeriesResponse) -> Bool { - if lhs.series != rhs.series {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_SeriesIdentifier: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".SeriesIdentifier" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "labels"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.labels) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.labels.isEmpty { - try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.labels, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_SeriesIdentifier, rhs: Logproto_SeriesIdentifier) -> Bool { - if lhs.labels != rhs.labels {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_DroppedStream: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".DroppedStream" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "from"), - 2: .same(proto: "to"), - 3: .same(proto: "labels"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &self._from) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._to) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.labels) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = self._from { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = self._to { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - if !self.labels.isEmpty { - try visitor.visitSingularStringField(value: self.labels, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_DroppedStream, rhs: Logproto_DroppedStream) -> Bool { - if lhs._from != rhs._from {return false} - if lhs._to != rhs._to {return false} - if lhs.labels != rhs.labels {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_TimeSeriesChunk: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TimeSeriesChunk" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "from_ingester_id"), - 2: .standard(proto: "user_id"), - 3: .same(proto: "labels"), - 4: .same(proto: "chunks"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.fromIngesterID) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.userID) }() - case 3: try { try decoder.decodeRepeatedMessageField(value: &self.labels) }() - case 4: try { try decoder.decodeRepeatedMessageField(value: &self.chunks) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.fromIngesterID.isEmpty { - try visitor.visitSingularStringField(value: self.fromIngesterID, fieldNumber: 1) - } - if !self.userID.isEmpty { - try visitor.visitSingularStringField(value: self.userID, fieldNumber: 2) - } - if !self.labels.isEmpty { - try visitor.visitRepeatedMessageField(value: self.labels, fieldNumber: 3) - } - if !self.chunks.isEmpty { - try visitor.visitRepeatedMessageField(value: self.chunks, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_TimeSeriesChunk, rhs: Logproto_TimeSeriesChunk) -> Bool { - if lhs.fromIngesterID != rhs.fromIngesterID {return false} - if lhs.userID != rhs.userID {return false} - if lhs.labels != rhs.labels {return false} - if lhs.chunks != rhs.chunks {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LabelPair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LabelPair" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "value"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.value) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.name.isEmpty { - try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) - } - if !self.value.isEmpty { - try visitor.visitSingularStringField(value: self.value, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LabelPair, rhs: Logproto_LabelPair) -> Bool { - if lhs.name != rhs.name {return false} - if lhs.value != rhs.value {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LegacyLabelPair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LegacyLabelPair" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "name"), - 2: .same(proto: "value"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularBytesField(value: &self.name) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.value) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.name.isEmpty { - try visitor.visitSingularBytesField(value: self.name, fieldNumber: 1) - } - if !self.value.isEmpty { - try visitor.visitSingularBytesField(value: self.value, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LegacyLabelPair, rhs: Logproto_LegacyLabelPair) -> Bool { - if lhs.name != rhs.name {return false} - if lhs.value != rhs.value {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_Chunk: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Chunk" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "data"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularBytesField(value: &self.data) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.data.isEmpty { - try visitor.visitSingularBytesField(value: self.data, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_Chunk, rhs: Logproto_Chunk) -> Bool { - if lhs.data != rhs.data {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_TransferChunksResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TransferChunksResponse" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() - - mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } - } - - func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_TransferChunksResponse, rhs: Logproto_TransferChunksResponse) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_TailersCountRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TailersCountRequest" - static let _protobuf_nameMap = SwiftProtobuf._NameMap() - - mutating func decodeMessage(decoder: inout D) throws { - while let _ = try decoder.nextFieldNumber() { - } - } - - func traverse(visitor: inout V) throws { - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_TailersCountRequest, rhs: Logproto_TailersCountRequest) -> Bool { - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_TailersCountResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".TailersCountResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "count"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularUInt32Field(value: &self.count) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.count != 0 { - try visitor.visitSingularUInt32Field(value: self.count, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_TailersCountResponse, rhs: Logproto_TailersCountResponse) -> Bool { - if lhs.count != rhs.count {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_GetChunkIDsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GetChunkIDsRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "matchers"), - 2: .same(proto: "start"), - 3: .same(proto: "end"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.matchers) }() - case 2: try { try decoder.decodeSingularMessageField(value: &self._start) }() - case 3: try { try decoder.decodeSingularMessageField(value: &self._end) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - if !self.matchers.isEmpty { - try visitor.visitSingularStringField(value: self.matchers, fieldNumber: 1) - } - try { if let v = self._start { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try { if let v = self._end { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_GetChunkIDsRequest, rhs: Logproto_GetChunkIDsRequest) -> Bool { - if lhs.matchers != rhs.matchers {return false} - if lhs._start != rhs._start {return false} - if lhs._end != rhs._end {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_GetChunkIDsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GetChunkIDsResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "chunkIDs"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedStringField(value: &self.chunkIds) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.chunkIds.isEmpty { - try visitor.visitRepeatedStringField(value: self.chunkIds, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_GetChunkIDsResponse, rhs: Logproto_GetChunkIDsResponse) -> Bool { - if lhs.chunkIds != rhs.chunkIds {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_ChunkRef: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".ChunkRef" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "fingerprint"), - 2: .standard(proto: "user_id"), - 3: .same(proto: "from"), - 4: .same(proto: "through"), - 5: .same(proto: "checksum"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularUInt64Field(value: &self.fingerprint) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.userID) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.from) }() - case 4: try { try decoder.decodeSingularInt64Field(value: &self.through) }() - case 5: try { try decoder.decodeSingularUInt32Field(value: &self.checksum) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.fingerprint != 0 { - try visitor.visitSingularUInt64Field(value: self.fingerprint, fieldNumber: 1) - } - if !self.userID.isEmpty { - try visitor.visitSingularStringField(value: self.userID, fieldNumber: 2) - } - if self.from != 0 { - try visitor.visitSingularInt64Field(value: self.from, fieldNumber: 3) - } - if self.through != 0 { - try visitor.visitSingularInt64Field(value: self.through, fieldNumber: 4) - } - if self.checksum != 0 { - try visitor.visitSingularUInt32Field(value: self.checksum, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_ChunkRef, rhs: Logproto_ChunkRef) -> Bool { - if lhs.fingerprint != rhs.fingerprint {return false} - if lhs.userID != rhs.userID {return false} - if lhs.from != rhs.from {return false} - if lhs.through != rhs.through {return false} - if lhs.checksum != rhs.checksum {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LabelValuesForMetricNameRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LabelValuesForMetricNameRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "metric_name"), - 2: .standard(proto: "label_name"), - 3: .same(proto: "from"), - 4: .same(proto: "through"), - 5: .same(proto: "matchers"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.metricName) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.labelName) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.from) }() - case 4: try { try decoder.decodeSingularInt64Field(value: &self.through) }() - case 5: try { try decoder.decodeSingularStringField(value: &self.matchers) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.metricName.isEmpty { - try visitor.visitSingularStringField(value: self.metricName, fieldNumber: 1) - } - if !self.labelName.isEmpty { - try visitor.visitSingularStringField(value: self.labelName, fieldNumber: 2) - } - if self.from != 0 { - try visitor.visitSingularInt64Field(value: self.from, fieldNumber: 3) - } - if self.through != 0 { - try visitor.visitSingularInt64Field(value: self.through, fieldNumber: 4) - } - if !self.matchers.isEmpty { - try visitor.visitSingularStringField(value: self.matchers, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LabelValuesForMetricNameRequest, rhs: Logproto_LabelValuesForMetricNameRequest) -> Bool { - if lhs.metricName != rhs.metricName {return false} - if lhs.labelName != rhs.labelName {return false} - if lhs.from != rhs.from {return false} - if lhs.through != rhs.through {return false} - if lhs.matchers != rhs.matchers {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_LabelNamesForMetricNameRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".LabelNamesForMetricNameRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "metric_name"), - 2: .same(proto: "from"), - 3: .same(proto: "through"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.metricName) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.from) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.through) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.metricName.isEmpty { - try visitor.visitSingularStringField(value: self.metricName, fieldNumber: 1) - } - if self.from != 0 { - try visitor.visitSingularInt64Field(value: self.from, fieldNumber: 2) - } - if self.through != 0 { - try visitor.visitSingularInt64Field(value: self.through, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_LabelNamesForMetricNameRequest, rhs: Logproto_LabelNamesForMetricNameRequest) -> Bool { - if lhs.metricName != rhs.metricName {return false} - if lhs.from != rhs.from {return false} - if lhs.through != rhs.through {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_GetChunkRefRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GetChunkRefRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "from"), - 2: .same(proto: "through"), - 3: .same(proto: "matchers"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.from) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.through) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.matchers) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.from != 0 { - try visitor.visitSingularInt64Field(value: self.from, fieldNumber: 1) - } - if self.through != 0 { - try visitor.visitSingularInt64Field(value: self.through, fieldNumber: 2) - } - if !self.matchers.isEmpty { - try visitor.visitSingularStringField(value: self.matchers, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_GetChunkRefRequest, rhs: Logproto_GetChunkRefRequest) -> Bool { - if lhs.from != rhs.from {return false} - if lhs.through != rhs.through {return false} - if lhs.matchers != rhs.matchers {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_GetChunkRefResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GetChunkRefResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "refs"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.refs) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.refs.isEmpty { - try visitor.visitRepeatedMessageField(value: self.refs, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_GetChunkRefResponse, rhs: Logproto_GetChunkRefResponse) -> Bool { - if lhs.refs != rhs.refs {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_GetSeriesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GetSeriesRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "from"), - 2: .same(proto: "through"), - 3: .same(proto: "matchers"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.from) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.through) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.matchers) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.from != 0 { - try visitor.visitSingularInt64Field(value: self.from, fieldNumber: 1) - } - if self.through != 0 { - try visitor.visitSingularInt64Field(value: self.through, fieldNumber: 2) - } - if !self.matchers.isEmpty { - try visitor.visitSingularStringField(value: self.matchers, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_GetSeriesRequest, rhs: Logproto_GetSeriesRequest) -> Bool { - if lhs.from != rhs.from {return false} - if lhs.through != rhs.through {return false} - if lhs.matchers != rhs.matchers {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_GetSeriesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".GetSeriesResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "series"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.series) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.series.isEmpty { - try visitor.visitRepeatedMessageField(value: self.series, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_GetSeriesResponse, rhs: Logproto_GetSeriesResponse) -> Bool { - if lhs.series != rhs.series {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_IndexSeries: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".IndexSeries" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "labels"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.labels) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.labels.isEmpty { - try visitor.visitRepeatedMessageField(value: self.labels, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_IndexSeries, rhs: Logproto_IndexSeries) -> Bool { - if lhs.labels != rhs.labels {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_QueryIndexResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".QueryIndexResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "QueryKey"), - 2: .same(proto: "rows"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.queryKey) }() - case 2: try { try decoder.decodeRepeatedMessageField(value: &self.rows) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.queryKey.isEmpty { - try visitor.visitSingularStringField(value: self.queryKey, fieldNumber: 1) - } - if !self.rows.isEmpty { - try visitor.visitRepeatedMessageField(value: self.rows, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_QueryIndexResponse, rhs: Logproto_QueryIndexResponse) -> Bool { - if lhs.queryKey != rhs.queryKey {return false} - if lhs.rows != rhs.rows {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_Row: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Row" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "rangeValue"), - 2: .same(proto: "value"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularBytesField(value: &self.rangeValue) }() - case 2: try { try decoder.decodeSingularBytesField(value: &self.value) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.rangeValue.isEmpty { - try visitor.visitSingularBytesField(value: self.rangeValue, fieldNumber: 1) - } - if !self.value.isEmpty { - try visitor.visitSingularBytesField(value: self.value, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_Row, rhs: Logproto_Row) -> Bool { - if lhs.rangeValue != rhs.rangeValue {return false} - if lhs.value != rhs.value {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_QueryIndexRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".QueryIndexRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "Queries"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeRepeatedMessageField(value: &self.queries) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.queries.isEmpty { - try visitor.visitRepeatedMessageField(value: self.queries, fieldNumber: 1) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_QueryIndexRequest, rhs: Logproto_QueryIndexRequest) -> Bool { - if lhs.queries != rhs.queries {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_IndexQuery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".IndexQuery" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "tableName"), - 2: .same(proto: "hashValue"), - 3: .same(proto: "rangeValuePrefix"), - 4: .same(proto: "rangeValueStart"), - 5: .same(proto: "valueEqual"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularStringField(value: &self.tableName) }() - case 2: try { try decoder.decodeSingularStringField(value: &self.hashValue_p) }() - case 3: try { try decoder.decodeSingularBytesField(value: &self.rangeValuePrefix) }() - case 4: try { try decoder.decodeSingularBytesField(value: &self.rangeValueStart) }() - case 5: try { try decoder.decodeSingularBytesField(value: &self.valueEqual) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if !self.tableName.isEmpty { - try visitor.visitSingularStringField(value: self.tableName, fieldNumber: 1) - } - if !self.hashValue_p.isEmpty { - try visitor.visitSingularStringField(value: self.hashValue_p, fieldNumber: 2) - } - if !self.rangeValuePrefix.isEmpty { - try visitor.visitSingularBytesField(value: self.rangeValuePrefix, fieldNumber: 3) - } - if !self.rangeValueStart.isEmpty { - try visitor.visitSingularBytesField(value: self.rangeValueStart, fieldNumber: 4) - } - if !self.valueEqual.isEmpty { - try visitor.visitSingularBytesField(value: self.valueEqual, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_IndexQuery, rhs: Logproto_IndexQuery) -> Bool { - if lhs.tableName != rhs.tableName {return false} - if lhs.hashValue_p != rhs.hashValue_p {return false} - if lhs.rangeValuePrefix != rhs.rangeValuePrefix {return false} - if lhs.rangeValueStart != rhs.rangeValueStart {return false} - if lhs.valueEqual != rhs.valueEqual {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_IndexStatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".IndexStatsRequest" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "from"), - 2: .same(proto: "through"), - 3: .same(proto: "matchers"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.from) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.through) }() - case 3: try { try decoder.decodeSingularStringField(value: &self.matchers) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.from != 0 { - try visitor.visitSingularInt64Field(value: self.from, fieldNumber: 1) - } - if self.through != 0 { - try visitor.visitSingularInt64Field(value: self.through, fieldNumber: 2) - } - if !self.matchers.isEmpty { - try visitor.visitSingularStringField(value: self.matchers, fieldNumber: 3) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_IndexStatsRequest, rhs: Logproto_IndexStatsRequest) -> Bool { - if lhs.from != rhs.from {return false} - if lhs.through != rhs.through {return false} - if lhs.matchers != rhs.matchers {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Logproto_IndexStatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".IndexStatsResponse" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "streams"), - 2: .same(proto: "chunks"), - 3: .same(proto: "bytes"), - 4: .same(proto: "entries"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularUInt64Field(value: &self.streams) }() - case 2: try { try decoder.decodeSingularUInt64Field(value: &self.chunks) }() - case 3: try { try decoder.decodeSingularUInt64Field(value: &self.bytes) }() - case 4: try { try decoder.decodeSingularUInt64Field(value: &self.entries) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.streams != 0 { - try visitor.visitSingularUInt64Field(value: self.streams, fieldNumber: 1) - } - if self.chunks != 0 { - try visitor.visitSingularUInt64Field(value: self.chunks, fieldNumber: 2) - } - if self.bytes != 0 { - try visitor.visitSingularUInt64Field(value: self.bytes, fieldNumber: 3) - } - if self.entries != 0 { - try visitor.visitSingularUInt64Field(value: self.entries, fieldNumber: 4) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Logproto_IndexStatsResponse, rhs: Logproto_IndexStatsResponse) -> Bool { - if lhs.streams != rhs.streams {return false} - if lhs.chunks != rhs.chunks {return false} - if lhs.bytes != rhs.bytes {return false} - if lhs.entries != rhs.entries {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/LoggingLoki/Proto/gen/swift/stats.pb.swift b/Sources/LoggingLoki/Proto/gen/swift/stats.pb.swift deleted file mode 100644 index c86803f..0000000 --- a/Sources/LoggingLoki/Proto/gen/swift/stats.pb.swift +++ /dev/null @@ -1,481 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: stats.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// Result contains LogQL query statistics. -struct Stats_Result { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - var summary: Stats_Summary { - get {return _storage._summary ?? Stats_Summary()} - set {_uniqueStorage()._summary = newValue} - } - /// Returns true if `summary` has been explicitly set. - var hasSummary: Bool {return _storage._summary != nil} - /// Clears the value of `summary`. Subsequent reads from it will return its default value. - mutating func clearSummary() {_uniqueStorage()._summary = nil} - - var store: Stats_Store { - get {return _storage._store ?? Stats_Store()} - set {_uniqueStorage()._store = newValue} - } - /// Returns true if `store` has been explicitly set. - var hasStore: Bool {return _storage._store != nil} - /// Clears the value of `store`. Subsequent reads from it will return its default value. - mutating func clearStore() {_uniqueStorage()._store = nil} - - var ingester: Stats_Ingester { - get {return _storage._ingester ?? Stats_Ingester()} - set {_uniqueStorage()._ingester = newValue} - } - /// Returns true if `ingester` has been explicitly set. - var hasIngester: Bool {return _storage._ingester != nil} - /// Clears the value of `ingester`. Subsequent reads from it will return its default value. - mutating func clearIngester() {_uniqueStorage()._ingester = nil} - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} - - fileprivate var _storage = _StorageClass.defaultInstance -} - -/// Summary is the summary of a query statistics. -struct Stats_Summary { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Total bytes processed per second. - var bytesProcessedPerSecond: Int64 = 0 - - /// Total lines processed per second. - var linesProcessedPerSecond: Int64 = 0 - - /// Total bytes processed. - var totalBytesProcessed: Int64 = 0 - - /// Total lines processed. - var totalLinesProcessed: Int64 = 0 - - /// Execution time in seconds. - var execTime: Double = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Stats_Store { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// The total of chunk reference fetched from index. - var totalChunksRef: Int64 = 0 - - /// Total number of chunks fetched. - var totalChunksDownloaded: Int64 = 0 - - /// Time spent fetching chunks in nanoseconds. - var chunksDownloadTime: Double = 0 - - /// Total bytes processed but was already in memory. (found in the headchunk) - var headChunkBytes: Int64 = 0 - - /// Total lines processed but was already in memory. (found in the headchunk) - var headChunkLines: Int64 = 0 - - /// Total bytes decompressed and processed from chunks. - var decompressedBytes: Int64 = 0 - - /// Total lines decompressed and processed from chunks. - var decompressedLines: Int64 = 0 - - /// Total bytes of compressed chunks (blocks) processed. - var compressedBytes: Int64 = 0 - - /// Total duplicates found while processing. - var totalDuplicates: Int64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -struct Stats_Ingester { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Total ingester reached for this query. - var totalReached: Int32 = 0 - - /// Total of chunks matched by the query from ingesters - var totalChunksMatched: Int64 = 0 - - /// Total of batches sent from ingesters. - var totalBatches: Int64 = 0 - - /// Total lines sent by ingesters. - var totalLinesSent: Int64 = 0 - - /// Total bytes processed but was already in memory. (found in the headchunk) - var headChunkBytes: Int64 = 0 - - /// Total lines processed but was already in memory. (found in the headchunk) - var headChunkLines: Int64 = 0 - - /// Total bytes decompressed and processed from chunks. - var decompressedBytes: Int64 = 0 - - /// Total lines decompressed and processed from chunks. - var decompressedLines: Int64 = 0 - - /// Total bytes of compressed chunks (blocks) processed. - var compressedBytes: Int64 = 0 - - /// Total duplicates found while processing. - var totalDuplicates: Int64 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Stats_Result: @unchecked Sendable {} -extension Stats_Summary: @unchecked Sendable {} -extension Stats_Store: @unchecked Sendable {} -extension Stats_Ingester: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "stats" - -extension Stats_Result: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Result" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "summary"), - 2: .same(proto: "store"), - 3: .same(proto: "ingester"), - ] - - fileprivate class _StorageClass { - var _summary: Stats_Summary? = nil - var _store: Stats_Store? = nil - var _ingester: Stats_Ingester? = nil - - static let defaultInstance = _StorageClass() - - private init() {} - - init(copying source: _StorageClass) { - _summary = source._summary - _store = source._store - _ingester = source._ingester - } - } - - fileprivate mutating func _uniqueStorage() -> _StorageClass { - if !isKnownUniquelyReferenced(&_storage) { - _storage = _StorageClass(copying: _storage) - } - return _storage - } - - mutating func decodeMessage(decoder: inout D) throws { - _ = _uniqueStorage() - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularMessageField(value: &_storage._summary) }() - case 2: try { try decoder.decodeSingularMessageField(value: &_storage._store) }() - case 3: try { try decoder.decodeSingularMessageField(value: &_storage._ingester) }() - default: break - } - } - } - } - - func traverse(visitor: inout V) throws { - try withExtendedLifetime(_storage) { (_storage: _StorageClass) in - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every if/case branch local when no optimizations - // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and - // https://github.com/apple/swift-protobuf/issues/1182 - try { if let v = _storage._summary { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - try { if let v = _storage._store { - try visitor.visitSingularMessageField(value: v, fieldNumber: 2) - } }() - try { if let v = _storage._ingester { - try visitor.visitSingularMessageField(value: v, fieldNumber: 3) - } }() - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Stats_Result, rhs: Stats_Result) -> Bool { - if lhs._storage !== rhs._storage { - let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in - let _storage = _args.0 - let rhs_storage = _args.1 - if _storage._summary != rhs_storage._summary {return false} - if _storage._store != rhs_storage._store {return false} - if _storage._ingester != rhs_storage._ingester {return false} - return true - } - if !storagesAreEqual {return false} - } - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Stats_Summary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Summary" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "bytesProcessedPerSecond"), - 2: .same(proto: "linesProcessedPerSecond"), - 3: .same(proto: "totalBytesProcessed"), - 4: .same(proto: "totalLinesProcessed"), - 5: .same(proto: "execTime"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.bytesProcessedPerSecond) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.linesProcessedPerSecond) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.totalBytesProcessed) }() - case 4: try { try decoder.decodeSingularInt64Field(value: &self.totalLinesProcessed) }() - case 5: try { try decoder.decodeSingularDoubleField(value: &self.execTime) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.bytesProcessedPerSecond != 0 { - try visitor.visitSingularInt64Field(value: self.bytesProcessedPerSecond, fieldNumber: 1) - } - if self.linesProcessedPerSecond != 0 { - try visitor.visitSingularInt64Field(value: self.linesProcessedPerSecond, fieldNumber: 2) - } - if self.totalBytesProcessed != 0 { - try visitor.visitSingularInt64Field(value: self.totalBytesProcessed, fieldNumber: 3) - } - if self.totalLinesProcessed != 0 { - try visitor.visitSingularInt64Field(value: self.totalLinesProcessed, fieldNumber: 4) - } - if self.execTime != 0 { - try visitor.visitSingularDoubleField(value: self.execTime, fieldNumber: 5) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Stats_Summary, rhs: Stats_Summary) -> Bool { - if lhs.bytesProcessedPerSecond != rhs.bytesProcessedPerSecond {return false} - if lhs.linesProcessedPerSecond != rhs.linesProcessedPerSecond {return false} - if lhs.totalBytesProcessed != rhs.totalBytesProcessed {return false} - if lhs.totalLinesProcessed != rhs.totalLinesProcessed {return false} - if lhs.execTime != rhs.execTime {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Stats_Store: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Store" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "totalChunksRef"), - 2: .same(proto: "totalChunksDownloaded"), - 3: .same(proto: "chunksDownloadTime"), - 4: .same(proto: "headChunkBytes"), - 5: .same(proto: "headChunkLines"), - 6: .same(proto: "decompressedBytes"), - 7: .same(proto: "decompressedLines"), - 8: .same(proto: "compressedBytes"), - 9: .same(proto: "totalDuplicates"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.totalChunksRef) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.totalChunksDownloaded) }() - case 3: try { try decoder.decodeSingularDoubleField(value: &self.chunksDownloadTime) }() - case 4: try { try decoder.decodeSingularInt64Field(value: &self.headChunkBytes) }() - case 5: try { try decoder.decodeSingularInt64Field(value: &self.headChunkLines) }() - case 6: try { try decoder.decodeSingularInt64Field(value: &self.decompressedBytes) }() - case 7: try { try decoder.decodeSingularInt64Field(value: &self.decompressedLines) }() - case 8: try { try decoder.decodeSingularInt64Field(value: &self.compressedBytes) }() - case 9: try { try decoder.decodeSingularInt64Field(value: &self.totalDuplicates) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.totalChunksRef != 0 { - try visitor.visitSingularInt64Field(value: self.totalChunksRef, fieldNumber: 1) - } - if self.totalChunksDownloaded != 0 { - try visitor.visitSingularInt64Field(value: self.totalChunksDownloaded, fieldNumber: 2) - } - if self.chunksDownloadTime != 0 { - try visitor.visitSingularDoubleField(value: self.chunksDownloadTime, fieldNumber: 3) - } - if self.headChunkBytes != 0 { - try visitor.visitSingularInt64Field(value: self.headChunkBytes, fieldNumber: 4) - } - if self.headChunkLines != 0 { - try visitor.visitSingularInt64Field(value: self.headChunkLines, fieldNumber: 5) - } - if self.decompressedBytes != 0 { - try visitor.visitSingularInt64Field(value: self.decompressedBytes, fieldNumber: 6) - } - if self.decompressedLines != 0 { - try visitor.visitSingularInt64Field(value: self.decompressedLines, fieldNumber: 7) - } - if self.compressedBytes != 0 { - try visitor.visitSingularInt64Field(value: self.compressedBytes, fieldNumber: 8) - } - if self.totalDuplicates != 0 { - try visitor.visitSingularInt64Field(value: self.totalDuplicates, fieldNumber: 9) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Stats_Store, rhs: Stats_Store) -> Bool { - if lhs.totalChunksRef != rhs.totalChunksRef {return false} - if lhs.totalChunksDownloaded != rhs.totalChunksDownloaded {return false} - if lhs.chunksDownloadTime != rhs.chunksDownloadTime {return false} - if lhs.headChunkBytes != rhs.headChunkBytes {return false} - if lhs.headChunkLines != rhs.headChunkLines {return false} - if lhs.decompressedBytes != rhs.decompressedBytes {return false} - if lhs.decompressedLines != rhs.decompressedLines {return false} - if lhs.compressedBytes != rhs.compressedBytes {return false} - if lhs.totalDuplicates != rhs.totalDuplicates {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - -extension Stats_Ingester: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Ingester" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "totalReached"), - 2: .same(proto: "totalChunksMatched"), - 3: .same(proto: "totalBatches"), - 4: .same(proto: "totalLinesSent"), - 5: .same(proto: "headChunkBytes"), - 6: .same(proto: "headChunkLines"), - 7: .same(proto: "decompressedBytes"), - 8: .same(proto: "decompressedLines"), - 9: .same(proto: "compressedBytes"), - 10: .same(proto: "totalDuplicates"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt32Field(value: &self.totalReached) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.totalChunksMatched) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.totalBatches) }() - case 4: try { try decoder.decodeSingularInt64Field(value: &self.totalLinesSent) }() - case 5: try { try decoder.decodeSingularInt64Field(value: &self.headChunkBytes) }() - case 6: try { try decoder.decodeSingularInt64Field(value: &self.headChunkLines) }() - case 7: try { try decoder.decodeSingularInt64Field(value: &self.decompressedBytes) }() - case 8: try { try decoder.decodeSingularInt64Field(value: &self.decompressedLines) }() - case 9: try { try decoder.decodeSingularInt64Field(value: &self.compressedBytes) }() - case 10: try { try decoder.decodeSingularInt64Field(value: &self.totalDuplicates) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.totalReached != 0 { - try visitor.visitSingularInt32Field(value: self.totalReached, fieldNumber: 1) - } - if self.totalChunksMatched != 0 { - try visitor.visitSingularInt64Field(value: self.totalChunksMatched, fieldNumber: 2) - } - if self.totalBatches != 0 { - try visitor.visitSingularInt64Field(value: self.totalBatches, fieldNumber: 3) - } - if self.totalLinesSent != 0 { - try visitor.visitSingularInt64Field(value: self.totalLinesSent, fieldNumber: 4) - } - if self.headChunkBytes != 0 { - try visitor.visitSingularInt64Field(value: self.headChunkBytes, fieldNumber: 5) - } - if self.headChunkLines != 0 { - try visitor.visitSingularInt64Field(value: self.headChunkLines, fieldNumber: 6) - } - if self.decompressedBytes != 0 { - try visitor.visitSingularInt64Field(value: self.decompressedBytes, fieldNumber: 7) - } - if self.decompressedLines != 0 { - try visitor.visitSingularInt64Field(value: self.decompressedLines, fieldNumber: 8) - } - if self.compressedBytes != 0 { - try visitor.visitSingularInt64Field(value: self.compressedBytes, fieldNumber: 9) - } - if self.totalDuplicates != 0 { - try visitor.visitSingularInt64Field(value: self.totalDuplicates, fieldNumber: 10) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Stats_Ingester, rhs: Stats_Ingester) -> Bool { - if lhs.totalReached != rhs.totalReached {return false} - if lhs.totalChunksMatched != rhs.totalChunksMatched {return false} - if lhs.totalBatches != rhs.totalBatches {return false} - if lhs.totalLinesSent != rhs.totalLinesSent {return false} - if lhs.headChunkBytes != rhs.headChunkBytes {return false} - if lhs.headChunkLines != rhs.headChunkLines {return false} - if lhs.decompressedBytes != rhs.decompressedBytes {return false} - if lhs.decompressedLines != rhs.decompressedLines {return false} - if lhs.compressedBytes != rhs.compressedBytes {return false} - if lhs.totalDuplicates != rhs.totalDuplicates {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/LoggingLoki/Proto/gen/swift/timestamp.pb.swift b/Sources/LoggingLoki/Proto/gen/swift/timestamp.pb.swift deleted file mode 100644 index fb74d2c..0000000 --- a/Sources/LoggingLoki/Proto/gen/swift/timestamp.pb.swift +++ /dev/null @@ -1,207 +0,0 @@ -// DO NOT EDIT. -// swift-format-ignore-file -// -// Generated by the Swift generator plugin for the protocol buffer compiler. -// Source: timestamp.proto -// -// For information on using the generated types, please see the documentation: -// https://github.com/apple/swift-protobuf/ - -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import Foundation -import SwiftProtobuf - -// If the compiler emits an error on this type, it is because this file -// was generated by a version of the `protoc` Swift plug-in that is -// incompatible with the version of SwiftProtobuf to which you are linking. -// Please ensure that you are building against the same version of the API -// that was used to generate this file. -fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { - struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} - typealias Version = _2 -} - -/// A Timestamp represents a point in time independent of any time zone or local -/// calendar, encoded as a count of seconds and fractions of seconds at -/// nanosecond resolution. The count is relative to an epoch at UTC midnight on -/// January 1, 1970, in the proleptic Gregorian calendar which extends the -/// Gregorian calendar backwards to year one. -/// -/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -/// second table is needed for interpretation, using a [24-hour linear -/// smear](https://developers.google.com/time/smear). -/// -/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -/// restricting to that range, we ensure that we can convert to and from [RFC -/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -/// -/// # Examples -/// -/// Example 1: Compute Timestamp from POSIX `time()`. -/// -/// Timestamp timestamp; -/// timestamp.set_seconds(time(NULL)); -/// timestamp.set_nanos(0); -/// -/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -/// -/// struct timeval tv; -/// gettimeofday(&tv, NULL); -/// -/// Timestamp timestamp; -/// timestamp.set_seconds(tv.tv_sec); -/// timestamp.set_nanos(tv.tv_usec * 1000); -/// -/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -/// -/// FILETIME ft; -/// GetSystemTimeAsFileTime(&ft); -/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -/// -/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -/// Timestamp timestamp; -/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -/// -/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -/// -/// long millis = System.currentTimeMillis(); -/// -/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -/// .setNanos((int) ((millis % 1000) * 1000000)).build(); -/// -/// Example 5: Compute Timestamp from Java `Instant.now()`. -/// -/// Instant now = Instant.now(); -/// -/// Timestamp timestamp = -/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) -/// .setNanos(now.getNano()).build(); -/// -/// Example 6: Compute Timestamp from current time in Python. -/// -/// timestamp = Timestamp() -/// timestamp.GetCurrentTime() -/// -/// # JSON Mapping -/// -/// In JSON format, the Timestamp type is encoded as a string in the -/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -/// where {year} is always expressed using four digits while {month}, {day}, -/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -/// is required. A proto3 JSON serializer should always use UTC (as indicated by -/// "Z") when printing the Timestamp type and a proto3 JSON parser should be -/// able to accept both UTC and other timezones (as indicated by an offset). -/// -/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -/// 01:30 UTC on January 15, 2017. -/// -/// In JavaScript, one can convert a Date object to this format using the -/// standard -/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) -/// method. In Python, a standard `datetime.datetime` object can be converted -/// to this format using -/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with -/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D -/// ) to obtain a formatter capable of generating timestamps in this format. -struct Google_Protobuf_Timestamp { - // SwiftProtobuf.Message conformance is added in an extension below. See the - // `Message` and `Message+*Additions` files in the SwiftProtobuf library for - // methods supported on all messages. - - /// Represents seconds of UTC time since Unix epoch - /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - /// 9999-12-31T23:59:59Z inclusive. - var seconds: Int64 = 0 - - /// Non-negative fractions of a second at nanosecond resolution. Negative - /// second values with fractions must still have non-negative nanos values - /// that count forward in time. Must be from 0 to 999,999,999 - /// inclusive. - var nanos: Int32 = 0 - - var unknownFields = SwiftProtobuf.UnknownStorage() - - init() {} -} - -#if swift(>=5.5) && canImport(_Concurrency) -extension Google_Protobuf_Timestamp: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - -// MARK: - Code below here is support for the SwiftProtobuf runtime. - -fileprivate let _protobuf_package = "google.protobuf" - -extension Google_Protobuf_Timestamp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - static let protoMessageName: String = _protobuf_package + ".Timestamp" - static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "seconds"), - 2: .same(proto: "nanos"), - ] - - mutating func decodeMessage(decoder: inout D) throws { - while let fieldNumber = try decoder.nextFieldNumber() { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch fieldNumber { - case 1: try { try decoder.decodeSingularInt64Field(value: &self.seconds) }() - case 2: try { try decoder.decodeSingularInt32Field(value: &self.nanos) }() - default: break - } - } - } - - func traverse(visitor: inout V) throws { - if self.seconds != 0 { - try visitor.visitSingularInt64Field(value: self.seconds, fieldNumber: 1) - } - if self.nanos != 0 { - try visitor.visitSingularInt32Field(value: self.nanos, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - static func ==(lhs: Google_Protobuf_Timestamp, rhs: Google_Protobuf_Timestamp) -> Bool { - if lhs.seconds != rhs.seconds {return false} - if lhs.nanos != rhs.nanos {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} diff --git a/Sources/LoggingLoki/Proto/gogo.proto b/Sources/LoggingLoki/Proto/gogo.proto deleted file mode 100644 index 8947d90..0000000 --- a/Sources/LoggingLoki/Proto/gogo.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto2"; -package gogoproto; - -import "google/protobuf/descriptor.proto"; - -option java_package = "com.google.protobuf"; -option java_outer_classname = "GoGoProtos"; -option go_package = "github.com/gogo/protobuf/gogoproto"; - -extend google.protobuf.EnumOptions { - optional bool goproto_enum_prefix = 62001; - optional bool goproto_enum_stringer = 62021; - optional bool enum_stringer = 62022; - optional string enum_customname = 62023; - optional bool enumdecl = 62024; -} - -extend google.protobuf.EnumValueOptions { - optional string enumvalue_customname = 66001; -} - -extend google.protobuf.FileOptions { - optional bool goproto_getters_all = 63001; - optional bool goproto_enum_prefix_all = 63002; - optional bool goproto_stringer_all = 63003; - optional bool verbose_equal_all = 63004; - optional bool face_all = 63005; - optional bool gostring_all = 63006; - optional bool populate_all = 63007; - optional bool stringer_all = 63008; - optional bool onlyone_all = 63009; - - optional bool equal_all = 63013; - optional bool description_all = 63014; - optional bool testgen_all = 63015; - optional bool benchgen_all = 63016; - optional bool marshaler_all = 63017; - optional bool unmarshaler_all = 63018; - optional bool stable_marshaler_all = 63019; - - optional bool sizer_all = 63020; - - optional bool goproto_enum_stringer_all = 63021; - optional bool enum_stringer_all = 63022; - - optional bool unsafe_marshaler_all = 63023; - optional bool unsafe_unmarshaler_all = 63024; - - optional bool goproto_extensions_map_all = 63025; - optional bool goproto_unrecognized_all = 63026; - optional bool gogoproto_import = 63027; - optional bool protosizer_all = 63028; - optional bool compare_all = 63029; - optional bool typedecl_all = 63030; - optional bool enumdecl_all = 63031; - - optional bool goproto_registration = 63032; - optional bool messagename_all = 63033; - - optional bool goproto_sizecache_all = 63034; - optional bool goproto_unkeyed_all = 63035; -} - -extend google.protobuf.MessageOptions { - optional bool goproto_getters = 64001; - optional bool goproto_stringer = 64003; - optional bool verbose_equal = 64004; - optional bool face = 64005; - optional bool gostring = 64006; - optional bool populate = 64007; - optional bool stringer = 67008; - optional bool onlyone = 64009; - - optional bool equal = 64013; - optional bool description = 64014; - optional bool testgen = 64015; - optional bool benchgen = 64016; - optional bool marshaler = 64017; - optional bool unmarshaler = 64018; - optional bool stable_marshaler = 64019; - - optional bool sizer = 64020; - - optional bool unsafe_marshaler = 64023; - optional bool unsafe_unmarshaler = 64024; - - optional bool goproto_extensions_map = 64025; - optional bool goproto_unrecognized = 64026; - - optional bool protosizer = 64028; - optional bool compare = 64029; - - optional bool typedecl = 64030; - - optional bool messagename = 64033; - - optional bool goproto_sizecache = 64034; - optional bool goproto_unkeyed = 64035; -} - -extend google.protobuf.FieldOptions { - optional bool nullable = 65001; - optional bool embed = 65002; - optional string customtype = 65003; - optional string customname = 65004; - optional string jsontag = 65005; - optional string moretags = 65006; - optional string casttype = 65007; - optional string castkey = 65008; - optional string castvalue = 65009; - - optional bool stdtime = 65010; - optional bool stdduration = 65011; - optional bool wktpointer = 65012; - -} \ No newline at end of file diff --git a/Sources/LoggingLoki/Proto/logproto.proto b/Sources/LoggingLoki/Proto/logproto.proto deleted file mode 100644 index e40621f..0000000 --- a/Sources/LoggingLoki/Proto/logproto.proto +++ /dev/null @@ -1,408 +0,0 @@ -syntax = "proto3"; - -package logproto; - -import "gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "stats.proto"; - -option go_package = "github.com/grafana/loki/pkg/logproto"; - -service Pusher { - rpc Push(PushRequest) returns (PushResponse) {} -} - -service Querier { - rpc Query(QueryRequest) returns (stream QueryResponse) {} - - rpc QuerySample(SampleQueryRequest) returns (stream SampleQueryResponse) {} - - rpc Label(LabelRequest) returns (LabelResponse) {} - - rpc Tail(TailRequest) returns (stream TailResponse) {} - - rpc Series(SeriesRequest) returns (SeriesResponse) {} - - rpc TailersCount(TailersCountRequest) returns (TailersCountResponse) {} - - rpc GetChunkIDs(GetChunkIDsRequest) returns (GetChunkIDsResponse) {} - - // Note: this MUST be the same as the variant defined in - // indexgateway.proto on the IndexGateway service. - rpc GetStats(IndexStatsRequest) returns (IndexStatsResponse) {} -} - -service Ingester { - rpc TransferChunks(stream TimeSeriesChunk) returns (TransferChunksResponse) {} -} - -service StreamData { - rpc GetStreamRates(StreamRatesRequest) returns (StreamRatesResponse) {} -} - -message StreamRatesRequest {} - -message StreamRatesResponse { - repeated StreamRate streamRates = 1; -} - -message StreamRate { - uint64 streamHash = 1; - uint64 streamHashNoShard = 2; - int64 rate = 3; // rate in plain bytes. - string tenant = 4; -} - -message PushRequest { - repeated StreamAdapter streams = 1 [ - (gogoproto.jsontag) = "streams", - (gogoproto.customtype) = "Stream" - ]; -} - -message PushResponse {} - -message QueryRequest { - string selector = 1; - uint32 limit = 2; - google.protobuf.Timestamp start = 3 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp end = 4 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - Direction direction = 5; - reserved 6; - repeated string shards = 7 [(gogoproto.jsontag) = "shards,omitempty"]; - repeated Delete deletes = 8; -} - -message SampleQueryRequest { - string selector = 1; - google.protobuf.Timestamp start = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp end = 3 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - repeated string shards = 4 [(gogoproto.jsontag) = "shards,omitempty"]; - repeated Delete deletes = 5; -} - -message Delete { - string selector = 1; - int64 start = 2; - int64 end = 3; -} - -message QueryResponse { - repeated StreamAdapter streams = 1 [ - (gogoproto.customtype) = "Stream", - (gogoproto.nullable) = true - ]; - stats.Ingester stats = 2 [(gogoproto.nullable) = false]; -} - -message SampleQueryResponse { - repeated Series series = 1 [ - (gogoproto.customtype) = "Series", - (gogoproto.nullable) = true - ]; - stats.Ingester stats = 2 [(gogoproto.nullable) = false]; -} - -enum Direction { - FORWARD = 0; - BACKWARD = 1; -} - -message LabelRequest { - string name = 1; - bool values = 2; // True to fetch label values, false for fetch labels names. - google.protobuf.Timestamp start = 3 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = true - ]; - google.protobuf.Timestamp end = 4 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = true - ]; -} - -message LabelResponse { - repeated string values = 1; -} - -message StreamAdapter { - string labels = 1 [(gogoproto.jsontag) = "labels"]; - repeated EntryAdapter entries = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "entries" - ]; - // hash contains the original hash of the stream. - uint64 hash = 3 [(gogoproto.jsontag) = "-"]; -} - -message EntryAdapter { - google.protobuf.Timestamp timestamp = 1 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "ts" - ]; - string line = 2 [(gogoproto.jsontag) = "line"]; -} - -message Sample { - int64 timestamp = 1 [(gogoproto.jsontag) = "ts"]; - double value = 2 [(gogoproto.jsontag) = "value"]; - uint64 hash = 3 [(gogoproto.jsontag) = "hash"]; -} - -// LegacySample exists for backwards compatibility reasons and is deprecated. Do not use. -message LegacySample { - double value = 1; - int64 timestamp_ms = 2; -} - -message Series { - string labels = 1 [(gogoproto.jsontag) = "labels"]; - repeated Sample samples = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "samples" - ]; - uint64 streamHash = 3 [(gogoproto.jsontag) = "streamHash"]; -} - -message TailRequest { - string query = 1; - reserved 2; - uint32 delayFor = 3; - uint32 limit = 4; - google.protobuf.Timestamp start = 5 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; -} - -message TailResponse { - StreamAdapter stream = 1 [(gogoproto.customtype) = "Stream"]; - repeated DroppedStream droppedStreams = 2; -} - -message SeriesRequest { - google.protobuf.Timestamp start = 1 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp end = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - repeated string groups = 3; - repeated string shards = 4 [(gogoproto.jsontag) = "shards,omitempty"]; -} - -message SeriesResponse { - repeated SeriesIdentifier series = 1 [(gogoproto.nullable) = false]; -} - -message SeriesIdentifier { - map labels = 1; -} - -message DroppedStream { - google.protobuf.Timestamp from = 1 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp to = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - string labels = 3; -} - -message TimeSeriesChunk { - string from_ingester_id = 1; - string user_id = 2; - repeated LabelPair labels = 3; - repeated Chunk chunks = 4; -} - -message LabelPair { - string name = 1; - string value = 2; -} - -// LegacyLabelPair exists for backwards compatibility reasons and is deprecated. Do not use. -message LegacyLabelPair { - bytes name = 1; - bytes value = 2; -} - -message Chunk { - bytes data = 1; -} - -message TransferChunksResponse {} - -message TailersCountRequest {} - -message TailersCountResponse { - uint32 count = 1; -} - -message GetChunkIDsRequest { - string matchers = 1; - google.protobuf.Timestamp start = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; - google.protobuf.Timestamp end = 3 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false - ]; -} - -message GetChunkIDsResponse { - repeated string chunkIDs = 1; -} - -// ChunkRef contains the metadata to reference a Chunk. -// It is embedded by the Chunk type itself and used to generate the Chunk -// checksum. So it is imported to take care of the JSON representation of the -// resulting Go struct. -message ChunkRef { - uint64 fingerprint = 1 [(gogoproto.jsontag) = "fingerprint"]; - string user_id = 2 [ - (gogoproto.customname) = "UserID", - (gogoproto.jsontag) = "userID" - ]; - int64 from = 3 [ - (gogoproto.jsontag) = "from", - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - int64 through = 4 [ - (gogoproto.jsontag) = "through", - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - - // The checksum is not written to the external storage. We use crc32, - // Castagnoli table. See http://www.evanjones.ca/crc32c.html. - uint32 checksum = 5 [(gogoproto.jsontag) = "-"]; -} - -message LabelValuesForMetricNameRequest { - string metric_name = 1; - string label_name = 2; - int64 from = 3 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - int64 through = 4 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - string matchers = 5; -} - -message LabelNamesForMetricNameRequest { - string metric_name = 1; - int64 from = 2 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - int64 through = 3 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; -} - -message GetChunkRefRequest { - int64 from = 1 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - int64 through = 2 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - string matchers = 3; -} - -message GetChunkRefResponse { - repeated ChunkRef refs = 1; -} - -message GetSeriesRequest { - int64 from = 1 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - int64 through = 2 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - string matchers = 3; -} - -message GetSeriesResponse { - repeated IndexSeries series = 1 [(gogoproto.nullable) = false]; -} - -// Series calls to the TSDB Index -message IndexSeries { - repeated LabelPair labels = 1 [ - (gogoproto.nullable) = false, - (gogoproto.customtype) = "LabelAdapter" - ]; -} - -message QueryIndexResponse { - string QueryKey = 1; - repeated Row rows = 2; -} - -message Row { - bytes rangeValue = 1; - bytes value = 2; -} - -message QueryIndexRequest { - repeated IndexQuery Queries = 1; -} - -message IndexQuery { - string tableName = 1; - string hashValue = 2; - bytes rangeValuePrefix = 3; - bytes rangeValueStart = 4; - bytes valueEqual = 5; -} - -message IndexStatsRequest { - int64 from = 1 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - int64 through = 2 [ - (gogoproto.customtype) = "github.com/prometheus/common/model.Time", - (gogoproto.nullable) = false - ]; - string matchers = 3; - // TODO(owen-d): add shards to grpc calls so we don't have - // to extract via labels -} - -message IndexStatsResponse { - uint64 streams = 1 [(gogoproto.jsontag) = "streams"]; - uint64 chunks = 2 [(gogoproto.jsontag) = "chunks"]; - uint64 bytes = 3 [(gogoproto.jsontag) = "bytes"]; - uint64 entries = 4 [(gogoproto.jsontag) = "entries"]; -} diff --git a/Sources/LoggingLoki/Proto/push.pb.swift b/Sources/LoggingLoki/Proto/push.pb.swift new file mode 100644 index 0000000..9b0a9ab --- /dev/null +++ b/Sources/LoggingLoki/Proto/push.pb.swift @@ -0,0 +1,303 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: Sources/LoggingLoki/Proto/push.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Logproto_PushRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var streams: [Logproto_StreamAdapter] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Logproto_PushResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Logproto_StreamAdapter { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var labels: String = String() + + var entries: [Logproto_EntryAdapter] = [] + + /// hash contains the original hash of the stream. + var hash: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Logproto_LabelPairAdapter { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var value: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Logproto_EntryAdapter { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var timestamp: SwiftProtobuf.Google_Protobuf_Timestamp { + get {return _timestamp ?? SwiftProtobuf.Google_Protobuf_Timestamp()} + set {_timestamp = newValue} + } + /// Returns true if `timestamp` has been explicitly set. + var hasTimestamp: Bool {return self._timestamp != nil} + /// Clears the value of `timestamp`. Subsequent reads from it will return its default value. + mutating func clearTimestamp() {self._timestamp = nil} + + var line: String = String() + + var structuredMetadata: [Logproto_LabelPairAdapter] = [] + + /// This field shouldn't be used by clients to push data to Loki. + /// It is only used by Loki to return parsed log lines in query responses. + /// TODO: Remove this field from the write path Proto. + var parsed: [Logproto_LabelPairAdapter] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _timestamp: SwiftProtobuf.Google_Protobuf_Timestamp? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Logproto_PushRequest: @unchecked Sendable {} +extension Logproto_PushResponse: @unchecked Sendable {} +extension Logproto_StreamAdapter: @unchecked Sendable {} +extension Logproto_LabelPairAdapter: @unchecked Sendable {} +extension Logproto_EntryAdapter: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "logproto" + +extension Logproto_PushRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PushRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "streams"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.streams) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.streams.isEmpty { + try visitor.visitRepeatedMessageField(value: self.streams, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Logproto_PushRequest, rhs: Logproto_PushRequest) -> Bool { + if lhs.streams != rhs.streams {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Logproto_PushResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PushResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Logproto_PushResponse, rhs: Logproto_PushResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Logproto_StreamAdapter: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StreamAdapter" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "labels"), + 2: .same(proto: "entries"), + 3: .same(proto: "hash"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.labels) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.entries) }() + case 3: try { try decoder.decodeSingularUInt64Field(value: &self.hash) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.labels.isEmpty { + try visitor.visitSingularStringField(value: self.labels, fieldNumber: 1) + } + if !self.entries.isEmpty { + try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 2) + } + if self.hash != 0 { + try visitor.visitSingularUInt64Field(value: self.hash, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Logproto_StreamAdapter, rhs: Logproto_StreamAdapter) -> Bool { + if lhs.labels != rhs.labels {return false} + if lhs.entries != rhs.entries {return false} + if lhs.hash != rhs.hash {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Logproto_LabelPairAdapter: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LabelPairAdapter" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "value"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.value) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Logproto_LabelPairAdapter, rhs: Logproto_LabelPairAdapter) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Logproto_EntryAdapter: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EntryAdapter" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "timestamp"), + 2: .same(proto: "line"), + 3: .same(proto: "structuredMetadata"), + 4: .same(proto: "parsed"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._timestamp) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.line) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.structuredMetadata) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.parsed) }() + default: break + } + } + } + + func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._timestamp { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.line.isEmpty { + try visitor.visitSingularStringField(value: self.line, fieldNumber: 2) + } + if !self.structuredMetadata.isEmpty { + try visitor.visitRepeatedMessageField(value: self.structuredMetadata, fieldNumber: 3) + } + if !self.parsed.isEmpty { + try visitor.visitRepeatedMessageField(value: self.parsed, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Logproto_EntryAdapter, rhs: Logproto_EntryAdapter) -> Bool { + if lhs._timestamp != rhs._timestamp {return false} + if lhs.line != rhs.line {return false} + if lhs.structuredMetadata != rhs.structuredMetadata {return false} + if lhs.parsed != rhs.parsed {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/LoggingLoki/Proto/push.proto b/Sources/LoggingLoki/Proto/push.proto new file mode 100644 index 0000000..5194005 --- /dev/null +++ b/Sources/LoggingLoki/Proto/push.proto @@ -0,0 +1,39 @@ +syntax = "proto3"; + +package logproto; + +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/grafana/loki/pkg/push"; + +service Pusher { + rpc Push(PushRequest) returns (PushResponse) {} +} + +message PushRequest { + repeated StreamAdapter streams = 1; +} + +message PushResponse {} + +message StreamAdapter { + string labels = 1; + repeated EntryAdapter entries = 2; + // hash contains the original hash of the stream. + uint64 hash = 3; +} + +message LabelPairAdapter { + string name = 1; + string value = 2; +} + +message EntryAdapter { + google.protobuf.Timestamp timestamp = 1; + string line = 2; + repeated LabelPairAdapter structuredMetadata = 3; + // This field shouldn't be used by clients to push data to Loki. + // It is only used by Loki to return parsed log lines in query responses. + // TODO: Remove this field from the write path Proto. + repeated LabelPairAdapter parsed = 4; +} diff --git a/Sources/LoggingLoki/Proto/stats.proto b/Sources/LoggingLoki/Proto/stats.proto deleted file mode 100644 index b249821..0000000 --- a/Sources/LoggingLoki/Proto/stats.proto +++ /dev/null @@ -1,77 +0,0 @@ -syntax = "proto3"; - -package stats; - -import "gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.unmarshaler_all) = true; -option go_package = "github.com/grafana/loki/pkg/logql/stats"; - - -// Result contains LogQL query statistics. -message Result { - Summary summary = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "summary"]; - Store store = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "store"]; - Ingester ingester = 3 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "ingester"]; -} - -// Summary is the summary of a query statistics. -message Summary { - // Total bytes processed per second. - int64 bytesProcessedPerSecond = 1 [(gogoproto.jsontag) = "bytesProcessedPerSecond"]; - // Total lines processed per second. - int64 linesProcessedPerSecond = 2 [(gogoproto.jsontag) = "linesProcessedPerSecond"]; - // Total bytes processed. - int64 totalBytesProcessed = 3 [(gogoproto.jsontag) = "totalBytesProcessed"]; - // Total lines processed. - int64 totalLinesProcessed = 4 [(gogoproto.jsontag) = "totalLinesProcessed"]; - // Execution time in seconds. - double execTime = 5 [(gogoproto.jsontag) = "execTime"]; -} - -message Store { - // The total of chunk reference fetched from index. - int64 totalChunksRef = 1 [(gogoproto.jsontag) = "totalChunksRef"]; - // Total number of chunks fetched. - int64 totalChunksDownloaded = 2 [(gogoproto.jsontag) = "totalChunksDownloaded"]; - // Time spent fetching chunks in nanoseconds. - double chunksDownloadTime = 3 [(gogoproto.jsontag) = "chunksDownloadTime"]; - - // Total bytes processed but was already in memory. (found in the headchunk) - int64 headChunkBytes = 4 [(gogoproto.jsontag) = "headChunkBytes"]; - // Total lines processed but was already in memory. (found in the headchunk) - int64 headChunkLines = 5 [(gogoproto.jsontag) = "headChunkLines"]; - // Total bytes decompressed and processed from chunks. - int64 decompressedBytes = 6 [(gogoproto.jsontag) = "decompressedBytes"]; - // Total lines decompressed and processed from chunks. - int64 decompressedLines = 7 [(gogoproto.jsontag) = "decompressedLines"]; - // Total bytes of compressed chunks (blocks) processed. - int64 compressedBytes = 8 [(gogoproto.jsontag) = "compressedBytes"]; - // Total duplicates found while processing. - int64 totalDuplicates = 9 [(gogoproto.jsontag) = "totalDuplicates"]; -} - -message Ingester { - // Total ingester reached for this query. - int32 totalReached = 1 [(gogoproto.jsontag) = "totalReached"]; - // Total of chunks matched by the query from ingesters - int64 totalChunksMatched = 2 [(gogoproto.jsontag) = "totalChunksMatched"]; - // Total of batches sent from ingesters. - int64 totalBatches = 3 [(gogoproto.jsontag) = "totalBatches"]; - // Total lines sent by ingesters. - int64 totalLinesSent = 4 [(gogoproto.jsontag) = "totalLinesSent"]; - - // Total bytes processed but was already in memory. (found in the headchunk) - int64 headChunkBytes = 5 [(gogoproto.jsontag) = "headChunkBytes"]; - // Total lines processed but was already in memory. (found in the headchunk) - int64 headChunkLines = 6 [(gogoproto.jsontag) = "headChunkLines"]; - // Total bytes decompressed and processed from chunks. - int64 decompressedBytes = 7 [(gogoproto.jsontag) = "decompressedBytes"]; - // Total lines decompressed and processed from chunks. - int64 decompressedLines = 8 [(gogoproto.jsontag) = "decompressedLines"]; - // Total bytes of compressed chunks (blocks) processed. - int64 compressedBytes = 9 [(gogoproto.jsontag) = "compressedBytes"]; - // Total duplicates found while processing. - int64 totalDuplicates = 10 [(gogoproto.jsontag) = "totalDuplicates"]; -} \ No newline at end of file diff --git a/Sources/LoggingLoki/Proto/timestamp.proto b/Sources/LoggingLoki/Proto/timestamp.proto deleted file mode 100644 index e7b62dd..0000000 --- a/Sources/LoggingLoki/Proto/timestamp.proto +++ /dev/null @@ -1,144 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -syntax = "proto3"; - -package google.protobuf; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/protobuf/types/known/timestamppb"; -option java_package = "com.google.protobuf"; -option java_outer_classname = "TimestampProto"; -option java_multiple_files = true; -option objc_class_prefix = "GPB"; -option csharp_namespace = "Google.Protobuf.WellKnownTypes"; - -// A Timestamp represents a point in time independent of any time zone or local -// calendar, encoded as a count of seconds and fractions of seconds at -// nanosecond resolution. The count is relative to an epoch at UTC midnight on -// January 1, 1970, in the proleptic Gregorian calendar which extends the -// Gregorian calendar backwards to year one. -// -// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap -// second table is needed for interpretation, using a [24-hour linear -// smear](https://developers.google.com/time/smear). -// -// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By -// restricting to that range, we ensure that we can convert to and from [RFC -// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. -// -// # Examples -// -// Example 1: Compute Timestamp from POSIX `time()`. -// -// Timestamp timestamp; -// timestamp.set_seconds(time(NULL)); -// timestamp.set_nanos(0); -// -// Example 2: Compute Timestamp from POSIX `gettimeofday()`. -// -// struct timeval tv; -// gettimeofday(&tv, NULL); -// -// Timestamp timestamp; -// timestamp.set_seconds(tv.tv_sec); -// timestamp.set_nanos(tv.tv_usec * 1000); -// -// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. -// -// FILETIME ft; -// GetSystemTimeAsFileTime(&ft); -// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; -// -// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z -// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. -// Timestamp timestamp; -// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); -// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); -// -// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. -// -// long millis = System.currentTimeMillis(); -// -// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) -// .setNanos((int) ((millis % 1000) * 1000000)).build(); -// -// Example 5: Compute Timestamp from Java `Instant.now()`. -// -// Instant now = Instant.now(); -// -// Timestamp timestamp = -// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) -// .setNanos(now.getNano()).build(); -// -// Example 6: Compute Timestamp from current time in Python. -// -// timestamp = Timestamp() -// timestamp.GetCurrentTime() -// -// # JSON Mapping -// -// In JSON format, the Timestamp type is encoded as a string in the -// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the -// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" -// where {year} is always expressed using four digits while {month}, {day}, -// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional -// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), -// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required. A proto3 JSON serializer should always use UTC (as indicated by -// "Z") when printing the Timestamp type and a proto3 JSON parser should be -// able to accept both UTC and other timezones (as indicated by an offset). -// -// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past -// 01:30 UTC on January 15, 2017. -// -// In JavaScript, one can convert a Date object to this format using the -// standard -// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) -// method. In Python, a standard `datetime.datetime` object can be converted -// to this format using -// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with -// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use -// the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D -// ) to obtain a formatter capable of generating timestamps in this format. -// -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} \ No newline at end of file diff --git a/Sources/LoggingLoki/TypeAliases.swift b/Sources/LoggingLoki/TypeAliases.swift deleted file mode 100644 index 7fb5d64..0000000 --- a/Sources/LoggingLoki/TypeAliases.swift +++ /dev/null @@ -1,5 +0,0 @@ -import struct Foundation.Date - -typealias StatusCode = Int -typealias LokiLog = (timestamp: Date, message: String) -typealias LokiLabels = Dictionary diff --git a/Sources/LoggingLoki/Utility/Timeout.swift b/Sources/LoggingLoki/Utility/Timeout.swift new file mode 100644 index 0000000..39d2367 --- /dev/null +++ b/Sources/LoggingLoki/Utility/Timeout.swift @@ -0,0 +1,17 @@ +func withTimeout( + _ timeout: ClockType.Duration, + priority: TaskPriority? = nil, + clock: ClockType, + operation: @escaping @Sendable () async throws -> ChildTaskResult +) async rethrows -> ChildTaskResult where ChildTaskResult: Sendable { + try await withThrowingTaskGroup(of: ChildTaskResult.self) { group in + group.addTask(priority: priority) { + try await clock.sleep(for: timeout) + throw CancellationError() + } + group.addTask(priority: priority, operation: operation) + let result = try await group.next()! + group.cancelAll() + return result + } +} diff --git a/Tests/LoggingLokiTests/IntegrationTests.swift b/Tests/LoggingLokiTests/IntegrationTests.swift new file mode 100644 index 0000000..182f4bc --- /dev/null +++ b/Tests/LoggingLokiTests/IntegrationTests.swift @@ -0,0 +1,128 @@ +import XCTest +import NIOCore +import NIOHTTP1 +import Atomics +import AsyncHTTPClient +import NIOConcurrencyHelpers +@testable import LoggingLoki + +final class InspectableTransport: LokiTransport { + let actual = HTTPClient.shared + + let transported = ManagedAtomic(0) + + let errored = ManagedAtomic(0) + let errors: NIOLockedValueBox<[Error]> = NIOLockedValueBox([]) + + func transport(_ data: ByteBuffer, url: String, headers: HTTPHeaders) async throws { + do { + try await actual.transport(data, url: url, headers: headers) + transported.wrappingIncrement(ordering: .relaxed) + } catch { + errored.wrappingIncrement(ordering: .relaxed) + errors.withLockedValue { $0.append(error) } + } + } +} + +final class BadRequestTransformer: LokiTransformer { + func transform(_ entries: [BatchEntry], headers: inout HTTPHeaders) throws -> ByteBuffer { + headers.add(name: "Content-Type", value: "application/json") + var buffer = ByteBuffer() + buffer.writeString("bad_request :(") + try buffer.writeJSONEncodable(LokiRequest.from(entries: entries)) + return buffer + } +} + +final class IntegrationTests: XCTestCase { + func testProtobufHappyPath() async throws { + try await runHappyPath(LokiProtobufTransformer()) + } + + func testJSONHappyPath() async throws { + try await runHappyPath(LokiJSONTransformer()) + } + + func testBadRequest() async throws { + try await withThrowingDiscardingTaskGroup { group in + let clock = TestClock() + let transport = InspectableTransport() + let processor = LokiLogProcessor( + configuration: .init(lokiURL: env("XCT_LOKI_URL") ?? "http://localhost:3100", maxBatchTimeInterval: .seconds(10)), + transport: transport, + transformer: BadRequestTransformer(), + clock: clock + ) + var sleepCalls = clock.sleepCalls.makeAsyncIterator() + group.addTask { + try await processor.run() + } + let handler = LokiLogHandler(label: "com.timozacherl.swift-log-loki-tests", processor: processor) + logLine(handler: handler) + await sleepCalls.next() + + // move forward in time until max batch time interval is exceeded + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + await sleepCalls.next() // export + XCTAssertEqual(transport.transported.load(ordering: .relaxed), 0) + XCTAssertEqual(transport.errored.load(ordering: .relaxed), 1) + let errors = transport.errors.withLockedValue { $0 } + let error = try XCTUnwrap(errors.first as? LokiResponseError) + XCTAssertEqual(error.response.status, .badRequest) + + group.cancelAll() + } + } + + func runHappyPath(_ transformer: LokiTransformer, file: StaticString = #filePath, line: UInt = #line) async throws { + try await withThrowingDiscardingTaskGroup { group in + let clock = TestClock() + let transport = InspectableTransport() + let processor = LokiLogProcessor( + configuration: .init(lokiURL: env("XCT_LOKI_URL") ?? "http://localhost:3100", maxBatchTimeInterval: .seconds(10)), + transport: transport, + transformer: transformer, + clock: clock + ) + var sleepCalls = clock.sleepCalls.makeAsyncIterator() + group.addTask { + try await processor.run() + } + let handler = LokiLogHandler(label: "com.timozacherl.swift-log-loki-tests", processor: processor) + logLine(handler: handler) + await sleepCalls.next() + + // move forward in time until max batch time interval is exceeded + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + await sleepCalls.next() // export + XCTAssertEqual(transport.transported.load(ordering: .relaxed), 1, file: file, line: line) + + group.cancelAll() + } + } + + func logLine(handler: LokiLogHandler) { + handler.log( + level: .error, + message: "oh, something bad happened", + metadata: ["log": "swift"], + source: "log-loki", + file: #filePath, + function: #function, + line: #line + ) + } +} + +func env(_ name: String) -> String? { + getenv(name).flatMap { String(cString: $0) } +} diff --git a/Tests/LoggingLokiTests/LoggingLokiTests.swift b/Tests/LoggingLokiTests/LoggingLokiTests.swift deleted file mode 100644 index 972af20..0000000 --- a/Tests/LoggingLokiTests/LoggingLokiTests.swift +++ /dev/null @@ -1,81 +0,0 @@ -import XCTest -@testable import LoggingLoki -import struct Logging.Logger - -final class TestSession: LokiSession, @unchecked Sendable { - var logs: [LokiLog]? - var labels: LokiLabels? - - func send(_ batch: Batch, - url: URL, - headers: [String: String], - sendAsJSON: Bool = false, - completion: @escaping (Result) -> Void) { - self.logs = batch.entries.first?.logEntries - self.labels = batch.entries.first?.labels - } -} - -final class LoggingLokiTests: XCTestCase { - let expectedLogMessage = "Testing swift-log-loki" - let expectedSource = "swift-log" - let expectedFile = "TestFile.swift" - let expectedFunction = "testFunction(_:)" - let expectedLine: UInt = 42 - let expectedService = "test.swift-log" - - func testLog() throws { - let handler = LokiLogHandler(label: expectedService, lokiURL: URL(string: "http://localhost:3100")!, batchSize: 1, session: TestSession()) - handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) - checkIfLogExists(for: handler) - } - - func testLogWithBiggerBatchSize() throws { - let handler = LokiLogHandler(label: expectedService, lokiURL: URL(string: "http://localhost:3100")!, batchSize: 3, session: TestSession()) - handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) - handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) - try XCTAssertNil(XCTUnwrap(handler.session as? TestSession).logs?.first) - handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) - checkIfLogExists(for: handler) - } - - func testLogWithMaxInterval() async throws { - let handler = LokiLogHandler(label: expectedService, lokiURL: URL(string: "http://localhost:3100")!, maxBatchTimeInterval: 10, session: TestSession()) - handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) - try XCTAssertNil(XCTUnwrap(handler.session as? TestSession).logs?.first) - try await Task.sleep(nanoseconds: 15_000_000_000) - handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) - checkIfLogExists(for: handler) - } - - func checkIfLogExists(for handler: LokiLogHandler) { - guard let session = handler.session as? TestSession else { - XCTFail("Could not cast the Handler's Session to TestSession") - return - } - - guard let firstLog = session.logs?.first else { - XCTFail("Could not get first log from Session") - return - } - - XCTAssert(firstLog.message.contains(expectedLogMessage)) - XCTAssert(firstLog.message.contains(Logger.Level.error.rawValue.uppercased())) - XCTAssertNotNil(firstLog.timestamp) - XCTAssert(session.labels?.contains(where: { key, value in - value == expectedSource && key == "source" - }) ?? false) - XCTAssert(session.labels?.contains(where: { key, value in - value == expectedFile && key == "file" - }) ?? false) - XCTAssert(session.labels?.contains(where: { key, value in - value == expectedFunction && key == "function" - }) ?? false) - XCTAssert(session.labels?.contains(where: { key, value in - value == String(expectedLine) && key == "line" - }) ?? false) - XCTAssert(session.labels?.contains(where: { key, value in - value == expectedService && key == "service" - }) ?? false) - } -} diff --git a/Tests/LoggingLokiTests/LokiLogHandlerTests.swift b/Tests/LoggingLokiTests/LokiLogHandlerTests.swift new file mode 100644 index 0000000..4878ce1 --- /dev/null +++ b/Tests/LoggingLokiTests/LokiLogHandlerTests.swift @@ -0,0 +1,166 @@ +import XCTest +import NIOCore +import NIOHTTP1 +@testable import LoggingLoki +import struct Logging.Logger + +final class TestTransformer: LokiTransformer, @unchecked Sendable { + var logs: [LokiLog.Transport]? + var labels: [String: String]? + + let actual = LokiJSONTransformer() + + func transform( + _ entries: [BatchEntry], + headers: inout HTTPHeaders + ) throws -> ByteBuffer { + self.logs = entries.first?.logEntries + self.labels = entries.first?.labels + return try actual.transform(entries, headers: &headers) + } +} + +final class TestTransport: LokiTransport { + func transport( + _ data: ByteBuffer, + url: String, + headers: HTTPHeaders + ) async throws { } +} + +final class LokiLogHandlerTests: XCTestCase { + let expectedLogMessage = "Testing swift-log-loki" + let expectedSource = "swift-log" + let expectedFile = "TestFile.swift" + let expectedFunction = "testFunction(_:)" + let expectedLine: UInt = 42 + let expectedLabel = "test.swift-log" + let expectedService = "LokiLogTests" + + func testLog() async throws { + let transport = TestTransport() + let transformer = TestTransformer() + let clock = TestClock() + let processor = LokiLogProcessor( + configuration: .init(lokiURL: "http://localhost:3100", batchSize: 1), + transport: transport, + transformer: transformer, + clock: clock + ) + var sleepCalls = clock.sleepCalls.makeAsyncIterator() + let processing = Task { + try await processor.run() + } + let handler = LokiLogHandler(label: expectedLabel, service: expectedService, processor: processor) + + handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) + + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + await sleepCalls.next() // await export + + try checkIfLogExists(for: transformer) + processing.cancel() + } + + func testLogWithBiggerBatchSize() async throws { + let transport = TestTransport() + let transformer = TestTransformer() + let clock = TestClock() + let processor = LokiLogProcessor( + configuration: .init(lokiURL: "http://localhost:3100", batchSize: 3), + transport: transport, + transformer: transformer, + clock: clock + ) + var sleepCalls = clock.sleepCalls.makeAsyncIterator() + let processing = Task { + try await processor.run() + } + let handler = LokiLogHandler(label: expectedLabel, service: expectedService, processor: processor) + + handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) + + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) + + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + XCTAssertNil(transformer.logs?.first) + + handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) + + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + await sleepCalls.next() // await export + + try checkIfLogExists(for: transformer) + processing.cancel() + } + + func testLogWithMaxInterval() async throws { + let transport = TestTransport() + let transformer = TestTransformer() + let clock = TestClock() + let processor = LokiLogProcessor( + configuration: .init(lokiURL: "http://localhost:3100", maxBatchTimeInterval: .seconds(10)), + transport: transport, + transformer: transformer, + clock: clock + ) + var sleepCalls = clock.sleepCalls.makeAsyncIterator() + let processing = Task { + try await processor.run() + } + let handler = LokiLogHandler(label: expectedLabel, service: expectedService, processor: processor) + handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) + await sleepCalls.next() + XCTAssertNil(transformer.logs?.first) + + // move forward in time until max batch time interval is exceeded + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + clock.advance(by: .seconds(5)) // tick + await sleepCalls.next() + + + handler.log(level: .error, message: "\(expectedLogMessage)", metadata: ["log": "swift"], source: expectedSource, file: expectedFile, function: expectedFunction, line: expectedLine) + await sleepCalls.next() + try checkIfLogExists(for: transformer) + processing.cancel() + } + + func checkIfLogExists(for transformer: TestTransformer, file: StaticString = #filePath, line: UInt = #line) throws { + let firstLog = try XCTUnwrap(transformer.logs?.first, file: file, line: line) + + XCTAssert(firstLog.line.contains(expectedLogMessage), file: file, line: line) + XCTAssert(firstLog.line.contains(Logger.Level.error.rawValue.uppercased()), file: file, line: line) + XCTAssertNotNil(firstLog.timestamp, file: file, line: line) + XCTAssert(transformer.labels?.contains(where: { key, value in + value == expectedSource && key == "source" + }) ?? false, file: file, line: line) + XCTAssert(transformer.labels?.contains(where: { key, value in + value == expectedFile && key == "file" + }) ?? false, file: file, line: line) + XCTAssert(transformer.labels?.contains(where: { key, value in + value == expectedFunction && key == "function" + }) ?? false, file: file, line: line) + XCTAssert(transformer.labels?.contains(where: { key, value in + value == String(expectedLine) && key == "line" + }) ?? false, file: file, line: line) + XCTAssert(transformer.labels?.contains(where: { key, value in + value == expectedLabel && key == "logger" + }) ?? false, file: file, line: line) + XCTAssert(transformer.labels?.contains(where: { key, value in + value == expectedService && key == "service" + }) ?? false, file: file, line: line) + } +} diff --git a/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift b/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift new file mode 100644 index 0000000..55ebf3c --- /dev/null +++ b/Tests/LoggingLokiTests/LokiLogProcessorConfigurationTests.swift @@ -0,0 +1,15 @@ +import XCTest +@testable import LoggingLoki + +final class LokiLogProcessorConfigurationTests: XCTestCase { + func testLokiURLConstruction() { + var configuration1 = LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100") + XCTAssertEqual(configuration1._lokiURL, "http://localhost:3100/loki/api/v1/push") + configuration1.lokiURL = "http://localhost:3200/" + XCTAssertEqual(configuration1._lokiURL, "http://localhost:3200/loki/api/v1/push") + configuration1.lokiURL = "http://localhost:3300" + XCTAssertEqual(configuration1._lokiURL, "http://localhost:3300/loki/api/v1/push") + let configuration2 = LokiLogProcessorConfiguration(lokiURL: "http://localhost:3100/") + XCTAssertEqual(configuration2._lokiURL, "http://localhost:3100/loki/api/v1/push") + } +} diff --git a/Tests/LoggingLokiTests/LokiLogProcessorTests.swift b/Tests/LoggingLokiTests/LokiLogProcessorTests.swift new file mode 100644 index 0000000..50a82ee --- /dev/null +++ b/Tests/LoggingLokiTests/LokiLogProcessorTests.swift @@ -0,0 +1,61 @@ +import XCTest +@testable import LoggingLoki + +final class LokiLogProcessorTests: XCTestCase { + func testLogFmtFormat() { + let configuration = LokiLogProcessorConfiguration( + lokiURL: "http://localhost:3100", + logFormat: .logfmt + ) + let processor = LokiLogProcessor(configuration: configuration) + let raw = LokiLog( + timestamp: .init(), + level: .info, + message: "My log message", + metadata: ["basic_key": "basic_value", "additional_key": "value with whitespace"] + ) + let formatted = processor.makeLog(raw) + XCTAssertNil(formatted.metadata) + XCTAssertTrue(formatted.line.starts(with: "[INFO] ")) + XCTAssertTrue(formatted.line.contains("basic_key=basic_value")) + XCTAssertTrue(formatted.line.contains(#"additional_key="value with whitespace""#)) + XCTAssertTrue(formatted.line.contains(#"message="My log message""#)) + } + + func testCustomFormat() { + let configuration = LokiLogProcessorConfiguration( + lokiURL: "http://localhost:3100", + logFormat: .custom({ level, message, metadata in + "\(level.rawValue.uppercased()): \(message) [\(metadata.sorted(by: { $0.key < $1.key }).map({ "\($0.key): \($0.value)" }).joined(separator: ", "))]" + }) + ) + let processor = LokiLogProcessor(configuration: configuration) + let raw = LokiLog( + timestamp: .init(), + level: .info, + message: "My log message", + metadata: ["basic_key": "basic_value", "additional_key": "value with whitespace"] + ) + let formatted = processor.makeLog(raw) + XCTAssertNil(formatted.metadata) + XCTAssertEqual(formatted.line, #"INFO: My log message [additional_key: value with whitespace, basic_key: basic_value]"#) + } + + func testLogFmtFormatEmptyMetadata() { + var configuration = LokiLogProcessorConfiguration( + lokiURL: "http://localhost:3100", + logFormat: .logfmt + ) + configuration.encoding = .json + let processor = LokiLogProcessor(configuration: configuration) + let raw = LokiLog( + timestamp: .init(), + level: .info, + message: "My log message", + metadata: [:] + ) + let formatted = processor.makeLog(raw) + XCTAssertNil(formatted.metadata) + XCTAssertEqual(formatted.line, #"[INFO] message="My log message""#) + } +} diff --git a/Tests/LoggingLokiTests/MockClock.swift b/Tests/LoggingLokiTests/MockClock.swift new file mode 100644 index 0000000..4f08653 --- /dev/null +++ b/Tests/LoggingLokiTests/MockClock.swift @@ -0,0 +1,147 @@ +//===----------------------------------------------------------------------===// +// +// This source file is part of the Swift OTel open source project +// +// Copyright (c) 2023 Moritz Lang and the Swift OTel project authors +// Licensed under Apache License v2.0 +// +// See LICENSE.txt for license information +// +// SPDX-License-Identifier: Apache-2.0 +// +//===----------------------------------------------------------------------===// + +import NIOConcurrencyHelpers + +public final class TestClock: Clock, @unchecked Sendable { + public struct Instant: InstantProtocol { + public var offset: Duration + + public init(offset: Duration = .zero) { + self.offset = offset + } + + public func advanced(by duration: Duration) -> Self { + .init(offset: offset + duration) + } + + public func duration(to other: Self) -> Duration { + other.offset - offset + } + + public static func < (lhs: Self, rhs: Self) -> Bool { + lhs.offset < rhs.offset + } + + public static func minutes(_ minutes: some BinaryInteger) -> Self { + .init(offset: .seconds(minutes * 60)) + } + + public static func seconds(_ seconds: some BinaryInteger) -> Self { + .init(offset: .seconds(seconds)) + } + + public static func milliseconds(_ milliseconds: some BinaryInteger) -> Self { + .init(offset: .milliseconds(milliseconds)) + } + + public static func microseconds(_ microseconds: some BinaryInteger) -> Self { + .init(offset: .microseconds(microseconds)) + } + + public static func nanoseconds(_ nanoseconds: some BinaryInteger) -> Self { + .init(offset: .nanoseconds(nanoseconds)) + } + } + + public var minimumResolution: Duration = .zero + public var now: Instant { + state.withLockedValue { $0.now } + } + + struct State { + // We should use a Heap here + var continuations: [(id: UInt64, deadline: Instant, continuation: CheckedContinuation)] + var now: Instant + } + + public let sleepCalls: AsyncStream + private let sleepCallsContinuation: AsyncStream.Continuation + + private let state = NIOLockedValueBox(State(continuations: [], now: .init())) + + public init(now: Instant = .init()) { + state.withLockedValue { $0.now = now } + let (stream, continunation) = AsyncStream.makeStream() + sleepCalls = stream + sleepCallsContinuation = continunation + } + + public func sleep(until deadline: Instant, tolerance: Duration? = nil) async throws { + try await withTaskCancellationHandler { + try await withCheckedThrowingContinuation { continuation in + enum Action { + case shouldResume, shouldCancel, none + } + let action = self.state.withLockedValue { state -> Action in + guard !Task.isCancelled else { + return .shouldCancel + } + guard deadline > state.now else { + return .shouldResume + } + let id = UInt64.random(in: .min ..< .max) + state.continuations.append((id, deadline, continuation)) + return .none + } + switch action { + case .shouldResume: + continuation.resume() + case .shouldCancel: + continuation.resume(throwing: CancellationError()) + case .none: + break + } + sleepCallsContinuation.yield() + } + } onCancel: { + let continuations = self.state.withLockedValue { state in + let continutations = state.continuations + state.continuations.removeAll() + return continutations + } + for entry in continuations { + entry.continuation.resume(throwing: CancellationError()) + } + } + } + + public func advance(by duration: Duration = .zero) { + let continuationsToResume = state.withLockedValue { state in + let deadline = state.now.advanced(by: duration) + precondition(state.now < deadline) + state.now = deadline + + let continuationsToResume = state.continuations.filter { $0.deadline <= deadline } + state.continuations.removeAll { $0.deadline <= deadline } + return continuationsToResume + } + for entry in continuationsToResume { + entry.continuation.resume() + } + } + + public func advance(to deadline: Instant) { + let continuationsToResume = state.withLockedValue { state in + precondition(state.now < deadline) + state.now = deadline + + let continuationsToResume = state.continuations.filter { $0.deadline <= deadline } + state.continuations.removeAll { $0.deadline <= deadline } + return continuationsToResume + } + for entry in continuationsToResume { + entry.continuation.resume() + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..582c132 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,51 @@ +version: "3" + +networks: + loki: + +services: + loki: + image: grafana/loki:3.0.0 + ports: + - "3100:3100" + command: -config.file=/etc/loki/local-config.yaml + networks: + - loki + + promtail: + image: grafana/promtail:3.0.0 + volumes: + - /var/log:/var/log + command: -config.file=/etc/promtail/config.yml + networks: + - loki + + grafana: + environment: + - GF_PATHS_PROVISIONING=/etc/grafana/provisioning + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + entrypoint: + - sh + - -euc + - | + mkdir -p /etc/grafana/provisioning/datasources + cat < /etc/grafana/provisioning/datasources/ds.yaml + apiVersion: 1 + datasources: + - name: Loki + type: loki + access: proxy + orgId: 1 + url: http://loki:3100 + basicAuth: false + isDefault: true + version: 1 + editable: false + EOF + /run.sh + image: grafana/grafana:latest + ports: + - "3000:3000" + networks: + - loki