proxygrpc

package
v0.0.0-...-c88e5ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MetadataTrafficAccessToken is forwarded by client-proxy when present.
	MetadataTrafficAccessToken = "e2b-traffic-access-token"
	// MetadataSandboxRequestPort identifies the original requested sandbox port.
	MetadataSandboxRequestPort = "e2b-sandbox-request-port"
	// MetadataEnvdAccessToken is forwarded by client-proxy for envd traffic on secure sandboxes.
	MetadataEnvdAccessToken = "e2b-envd-access-token"
	// MetadataAuthorization carries bearer credentials for gRPC requests.
	MetadataAuthorization = "authorization"
	// ScopeSandboxLifecycle authorizes client-proxy sandbox lifecycle operations.
	ScopeSandboxLifecycle = "sandboxes:lifecycle"
	// MetadataEnvdHTTPAccessToken is the HTTP header used by envd for access token authentication.
	MetadataEnvdHTTPAccessToken = "X-Access-Token"
)
View Source
const (
	// SandboxStillTransitioningMessage identifies the explicit transient autoresume wait failure.
	SandboxStillTransitioningMessage = "sandbox is still transitioning"

	// ResumeErrorDomain is the ErrorInfo domain under which the API attaches
	// its semantic error code to a resume failure's gRPC status, so the proxy
	// can tell a refusal no retry helps from a shortage that clears.
	ResumeErrorDomain = "api.e2b.dev"

	// ResumeErrorHTTPStatusKey is the ErrorInfo metadata key under which the
	// API attaches the HTTP status it answered the failure with, so the page
	// the proxy renders for a refusal carries the API's own status rather
	// than one read back off the gRPC code.
	ResumeErrorHTTPStatusKey = "http_status"

	// Placement error codes the API emits (also its REST error_code values).
	PlacementTimeout             = "sandbox_placement_timeout"
	PlacementCapacityUnavailable = "sandbox_capacity_unavailable"
	PlacementNoCompatibleNode    = "sandbox_no_compatible_node"
	PlacementFeatureUnsupported  = "sandbox_feature_unsupported"
	PlacementCreateFailed        = "sandbox_create_failed"
	PlacementCreateRefused       = "sandbox_create_refused"

	// SnapshotGuestAgentUnresponsive refuses a memory resume of a snapshot
	// the node took while the sandbox's guest agent did not answer; only a
	// resume without memory brings the sandbox back.
	SnapshotGuestAgentUnresponsive = "sandbox_snapshot_guest_agent_unresponsive"
)
View Source
const (
	SandboxService_ResumeSandbox_FullMethodName = "/proxy.SandboxService/ResumeSandbox"
)

Variables

View Source
var File_proxy_proto protoreflect.FileDescriptor
View Source
var SandboxService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proxy.SandboxService",
	HandlerType: (*SandboxServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ResumeSandbox",
			Handler:    _SandboxService_ResumeSandbox_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proxy.proto",
}

SandboxService_ServiceDesc is the grpc.ServiceDesc for SandboxService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func PermanentPlacementRefusal

func PermanentPlacementRefusal(code string) bool

PermanentPlacementRefusal reports an error code for a placement no retry helps: no orchestrator in the cluster runs a version a requested feature needs, or a node refused the create for a reason the same on every node (a vcpu request out of bounds), both of which the API states as such. A capacity shortage clears on its own, and "no compatible node" also names a node pool that is only briefly draining or unhealthy, so both are retried. A snapshot taken over an unresponsive guest agent is refused a memory resume for good; only an explicit resume without memory changes it.

func RegisterSandboxServiceServer

func RegisterSandboxServiceServer(s grpc.ServiceRegistrar, srv SandboxServiceServer)

func RetryablePlacementFailure

func RetryablePlacementFailure(code string) bool

RetryablePlacementFailure reports an error code for a placement the API itself tells the client to retry: a shortage, a timeout or a create that failed on the node. The API sends the timeout as 504 and the failed create as 500, which alone read as terminal; the code says they are not.

Types

type SandboxResumeRequest

type SandboxResumeRequest struct {

	// Sandbox ID to resume.
	SandboxId string `protobuf:"bytes,1,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"`
	// contains filtered or unexported fields
}

Request to resume a paused sandbox.

func (*SandboxResumeRequest) Descriptor deprecated

func (*SandboxResumeRequest) Descriptor() ([]byte, []int)

Deprecated: Use SandboxResumeRequest.ProtoReflect.Descriptor instead.

func (*SandboxResumeRequest) GetSandboxId

func (x *SandboxResumeRequest) GetSandboxId() string

func (*SandboxResumeRequest) ProtoMessage

func (*SandboxResumeRequest) ProtoMessage()

func (*SandboxResumeRequest) ProtoReflect

func (x *SandboxResumeRequest) ProtoReflect() protoreflect.Message

func (*SandboxResumeRequest) Reset

func (x *SandboxResumeRequest) Reset()

func (*SandboxResumeRequest) String

func (x *SandboxResumeRequest) String() string

type SandboxResumeResponse

type SandboxResumeResponse struct {

	// Orchestrator node IP that can receive traffic for this sandbox.
	// Empty for a full-router sandbox, whose ingress has no orchestrator route.
	OrchestratorIp string `protobuf:"bytes,1,opt,name=orchestrator_ip,json=orchestratorIp,proto3" json:"orchestrator_ip,omitempty"`
	// Placement of the sandbox's current execution, the one the orchestrator
	// returned for it. Absent for a sandbox on the legacy per-worker network,
	// as in SandboxCreateResponse: callers then route on orchestrator_ip.
	NetworkPlacement *orchestrator.SandboxNetworkPlacement `protobuf:"bytes,2,opt,name=network_placement,json=networkPlacement,proto3" json:"network_placement,omitempty"`
	// contains filtered or unexported fields
}

Response with routing info for the resumed/running sandbox.

func (*SandboxResumeResponse) Descriptor deprecated

func (*SandboxResumeResponse) Descriptor() ([]byte, []int)

Deprecated: Use SandboxResumeResponse.ProtoReflect.Descriptor instead.

func (*SandboxResumeResponse) GetNetworkPlacement

func (*SandboxResumeResponse) GetOrchestratorIp

func (x *SandboxResumeResponse) GetOrchestratorIp() string

func (*SandboxResumeResponse) ProtoMessage

func (*SandboxResumeResponse) ProtoMessage()

func (*SandboxResumeResponse) ProtoReflect

func (x *SandboxResumeResponse) ProtoReflect() protoreflect.Message

func (*SandboxResumeResponse) Reset

func (x *SandboxResumeResponse) Reset()

func (*SandboxResumeResponse) String

func (x *SandboxResumeResponse) String() string

type SandboxServiceClient

type SandboxServiceClient interface {
	ResumeSandbox(ctx context.Context, in *SandboxResumeRequest, opts ...grpc.CallOption) (*SandboxResumeResponse, error)
}

SandboxServiceClient is the client API for SandboxService 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.

SandboxService is used by the client-proxy to resume sandboxes.

type SandboxServiceServer

type SandboxServiceServer interface {
	ResumeSandbox(context.Context, *SandboxResumeRequest) (*SandboxResumeResponse, error)
	// contains filtered or unexported methods
}

SandboxServiceServer is the server API for SandboxService service. All implementations must embed UnimplementedSandboxServiceServer for forward compatibility.

SandboxService is used by the client-proxy to resume sandboxes.

type UnimplementedSandboxServiceServer

type UnimplementedSandboxServiceServer struct{}

UnimplementedSandboxServiceServer 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.

func (UnimplementedSandboxServiceServer) ResumeSandbox

type UnsafeSandboxServiceServer

type UnsafeSandboxServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeSandboxServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SandboxServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL