File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ let package = Package(
27
27
. library(
28
28
name: " ETCD " ,
29
29
targets: [ " ETCD " ]
30
- ) ,
30
+ )
31
31
] ,
32
32
dependencies: [
33
33
. package ( url: " https://github.com/apple/swift-nio.git " , from: " 2.56.0 " ) ,
Original file line number Diff line number Diff line change @@ -19,13 +19,13 @@ public struct DeleteRangeRequest {
19
19
public var key : Data
20
20
public var rangeEnd : Data ?
21
21
public var prevKV : Bool = false
22
-
22
+
23
23
init ( protoDeleteRangeRequest: Etcdserverpb_DeleteRangeRequest ) {
24
24
self . key = protoDeleteRangeRequest. key
25
25
self . rangeEnd = protoDeleteRangeRequest. rangeEnd. isEmpty ? nil : protoDeleteRangeRequest. rangeEnd
26
26
self . prevKV = protoDeleteRangeRequest. prevKv
27
27
}
28
-
28
+
29
29
/// Struct representing a deleteRangeRequest in etcd.
30
30
///
31
31
/// - Parameters:
@@ -37,7 +37,7 @@ public struct DeleteRangeRequest {
37
37
self . rangeEnd = rangeEnd
38
38
self . prevKV = prevKV
39
39
}
40
-
40
+
41
41
func toProto( ) -> Etcdserverpb_DeleteRangeRequest {
42
42
var protoDeleteRangeRequest = Etcdserverpb_DeleteRangeRequest ( )
43
43
protoDeleteRangeRequest. key = self . key
Original file line number Diff line number Diff line change @@ -110,7 +110,10 @@ public final class EtcdClient: @unchecked Sendable {
110
110
/// - Parameters:
111
111
/// - key: The key for which the value is watched. Parameter is of type Sequence<UInt8>.
112
112
/// - operation: The operation to be run on the WatchAsyncSequence for the key.
113
- public func watch< Result> ( _ key: some Sequence < UInt8 > , _ operation: ( WatchAsyncSequence ) async throws -> Result ) async throws -> Result {
113
+ public func watch< Result> (
114
+ _ key: some Sequence < UInt8 > ,
115
+ _ operation: ( WatchAsyncSequence ) async throws -> Result
116
+ ) async throws -> Result {
114
117
let request = [ Etcdserverpb_WatchRequest . with { $0. createRequest. key = Data ( key) } ]
115
118
let watchAsyncSequence = WatchAsyncSequence ( grpcAsyncSequence: watchClient. watch ( request) )
116
119
return try await operation ( watchAsyncSequence)
@@ -121,7 +124,10 @@ public final class EtcdClient: @unchecked Sendable {
121
124
/// - Parameters:
122
125
/// - key: The key for which the value is watched. Parameter is of type String.
123
126
/// - operation: The operation to be run on the WatchAsyncSequence for the key.
124
- public func watch< Result> ( _ key: String , _ operation: ( WatchAsyncSequence ) async throws -> Result ) async throws -> Result {
127
+ public func watch< Result> (
128
+ _ key: String ,
129
+ _ operation: ( WatchAsyncSequence ) async throws -> Result
130
+ ) async throws -> Result {
125
131
try await watch ( key. utf8, operation)
126
132
}
127
133
}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ final class EtcdClientTests: XCTestCase {
54
54
55
55
let deleteRangeRequest = DeleteRangeRequest ( key: rangeRequestKey)
56
56
try await etcdClient. deleteRange ( deleteRangeRequest)
57
-
57
+
58
58
fetchedValue = try await etcdClient. getRange ( rangeRequest)
59
59
XCTAssertNil ( fetchedValue)
60
60
}
@@ -68,7 +68,7 @@ final class EtcdClientTests: XCTestCase {
68
68
69
69
let deleteRangeRequest = DeleteRangeRequest ( key: key)
70
70
try await etcdClient. deleteRange ( deleteRangeRequest)
71
-
71
+
72
72
fetchedValue = try await etcdClient. getRange ( rangeRequest)
73
73
XCTAssertNil ( fetchedValue)
74
74
}
You can’t perform that action at this time.
0 commit comments