sandboxworker

package module
v0.0.0-...-cf623d3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 17 Imported by: 1

README

(under research)

Attempt code rewrites to remove non-determinism. Approach:

  • Probably use -overlay to replace code during compile time
  • Add deterministic pieces to runtime package for map iteration, channel creation, etc
    • Use //go:linkname to avoid direct dependency on sdk-go/workflow package?
  • Change out the context package
    • Use //go:linkname to avoid direct dependency on sdk-go/workflow package?
  • Disable some calls/packages (e.g. time.Now, crypto/rand, etc)
    • Cannot remove since we have to let all code compile, just disable at runtime

Currently sucks because:

  • Local activities and logging and such have to use IPC to call back to primary process and I didn't want to write all of that (yet)
  • Not sure we can rewrite packages depended on by sdk-go/workflow and sdk-go/worker since we expect those to continue to work
  • Have to essentially have global context so we can not require such a param be woven throughout

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	Name           string
	Version        string
	ReplaceVersion string
	// This should be an absolute path
	ReplaceDir string
}

type Options

type Options struct {
	// Required
	TaskQueue string

	// This must reference a package-level function. No lambda or receiver methods
	// allowed. Caller should set options and register workflows and activities.
	// Note, this will be called multiple times, one for activity side and one for
	// workflow side.
	//
	// Required.
	InitWorker func(*worker.Options, worker.Registry) error

	// This must reference a package-level function. No lambda or receiver methods
	// allowed. Caller should set options. Note, this will be called multiple
	// times, one for activity side and one for workflow side.
	//
	// Optional.
	InitClient func(*client.Options) error

	// Any modules not included but referenced will let Go derive them on its own.
	IncludeModules []*Module

	// Defaults to os.TempDir().
	TempDirRoot string

	// Default is no log
	Logf func(string, ...interface{})
}

type Worker

type Worker struct {
	// These fields are not populated if
	TempDir string
	Cmd     *exec.Cmd
	// contains filtered or unexported fields
}

func Build

func Build(options Options) (*Worker, error)

Worker is sometimes returned even when an error is, but it does not have to be closed unless there is no error.

func (*Worker) Close

func (w *Worker) Close() error

func (*Worker) Start

func (w *Worker) Start()

Directories

Path Synopsis
sandboxrt module
test module

Jump to

Keyboard shortcuts

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