Documentation
¶
Index ¶
- func New(options ...Option) *tunnelServer
- func NewStreamReader(stream tunnel.Tunnel_StreamWorkspaceClient) io.Reader
- func NewStreamWriter(stream tunnel.Tunnel_StreamWorkspaceServer) io.Writer
- func NewTunnelClient(reader io.Reader, writer io.WriteCloser) (tunnel.TunnelClient, error)
- func NewTunnelStatusReporter(ctx context.Context, client tunnel.TunnelClient) status.Reporter
- func ReportResult(ctx context.Context, tunnelClient tunnel.TunnelClient, ...) (*config.Result, error)
- func RunServicesServer(ctx context.Context, spec ServicesSpec) error
- func RunSetupServer(ctx context.Context, spec SetupSpec) (*config.Result, error)
- func RunUpServer(ctx context.Context, spec UpSpec) (*config.Result, error)
- func WithSetupLogOptions(ctx context.Context, opts []Option) context.Context
- type HopOptions
- type Logger
- type Option
- func SetupLogOptionsFrom(ctx context.Context) []Option
- func WithAllowDockerCredentials(allowDockerCredentials bool) Option
- func WithAllowGitCredentials(allowGitCredentials bool) Option
- func WithAllowGitHubCredentials(allow bool) Option
- func WithAllowKubeConfig(allow bool) Option
- func WithForwarder(forwarder netstat.Forwarder) Option
- func WithGitSSHSigningKey(signingKey string) Option
- func WithGitToken(token *provider2.GitToken) Option
- func WithMounts(mounts []*config.Mount) Option
- func WithPlatformOptions(options *devsy.PlatformOptions) Option
- func WithSecrets(env, mount []string) Option
- func WithSetupLogSink(sink *workspacelogs.Sink) Option
- func WithSnapshotBuildContext(context string) Option
- func WithStatusReporter(reporter status.Reporter) Option
- func WithWorkspace(workspace *provider2.Workspace) Option
- func WithWorkspaceMount(mount *config.Mount) Option
- type ServicesSpec
- type SetupLogHop
- type SetupSpec
- type UpSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStreamReader ¶
func NewStreamReader(stream tunnel.Tunnel_StreamWorkspaceClient) io.Reader
NewStreamReader adapts stream into an io.Reader. A non-EOF error from stream.Recv() propagates to the reader via CloseWithError rather than being silently converted to a clean io.EOF: masking it as EOF would let a mid-stream failure (e.g. a dropped gRPC connection) look like a successful, but truncated, transfer to whatever is consuming the reader (extract.Extract for StreamWorkspace/StreamMount, and the snapshot volumes blob push). This is shared by every Tunnel_StreamWorkspaceClient consumer, not just snapshots - see stream_test.go for coverage of both.
func NewStreamWriter ¶
func NewStreamWriter(stream tunnel.Tunnel_StreamWorkspaceServer) io.Writer
func NewTunnelClient ¶
func NewTunnelClient( reader io.Reader, writer io.WriteCloser, ) (tunnel.TunnelClient, error)
func NewTunnelStatusReporter ¶ added in v1.13.0
NewTunnelStatusReporter returns a status.Reporter that forwards each event to client over the Status RPC, mirroring NewTunnelLogger's buffered-worker pattern so a slow/unavailable peer cannot stall the up pipeline.
func ReportResult ¶ added in v1.15.0
func ReportResult( ctx context.Context, tunnelClient tunnel.TunnelClient, fn func(ctx context.Context) (*config.Result, error), ) (*config.Result, error)
ReportResult runs fn and guarantees its outcome is sent over the tunnel via SendResult exactly once before returning, whether fn succeeds or fails.
func RunServicesServer ¶
func RunServicesServer(ctx context.Context, spec ServicesSpec) error
func RunSetupServer ¶
Types ¶
type HopOptions ¶
type HopOptions struct {
// Session is this process's run session.
Session *workspacelogs.Session
// Upstream is the client of the next host. Nil makes the hop receive-only.
Upstream tunnel.TunnelClient
// Receive accepts records mirrored from the previous host.
Receive bool
}
HopOptions selects what a hop does.
type Logger ¶ added in v1.1.0
type Logger interface {
Debugf(format string, args ...any)
Info(args ...any)
Infof(format string, args ...any)
Warnf(format string, args ...any)
}
Logger is the minimal logging interface used by workspace initialization. It is implemented by tunnelLogger, which sends log messages through the tunnel protocol back to the client.
func NewTunnelLogger ¶
type Option ¶
type Option func(*tunnelServer) *tunnelServer
func SetupLogOptionsFrom ¶
SetupLogOptionsFrom returns the options stored by WithSetupLogOptions.
func WithAllowGitCredentials ¶
func WithAllowGitHubCredentials ¶ added in v1.25.0
func WithAllowKubeConfig ¶
func WithForwarder ¶
func WithGitSSHSigningKey ¶ added in v1.25.0
WithGitSSHSigningKey configures the host Git SSH signing key for fallback resolution.
func WithGitToken ¶ added in v1.10.0
func WithMounts ¶
func WithPlatformOptions ¶
func WithPlatformOptions(options *devsy.PlatformOptions) Option
func WithSecrets ¶ added in v1.10.0
func WithSetupLogSink ¶
func WithSetupLogSink(sink *workspacelogs.Sink) Option
WithSetupLogSink accepts AppendSetupLogs batches for the sink's expected run. A nil sink leaves the RPC unimplemented, which senders treat as an old peer.
func WithSnapshotBuildContext ¶ added in v1.23.1
WithSnapshotBuildContext identifies generated residue to exclude, never upload authority.
func WithStatusReporter ¶ added in v1.13.0
WithStatusReporter forwards inbound StatusUpdate RPCs to reporter. A nil reporter is ignored, since it would replace the Nop default and panic.
func WithWorkspace ¶
func WithWorkspaceMount ¶ added in v1.23.1
WithWorkspaceMount limits workspace ignore rules to this mount.
type ServicesSpec ¶
type ServicesSpec struct {
Reader io.Reader
Writer io.WriteCloser
AllowGitCredentials bool
AllowDockerCredentials bool
Forwarder netstat.Forwarder
Workspace *provider2.Workspace
Options []Option
}
ServicesSpec configures RunServicesServer.
type SetupLogHop ¶
type SetupLogHop struct {
// contains filtered or unexported fields
}
SetupLogHop wires one process's side of setup history mirroring: it sends this process's own records to the next host, accepts records mirrored from the previous host, and forwards those on. Every method is safe on a nil hop, so a process without history changes nothing.
func NewSetupLogHop ¶
func NewSetupLogHop(ctx context.Context, opts HopOptions) *SetupLogHop
NewSetupLogHop builds the hop. It returns nil when the session is nil or the hop would do nothing.
func (*SetupLogHop) Flush ¶
func (h *SetupLogHop) Flush(ctx context.Context) bool
Flush drains everything upstream within the senders' own cleanup budget, even when ctx is already canceled. It reports whether the next host holds everything. Call it after the session is finished and before the result is reported.
func (*SetupLogHop) Options ¶
func (h *SetupLogHop) Options() []Option
Options returns the tunnel server option that accepts mirrored records.