@@ -19,7 +19,7 @@ public protocol FileSyncDaemon: ObservableObject {
19
19
20
20
@MainActor
21
21
public class MutagenDaemon : FileSyncDaemon {
22
- private let logger = Logger ( subsystem: Bundle . main. bundleIdentifier!, category: " mutagen " )
22
+ let logger = Logger ( subsystem: Bundle . main. bundleIdentifier!, category: " mutagen " )
23
23
24
24
@Published public var state : DaemonState = . stopped {
25
25
didSet {
@@ -42,9 +42,9 @@ public class MutagenDaemon: FileSyncDaemon {
42
42
private let mutagenDaemonSocket : URL
43
43
44
44
// Non-nil when the daemon is running
45
+ var client : DaemonClient ?
45
46
private var group : MultiThreadedEventLoopGroup ?
46
47
private var channel : GRPCChannel ?
47
- private var client : DaemonClient ?
48
48
49
49
// Protect start & stop transitions against re-entrancy
50
50
private let transition = AsyncSemaphore ( value: 1 )
@@ -171,7 +171,8 @@ public class MutagenDaemon: FileSyncDaemon {
171
171
)
172
172
client = DaemonClient (
173
173
mgmt: Daemon_DaemonAsyncClient ( channel: channel!) ,
174
- sync: Synchronization_SynchronizationAsyncClient ( channel: channel!)
174
+ sync: Synchronization_SynchronizationAsyncClient ( channel: channel!) ,
175
+ prompt: Prompting_PromptingAsyncClient ( channel: channel!)
175
176
)
176
177
logger. info (
177
178
" Successfully connected to mutagen daemon, socket: \( self . mutagenDaemonSocket. path, privacy: . public) "
@@ -301,6 +302,7 @@ public class MutagenDaemon: FileSyncDaemon {
301
302
struct DaemonClient {
302
303
let mgmt : Daemon_DaemonAsyncClient
303
304
let sync : Synchronization_SynchronizationAsyncClient
305
+ let prompt : Prompting_PromptingAsyncClient
304
306
}
305
307
306
308
public enum DaemonState {
@@ -342,6 +344,8 @@ public enum DaemonError: Error {
342
344
case connectionFailure( Error )
343
345
case terminatedUnexpectedly
344
346
case grpcFailure( Error )
347
+ case invalidGrpcResponse( String )
348
+ case unexpectedStreamClosure
345
349
346
350
public var description : String {
347
351
switch self {
@@ -355,6 +359,10 @@ public enum DaemonError: Error {
355
359
" The daemon must be started first "
356
360
case let . grpcFailure( error) :
357
361
" Failed to communicate with daemon: \( error) "
362
+ case let . invalidGrpcResponse( response) :
363
+ " Invalid gRPC response: \( response) "
364
+ case . unexpectedStreamClosure:
365
+ " Unexpected stream closure "
358
366
}
359
367
}
360
368
0 commit comments