dotnet

package
v0.0.0-...-47f0432 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PluginID is the dotnet plugin metadata registered in the plugin
	// catalog.
	PluginID = loader.PluginID{
		Name:       pluginName,
		PluginType: base.PluginTypeDriver,
	}

	// PluginConfig is the dotnet driver factory function registered in the
	// plugin catalog.
	PluginConfig = &loader.InternalPluginConfig{
		Config:  map[string]interface{}{},
		Factory: func(ctx context.Context, l hclog.Logger) interface{} { return NewDriver(ctx, l) },
	}
)

Functions

func CheckDotnetVersionInfo

func CheckDotnetVersionInfo(config *Config) (version string, err error)

func GetRuntimeVersions

func GetRuntimeVersions(config *Config) (runtimeVersions []string, err error)

func MergeConfigs

func MergeConfigs(dest, src any) error

func NewDriver

func NewDriver(ctx context.Context, logger hclog.Logger) drivers.DriverPlugin

Types

type Config

type Config struct {
	// DefaultModePID is the default PID isolation set for all tasks using
	// exec-based task drivers.
	DefaultModePID string `codec:"default_pid_mode"`

	// DefaultModeIPC is the default IPC isolation set for all tasks using
	// exec-based task drivers.
	DefaultModeIPC string `codec:"default_ipc_mode"`

	// AllowCaps configures which Linux Capabilities are enabled for tasks
	// running on this node.
	AllowCaps []string `codec:"allow_caps"`

	// SdkPath configures the path to the dotnet SDK binary (dotnet)
	SdkPath string `codec:"sdk_path"`

	// RuntimeVersions is the list of detected .NET runtime versions.
	RuntimeVersions []string `codec:"runtime_versions"`
}

Config is the driver configuration set by the SetConfig RPC call

type ConfigFile

type ConfigFile struct {
	RuntimeOptions struct {
		Tfm       string `json:"tfm,omitempty"`
		Framework struct {
			Name    string `json:"name,omitempty"`
			Version string `json:"version,omitempty"`
		} `json:"framework"`
		ConfigProperties struct {
			Enable                               *bool   `json:"System.GC.Server,omitempty"`
			Concurrent                           *bool   `json:"System.GC.Concurrent,omitempty"`
			LatencyMode                          *int    `json:"System.GC.LatencyMode,omitempty"`
			ForceCompact                         *bool   `json:"System.GC.ForceCompact,omitempty"`
			TrimCommit                           *bool   `json:"System.GC.TrimCommit,omitempty"`
			CompactOnBackgroundThread            *bool   `json:"System.GC.CompactOnBackgroundThread,omitempty"`
			RegionSize                           *int64  `json:"System.GC.RegionSize,omitempty"`
			AllowVeryLargeObjects                *bool   `json:"System.GC.AllowVeryLargeObjects,omitempty"`
			ServerHeapAffinitizeMask             *uint64 `json:"System.GC.ServerHeapAffinitizeMask,omitempty"`
			HeapCount                            *uint16 `json:"System.GC.HeapCount,omitempty"`
			HeapHardLimit                        *uint64 `json:"System.GC.HeapHardLimit,omitempty,"`
			HeapHardLimitPercent                 *uint8  `json:"System.GC.HeapHardLimitPercent,omitempty"`
			NoAffinity                           *bool   `json:"System.GC.NoAffinitize,omitempty"`
			HeapAffinityMask                     *uint16 `json:"System.GC.HeapAffinitizeMask,omitempty"`
			HeapAffinityRanges                   *string `json:"System.GC.HeapAffinitizeRanges,omitempty"`
			CpuGroup                             *bool   `json:"System.GC.CpuGroup,omitempty"`
			HighMemPercent                       *uint8  `json:"System.GC.HighMemPercent,omitempty"`
			RetainVM                             *bool   `json:"System.GC.RetainVM,omitempty"`
			InvariantCulture                     *bool   `json:"System.Globalization.InvariantCulture,omitempty"`
			UseNls                               *bool   `json:"System.Globalization.UseNls,omitempty"`
			PreferSystemLibraries                *bool   `json:"System.Globalization.PreferSystemLibraries,omitempty"`
			GlobalizationInvariant               *bool   `json:"System.Globalization.Invariant,omitempty"`
			PredefinedCulturesOnly               *bool   `json:"System.Globalization.PredefinedCulturesOnly,omitempty"`
			ThreadPoolMinThreads                 *uint32 `json:"System.Threading.ThreadPool.MinThreads,omitempty"`
			ThreadPoolMaxThreads                 *uint32 `json:"System.Threading.ThreadPool.MaxThreads,omitempty"`
			ThreadPoolMinIOCompletionThreads     *int    `json:"System.Threading.ThreadPool.MinIOCompletionThreads,omitempty"`
			ThreadPoolMaxIOCompletionThreads     *int    `json:"System.Threading.ThreadPool.MaxIOCompletionThreads,omitempty"`
			ThreadPoolUnfairSemaphoreSpinLimit   *int    `json:"System.Threading.ThreadPool.UnfairSemaphoreSpinLimit,omitempty"`
			ThreadUseAllCpuGroups                *bool   `json:"System.Threading.UseAllCpuGroups,omitempty"`
			UseWindowsThreadPool                 *bool   `json:"System.Threading.ThreadPool.UseWindowsThreadPool,omitempty"`
			AutoReleasePoolSupport               *bool   `json:"System.Threading.Thread.EnableAutoreleasePool,omitempty"`
			StartupHook                          *string `json:"System.StartupHook,omitempty"`
			UseReadyToRun                        *bool   `json:"System.Runtime.UseReadyToRun,omitempty"`
			UseTieredCompilation                 *bool   `json:"System.Runtime.TieredCompilation,omitempty"`
			TieredCompilationQuickJit            *bool   `json:"System.Runtime.TieredCompilation.QuickJit,omitempty"`
			TieredCompilationQuickJitForLoops    *bool   `json:"System.Runtime.TieredCompilation.QuickJitForLoops,omitempty"`
			DisableJitOptimizations              *bool   `json:"System.Runtime.DisableJitOptimizations,omitempty"`
			EnableDiagnostics                    *bool   `json:"System.Runtime.EnableDiagnostics,omitempty"`
			MaxStackSize                         *int64  `json:"System.Runtime.MaxStackSize,omitempty"`
			DefaultTimeZone                      *string `json:"System.Runtime.DefaultTimeZone,omitempty"`
			AssemblyLoadNoOptimizations          *bool   `json:"System.Runtime.Loader.AssemblyLoadNoOptimizations,omitempty"`
			EnableAssemblyLoadContextRedirection *bool   `json:"System.Runtime.Loader.EnableAssemblyLoadContextRedirection,omitempty"`
			MetaDataUpdaterSupport               *bool   `json:"System.Reflection.Metadata.MetadataUpdater.IsSupported,omitempty"`
		} `json:"configProperties"`
	} `json:"runtimeOptions"`
}

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver is a driver for running images via Dotnet

func (*Driver) Capabilities

func (d *Driver) Capabilities() (*drivers.Capabilities, error)

func (*Driver) ConfigSchema

func (d *Driver) ConfigSchema() (*hclspec.Spec, error)

func (*Driver) DestroyTask

func (d *Driver) DestroyTask(taskID string, force bool) error

func (*Driver) ExecTask

func (d *Driver) ExecTask(taskID string, cmd []string, timeout time.Duration) (*drivers.ExecTaskResult, error)

func (*Driver) ExecTaskStreamingRaw

func (d *Driver) ExecTaskStreamingRaw(ctx context.Context,
	taskID string,
	command []string,
	tty bool,
	stream drivers.ExecTaskStream) error

func (*Driver) Fingerprint

func (d *Driver) Fingerprint(ctx context.Context) (<-chan *drivers.Fingerprint, error)

func (*Driver) InspectTask

func (d *Driver) InspectTask(taskID string) (*drivers.TaskStatus, error)

func (*Driver) PluginInfo

func (d *Driver) PluginInfo() (*base.PluginInfoResponse, error)

func (*Driver) RecoverTask

func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error

func (*Driver) SetConfig

func (d *Driver) SetConfig(cfg *base.Config) error

func (*Driver) SignalTask

func (d *Driver) SignalTask(taskID string, signal string) error

func (*Driver) StartTask

func (*Driver) StopTask

func (d *Driver) StopTask(taskID string, timeout time.Duration, signal string) error

func (*Driver) TaskConfigSchema

func (d *Driver) TaskConfigSchema() (*hclspec.Spec, error)

func (*Driver) TaskEvents

func (d *Driver) TaskEvents(ctx context.Context) (<-chan *drivers.TaskEvent, error)

func (*Driver) TaskStats

func (d *Driver) TaskStats(ctx context.Context, taskID string, interval time.Duration) (<-chan *drivers.TaskResourceUsage, error)

func (*Driver) WaitTask

func (d *Driver) WaitTask(ctx context.Context, taskID string) (<-chan *drivers.ExitResult, error)

type GcConfig

type GcConfig struct {
	Enable               *bool   `codec:"enable"`
	Concurrent           *bool   `codec:"concurrent"`
	HeapCount            *uint16 `codec:"heap_count"`
	HeapHardLimit        *uint64 `codec:"heap_limit"`
	HeapHardLimitPercent *uint8  `codec:"heap_limit_percent"`
	NoAffinity           *bool   `codec:"no_affinity"`
	HeapAffinityMask     *uint16 `codec:"heap_affinity_mask"`
	HeapAffinityRanges   *string `codec:"heap_affinity_ranges"`
	CpuGroup             *bool   `codec:"cpu_group"`
	HighMemPercent       *uint8  `codec:"high_mem_percent"`
	RetainVM             *bool   `codec:"retain_vm"`
}

type GlobalizationConfig

type GlobalizationConfig struct {
	Invariant              *bool `codec:"invariant"`
	UseNls                 *bool `codec:"use_nls"`
	PredefinedCulturesOnly *bool `codec:"predefined_cultures_only"`
}

type TaskConfig

type TaskConfig struct {

	// DotnetPath indicates where a dll file is found.
	DotnetPath string `codec:"dll_path"`

	// SdkVersion indicates which version of dotnet the task must be run
	RuntimeVersion *string `codec:"runtime_version"`

	// RuntimeOptions are arguments to pass to the dotnet
	GC *GcConfig `codec:"gc"`

	Globalization *GlobalizationConfig `codec:"globalization"`

	Threading *ThreadingConfig `codec:"threading"`

	// Args are extra arguments to dotnet executable
	Args []string `codec:"args"`

	// ModePID indicates whether PID namespace isolation is enabled for the task.
	// Must be "private" or "host" if set.
	ModePID string `codec:"pid_mode"`

	// ModeIPC indicates whether IPC namespace isolation is enabled for the task.
	// Must be "private" or "host" if set.
	ModeIPC string `codec:"ipc_mode"`

	// CapAdd is a set of linux capabilities to enable.
	CapAdd []string `codec:"cap_add"`

	// CapDrop is a set of linux capabilities to disable.
	CapDrop []string `codec:"cap_drop"`
}

TaskConfig is the driver configuration of a taskConfig within a job

type TaskState

type TaskState struct {
	ReattachConfig *pstructs.ReattachConfig
	TaskConfig     *drivers.TaskConfig
	Pid            int
	StartedAt      time.Time
}

TaskState is the state which is encoded in the handle returned in StartTask. This information is needed to rebuild the taskConfig state and handler during recovery.

type ThreadingConfig

type ThreadingConfig struct {
	ThreadPoolMinThreads   *uint32 `codec:"min_threads"`
	ThreadPoolMaxThreads   *uint32 `codec:"max_threads"`
	UseWindowsThreadPool   *bool   `codec:"windows_thread_pool"`
	AutoReleasePoolSupport *bool   `codec:"enable_autorelease_pool"`
}

Jump to

Keyboard shortcuts

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