- Remove x-grpc-upstream metadata from gateway forwarding; use SetUpstream - Remove YAO_GRPC_TAI / YAO_GRPC_UPSTREAM env vars from sandbox containers - Delete benchmark-sandbox-v2 CI job (run benchmarks locally) - Simplify sandbox-v2 CI to tai SDK + workspace tests only - Add HostExec support to sandbox v2 box interface - Add K8s semaphore and cleanup mutex for test stability - Update design docs to reflect new architecture Made-with: Cursor
173 lines
6.5 KiB
Go
173 lines
6.5 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.1
|
|
// - protoc v4.25.0
|
|
// source: hostexec/pb/hostexec.proto
|
|
|
|
package pb
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
HostExec_Exec_FullMethodName = "/hostexec.HostExec/Exec"
|
|
HostExec_ExecStream_FullMethodName = "/hostexec.HostExec/ExecStream"
|
|
)
|
|
|
|
// HostExecClient is the client API for HostExec service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
//
|
|
// HostExec provides remote command execution on the Tai host machine.
|
|
// High privilege — enabled only when --host-exec flag is set.
|
|
type HostExecClient interface {
|
|
// Exec runs a command and returns the result when it completes.
|
|
Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error)
|
|
// ExecStream runs a command and streams stdout/stderr in real time.
|
|
ExecStream(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ExecOutput], error)
|
|
}
|
|
|
|
type hostExecClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewHostExecClient(cc grpc.ClientConnInterface) HostExecClient {
|
|
return &hostExecClient{cc}
|
|
}
|
|
|
|
func (c *hostExecClient) Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ExecResponse)
|
|
err := c.cc.Invoke(ctx, HostExec_Exec_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *hostExecClient) ExecStream(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ExecOutput], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &HostExec_ServiceDesc.Streams[0], HostExec_ExecStream_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[ExecRequest, ExecOutput]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type HostExec_ExecStreamClient = grpc.ServerStreamingClient[ExecOutput]
|
|
|
|
// HostExecServer is the server API for HostExec service.
|
|
// All implementations must embed UnimplementedHostExecServer
|
|
// for forward compatibility.
|
|
//
|
|
// HostExec provides remote command execution on the Tai host machine.
|
|
// High privilege — enabled only when --host-exec flag is set.
|
|
type HostExecServer interface {
|
|
// Exec runs a command and returns the result when it completes.
|
|
Exec(context.Context, *ExecRequest) (*ExecResponse, error)
|
|
// ExecStream runs a command and streams stdout/stderr in real time.
|
|
ExecStream(*ExecRequest, grpc.ServerStreamingServer[ExecOutput]) error
|
|
mustEmbedUnimplementedHostExecServer()
|
|
}
|
|
|
|
// UnimplementedHostExecServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedHostExecServer struct{}
|
|
|
|
func (UnimplementedHostExecServer) Exec(context.Context, *ExecRequest) (*ExecResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Exec not implemented")
|
|
}
|
|
func (UnimplementedHostExecServer) ExecStream(*ExecRequest, grpc.ServerStreamingServer[ExecOutput]) error {
|
|
return status.Error(codes.Unimplemented, "method ExecStream not implemented")
|
|
}
|
|
func (UnimplementedHostExecServer) mustEmbedUnimplementedHostExecServer() {}
|
|
func (UnimplementedHostExecServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeHostExecServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to HostExecServer will
|
|
// result in compilation errors.
|
|
type UnsafeHostExecServer interface {
|
|
mustEmbedUnimplementedHostExecServer()
|
|
}
|
|
|
|
func RegisterHostExecServer(s grpc.ServiceRegistrar, srv HostExecServer) {
|
|
// If the following call panics, it indicates UnimplementedHostExecServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&HostExec_ServiceDesc, srv)
|
|
}
|
|
|
|
func _HostExec_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ExecRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(HostExecServer).Exec(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: HostExec_Exec_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(HostExecServer).Exec(ctx, req.(*ExecRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _HostExec_ExecStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(ExecRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(HostExecServer).ExecStream(m, &grpc.GenericServerStream[ExecRequest, ExecOutput]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type HostExec_ExecStreamServer = grpc.ServerStreamingServer[ExecOutput]
|
|
|
|
// HostExec_ServiceDesc is the grpc.ServiceDesc for HostExec service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var HostExec_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "hostexec.HostExec",
|
|
HandlerType: (*HostExecServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Exec",
|
|
Handler: _HostExec_Exec_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "ExecStream",
|
|
Handler: _HostExec_ExecStream_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "hostexec/pb/hostexec.proto",
|
|
}
|