Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Sources/Containerization/Agent/Vminitd.swift
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,17 @@ extension Vminitd {
try await Task.sleep(for: .milliseconds(10))
try await self.sync()
}

/// Send a filesystem event notification to the guest.
public func notifyFileSystemEvent(path: String, eventType: Com_Apple_Containerization_Sandbox_V3_FileSystemEventType) async throws
-> Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse
{
let request = Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest.with {
$0.path = path
$0.eventType = eventType
}
return try await client.notifyFileSystemEvent(request)
}
}

extension Hosts {
Expand Down
100 changes: 100 additions & 0 deletions Sources/Containerization/SandboxContext/SandboxContext.grpc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ public protocol Com_Apple_Containerization_Sandbox_V3_SandboxContextClientProtoc
_ request: Com_Apple_Containerization_Sandbox_V3_KillRequest,
callOptions: CallOptions?
) -> UnaryCall<Com_Apple_Containerization_Sandbox_V3_KillRequest, Com_Apple_Containerization_Sandbox_V3_KillResponse>

func notifyFileSystemEvent(
_ request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest,
callOptions: CallOptions?
) -> UnaryCall<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>
}

extension Com_Apple_Containerization_Sandbox_V3_SandboxContextClientProtocol {
Expand Down Expand Up @@ -638,6 +643,24 @@ extension Com_Apple_Containerization_Sandbox_V3_SandboxContextClientProtocol {
interceptors: self.interceptors?.makeKillInterceptors() ?? []
)
}

/// Notify guest of filesystem events from host.
///
/// - Parameters:
/// - request: Request to send to NotifyFileSystemEvent.
/// - callOptions: Call options.
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
public func notifyFileSystemEvent(
_ request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest,
callOptions: CallOptions? = nil
) -> UnaryCall<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse> {
return self.makeUnaryCall(
path: Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.notifyFileSystemEvent.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeNotifyFileSystemEventInterceptors() ?? []
)
}
}

@available(*, deprecated)
Expand Down Expand Up @@ -832,6 +855,11 @@ public protocol Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncClientP
_ request: Com_Apple_Containerization_Sandbox_V3_KillRequest,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<Com_Apple_Containerization_Sandbox_V3_KillRequest, Com_Apple_Containerization_Sandbox_V3_KillResponse>

func makeNotifyFileSystemEventCall(
_ request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest,
callOptions: CallOptions?
) -> GRPCAsyncUnaryCall<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>
}

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
Expand Down Expand Up @@ -1155,6 +1183,18 @@ extension Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncClientProtoco
interceptors: self.interceptors?.makeKillInterceptors() ?? []
)
}

public func makeNotifyFileSystemEventCall(
_ request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest,
callOptions: CallOptions? = nil
) -> GRPCAsyncUnaryCall<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse> {
return self.makeAsyncUnaryCall(
path: Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.notifyFileSystemEvent.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeNotifyFileSystemEventInterceptors() ?? []
)
}
}

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
Expand Down Expand Up @@ -1470,6 +1510,18 @@ extension Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncClientProtoco
interceptors: self.interceptors?.makeKillInterceptors() ?? []
)
}

public func notifyFileSystemEvent(
_ request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest,
callOptions: CallOptions? = nil
) async throws -> Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse {
return try await self.performAsyncUnaryCall(
path: Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.notifyFileSystemEvent.path,
request: request,
callOptions: callOptions ?? self.defaultCallOptions,
interceptors: self.interceptors?.makeNotifyFileSystemEventInterceptors() ?? []
)
}
}

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
Expand Down Expand Up @@ -1568,6 +1620,9 @@ public protocol Com_Apple_Containerization_Sandbox_V3_SandboxContextClientInterc

/// - Returns: Interceptors to use when invoking 'kill'.
func makeKillInterceptors() -> [ClientInterceptor<Com_Apple_Containerization_Sandbox_V3_KillRequest, Com_Apple_Containerization_Sandbox_V3_KillResponse>]

/// - Returns: Interceptors to use when invoking 'notifyFileSystemEvent'.
func makeNotifyFileSystemEventInterceptors() -> [ClientInterceptor<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>]
}

public enum Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata {
Expand Down Expand Up @@ -1601,6 +1656,7 @@ public enum Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata {
Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.configureHosts,
Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.sync,
Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.kill,
Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata.Methods.notifyFileSystemEvent,
]
)

Expand Down Expand Up @@ -1760,6 +1816,12 @@ public enum Com_Apple_Containerization_Sandbox_V3_SandboxContextClientMetadata {
path: "/com.apple.containerization.sandbox.v3.SandboxContext/Kill",
type: GRPCCallType.unary
)

public static let notifyFileSystemEvent = GRPCMethodDescriptor(
name: "NotifyFileSystemEvent",
path: "/com.apple.containerization.sandbox.v3.SandboxContext/NotifyFileSystemEvent",
type: GRPCCallType.unary
)
}
}

Expand Down Expand Up @@ -1847,6 +1909,9 @@ public protocol Com_Apple_Containerization_Sandbox_V3_SandboxContextProvider: Ca

/// Send a signal to a process via the PID.
func kill(request: Com_Apple_Containerization_Sandbox_V3_KillRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Com_Apple_Containerization_Sandbox_V3_KillResponse>

/// Notify guest of filesystem events from host.
func notifyFileSystemEvent(request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, context: StatusOnlyCallContext) -> EventLoopFuture<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>
}

extension Com_Apple_Containerization_Sandbox_V3_SandboxContextProvider {
Expand Down Expand Up @@ -2095,6 +2160,15 @@ extension Com_Apple_Containerization_Sandbox_V3_SandboxContextProvider {
userFunction: self.kill(request:context:)
)

case "NotifyFileSystemEvent":
return UnaryServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest>(),
responseSerializer: ProtobufSerializer<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>(),
interceptors: self.interceptors?.makeNotifyFileSystemEventInterceptors() ?? [],
userFunction: self.notifyFileSystemEvent(request:context:)
)

default:
return nil
}
Expand Down Expand Up @@ -2265,6 +2339,12 @@ public protocol Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncProvide
request: Com_Apple_Containerization_Sandbox_V3_KillRequest,
context: GRPCAsyncServerCallContext
) async throws -> Com_Apple_Containerization_Sandbox_V3_KillResponse

/// Notify guest of filesystem events from host.
func notifyFileSystemEvent(
request: Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest,
context: GRPCAsyncServerCallContext
) async throws -> Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse
}

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
Expand Down Expand Up @@ -2520,6 +2600,15 @@ extension Com_Apple_Containerization_Sandbox_V3_SandboxContextAsyncProvider {
wrapping: { try await self.kill(request: $0, context: $1) }
)

case "NotifyFileSystemEvent":
return GRPCAsyncServerHandler(
context: context,
requestDeserializer: ProtobufDeserializer<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest>(),
responseSerializer: ProtobufSerializer<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>(),
interceptors: self.interceptors?.makeNotifyFileSystemEventInterceptors() ?? [],
wrapping: { try await self.notifyFileSystemEvent(request: $0, context: $1) }
)

default:
return nil
}
Expand Down Expand Up @@ -2631,6 +2720,10 @@ public protocol Com_Apple_Containerization_Sandbox_V3_SandboxContextServerInterc
/// - Returns: Interceptors to use when handling 'kill'.
/// Defaults to calling `self.makeInterceptors()`.
func makeKillInterceptors() -> [ServerInterceptor<Com_Apple_Containerization_Sandbox_V3_KillRequest, Com_Apple_Containerization_Sandbox_V3_KillResponse>]

/// - Returns: Interceptors to use when handling 'notifyFileSystemEvent'.
/// Defaults to calling `self.makeInterceptors()`.
func makeNotifyFileSystemEventInterceptors() -> [ServerInterceptor<Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventRequest, Com_Apple_Containerization_Sandbox_V3_NotifyFileSystemEventResponse>]
}

public enum Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata {
Expand Down Expand Up @@ -2664,6 +2757,7 @@ public enum Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata {
Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata.Methods.configureHosts,
Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata.Methods.sync,
Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata.Methods.kill,
Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata.Methods.notifyFileSystemEvent,
]
)

Expand Down Expand Up @@ -2823,5 +2917,11 @@ public enum Com_Apple_Containerization_Sandbox_V3_SandboxContextServerMetadata {
path: "/com.apple.containerization.sandbox.v3.SandboxContext/Kill",
type: GRPCCallType.unary
)

public static let notifyFileSystemEvent = GRPCMethodDescriptor(
name: "NotifyFileSystemEvent",
path: "/com.apple.containerization.sandbox.v3.SandboxContext/NotifyFileSystemEvent",
type: GRPCCallType.unary
)
}
}
Loading
Loading