{"modulePath":"github.com/aws/aws-lambda-runtime-interface-emulator","version":"v0.0.0-20261030222936-bef5c4ba774d","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package model\n\n## Types\n\n```go\ntype BindMount struct {\n\tSource      string   `json:\"source,omitempty\"`\n\tDestination string   `json:\"destination,omitempty\"`\n\tOptions     []string `json:\"options,omitempty\"`\n}\n```\n\n```go\nfunc (m *BindMount) MarshalJSON() ([]byte, error)\n```\n\n```go\ntype Capabilities struct {\n\tAmbient     []string `json:\"ambient,omitempty\"`\n\tBounding    []string `json:\"bounding,omitempty\"`\n\tEffective   []string `json:\"effective,omitempty\"`\n\tInheritable []string `json:\"inheritable,omitempty\"`\n\tPermitted   []string `json:\"permitted,omitempty\"`\n}\n```\n\n```go\ntype CgroupProfileConfig struct {\n\tCPULimit         float64 `json:\"cpu_limit\"`\n\tMemoryLimitBytes uint64  `json:\"memory_limit_bytes\"`\n}\n```\n\n```go\ntype CgroupProfileName string\n```\n\n```go\nconst (\n\tThrottled   CgroupProfileName = \"throttled\"\n\tUnthrottled CgroupProfileName = \"unthrottled\"\n)\n```\n\n```go\ntype CgroupProfiles struct {\n\tThrottled   CgroupProfileConfig `json:\"throttled\"`\n\tUnthrottled CgroupProfileConfig `json:\"unthrottled\"`\n}\n```\n\n```go\ntype ConfigureRequest struct {\n\t// domain to configure\n\tDomain         string        `json:\"domain\"`\n\tMounts         []Mount       `json:\"mounts,omitempty\"`\n\tCapabilities   *Capabilities `json:\"capabilities,omitempty\"`\n\tSeccompFilters []string      `json:\"seccomp_filters,omitempty\"`\n\t// list of cgroup profiles available for the domain\n\t// cgroup profiles are set on start and thaw request. Start profile\n\t// if configured (as it can vary), thaw profile is always the same (throttled)\n\tCgroupProfiles *CgroupProfiles `json:\"cgroup_profiles,omitempty\"`\n\t// name of the cgroup profile to enforce at domain start\n\tStartProfile CgroupProfileName `json:\"start_profile,omitempty\"`\n\t// uid and gid of the user the spawned process runs as (w.r.t. the domain user namespace).\n\t// If nil, Supervisor will use the ExecUser specified in the domain configuration file\n\tExecUser *ExecUser `json:\"exec_user,omitempty\"`\n\t// additional hooks to execute on domain start\n\tAdditionalStartHooks []Hook `json:\"additional_start_hooks,omitempty\"`\n}\n```\n\n```go\ntype ContainerSupervisor interface {\n\tStart(context.Context, *StartRequest) error\n\tConfigure(context.Context, *ConfigureRequest) error\n\tStop(context.Context, *StopRequest) (*StopResponse, error)\n\tFreeze(context.Context, *FreezeRequest) (*FreezeResponse, error)\n\tThaw(context.Context, *ThawRequest) error\n\tExit(context.Context)\n}\n```\nStart, Stop and Configure methods are not used in Core anymore. Client interface splitted into Launcher and Executer parts for backward compatibility of dependent packages.\n\n```go\ntype CycleDeltaMetrics struct {\n\t// CPU time (in nanoseconds) obtained by domain cgroup from cpuacct.usage\n\t// https://www.kernel.org/doc/Documentation/cgroup-v1/cpuacct.txt\n\tDomainCPURunNs uint64 `json:\"domain_cpu_run_ns\"`\n\t// time (in nanoseconds) for domain cycle\n\tDomainRunNs uint64 `json:\"domain_run_ns\"`\n\t// CPU delta time for service cgroup\n\tServiceCPURunNs uint64 `json:\"service_cpu_run_ns\"`\n\t// Maximum memory used (in bytes) for domain\n\tDomainMaxMemoryUsageBytes uint64 `json:\"domain_max_memory_usage_bytes\"`\n\t// CPU delta time (in nanoseconds) obtained from /sys/fs/cgroup/cpu,cpuacct/cpuacct.usage\n\tMicrovmCPURunNs uint64 `json:\"microvm_cpu_run_ns\"`\n\t// Map with network interface name as key and network metrics as a value\n\tMicrovmNetworksBytes map[string]MicrovmNetworkInterfaceMetrics `json:\"microvm_network_interfaces\"`\n\t// time ( in nanoseconds ) for idle cpu time\n\tInvokeIdleCPURunNs uint64 `json:\"idle_cpu_run_ns\"`\n}\n```\n\n```go\ntype DriveMount struct {\n\tSource      string   `json:\"source,omitempty\"`\n\tDestination string   `json:\"destination,omitempty\"`\n\tFsType      string   `json:\"fs_type,omitempty\"`\n\tOptions     []string `json:\"options,omitempty\"`\n\tChowner     []uint32 `json:\"chowner,omitempty\"` // array of two integers representing a tuple\n\tChmode      uint32   `json:\"chmode,omitempty\"`\n}\n```\nMount in lockhard::mnt is a Rust enum, an algebraic type, where each case has different set of fields. This models only the Mount::Drive case, the only one we need for now.\n\n```go\nfunc (m *DriveMount) MarshalJSON() ([]byte, error)\n```\nAdds the \"type\": \"drive\" to json\n\n```go\ntype ErrorKind string\n```\n\n```go\nconst (\n\t// operation on an unkown entity (e.g., domain process)\n\tNoSuchEntity ErrorKind = \"no_such_entity\"\n\t// operation not allowed in the current state (e.g., tried to exec a proces in a domain which is not booted)\n\tInvalidState ErrorKind = \"invalid_state\"\n\t// Serialization or derserialization issue in the communication\n\tSerde ErrorKind = \"serde\"\n\t// Unhandled Supervisor server error\n\tFailure ErrorKind = \"failure\"\n)\n```\n\n```go\ntype Event struct {\n\tTime  uint64    `json:\"timestamp_millis\"`\n\tEvent EventData `json:\"event\"`\n}\n```\n\n```go\ntype EventData struct {\n\tEvType     string  `json:\"type\"`\n\tDomain     *string `json:\"domain\"`\n\tName       *string `json:\"name\"`\n\tCause      *string `json:\"cause\"`\n\tSigno      *int32  `json:\"signo\"`\n\tExitStatus *int32  `json:\"exit_status\"`\n\tSize       *uint64 `json:\"size\"`\n}\n```\nEventData is a union type tagged by the \"EventType\" and \"Cause\" strings. you can use ProcessTermination() or EventLoss() to access the correct type of Event.\n\n```go\nfunc (d EventData) EventLoss() *uint64\n```\nreturns nil if the event is not a EventLoss event otherwise returns how many events were lost due to backpressure (slow reader)\n\n```go\nfunc (d EventData) ProcessTerminated() *ProcessTermination\n```\nReturns a ProcessTermination struct that describe the process which terminated. Use Signaled() or Exited() to check whether the process terminated because of a signal or exited on its own\n\n```go\ntype EventsRequest struct {\n\tDomain string `json:\"domain\"`\n}\n```\n\n```go\ntype ExecRequest struct {\n\t// Identifier that Supervisor will assign to the spawned process.\n\t// The tuple (Domain,Name) must be unique. It is the caller's responsibility\n\t// to generate the unique name\n\tName   string `json:\"name\"`\n\tDomain string `json:\"domain\"`\n\t// Path pointing to the exectuable file within the domain's root filesystem\n\tPath string   `json:\"path\"`\n\tArgs []string `json:\"args,omitempty\"`\n\t// If nil, root of the domain\n\tCwd          *string            `json:\"cwd,omitempty\"`\n\tEnv          *map[string]string `json:\"env,omitempty\"`\n\tLogging      Logging            `json:\"log_config\"`\n\tStdoutWriter io.Writer          `json:\"-\"`\n\tStderrWriter io.Writer          `json:\"-\"`\n\tExtraFiles   *[]*os.File        `json:\"-\"`\n}\n```\n\n```go\ntype ExecUser struct {\n\tUID *uint32 `json:\"uid\"`\n\tGID *uint32 `json:\"gid\"`\n}\n```\n\n```go\ntype FreezeRequest struct {\n\tDomain string `json:\"domain\"`\n}\n```\n\n```go\ntype FreezeResponse struct {\n\tCycleDeltaMetrics CycleDeltaMetrics `json:\"cycle_delta_metrics\"`\n}\n```\n\n```go\ntype Hook struct {\n\t// Unique name identifying the hook\n\tName string `json:\"name\"`\n\t// Path in the parent domain mount namespace that locates\n\t// the executable to run as the hook\n\tPath string `json:\"path\"`\n\t// Args for the hook\n\tArgs []string `json:\"args,omitempty\"`\n\t// Map of ENV variables to set when running the hook\n\tEnv *map[string]string `json:\"envs,omitempty\"`\n}\n```\n\n```go\ntype KillRequest struct {\n\tName     string    `json:\"name\"`\n\tDomain   string    `json:\"domain\"`\n\tDeadline time.Time `json:\"deadline\"`\n}\n```\nForce terminate a process (SIGKILL) Block until process is exited or timeout Deadline needs to be in the future\n\n```go\ntype Logging struct {\n\tManaged ManagedLogging `json:\"managed\"`\n}\n```\nLogging specifies where Supervisor should send Command's logs to\n\n```go\ntype ManagedLogging struct {\n\tTopic   ManagedLoggingTopic    `json:\"topic\"`\n\tFormats []ManagedLoggingFormat `json:\"formats\"`\n}\n```\n\n```go\ntype ManagedLoggingFormat string\n```\n\n```go\nconst (\n\tLineBasedManagedLogging    ManagedLoggingFormat = \"line\"\n\tMessageBasedManagedLogging ManagedLoggingFormat = \"message\"\n)\n```\n\n```go\ntype ManagedLoggingTopic string\n```\n\n```go\nconst (\n\tRuntimeManagedLoggingTopic     ManagedLoggingTopic = \"runtime\"\n\tRtExtensionManagedLoggingTopic ManagedLoggingTopic = \"runtime_extension\"\n)\n```\n\n```go\ntype MicrovmNetworkInterfaceMetrics struct {\n\tReceivedBytes    uint64 `json:\"received_bytes\"`\n\tTransmittedBytes uint64 `json:\"transmitted_bytes\"`\n}\n```\n\n```go\ntype Mount struct {\n\tDriveMount DriveMount\n\tBindMount  BindMount\n\tMountType  MountType\n}\n```\n\n```go\nfunc (m *Mount) MarshalJSON() ([]byte, error)\n```\n\n```go\ntype MountType int\n```\n\n```go\nconst (\n\tMountTypeDrive MountType\n\tMountTypeBind\n)\n```\n\n```go\ntype ProcessSupervisor interface {\n\tExec(context.Context, *ExecRequest) error\n\tTerminate(context.Context, *TerminateRequest) error\n\tKill(context.Context, *KillRequest) error\n\tEvents(context.Context, *EventsRequest) (\u003c-chan Event, error)\n}\n```\n\n```go\ntype ProcessTermination struct {\n\tDomain     *string\n\tName       *string\n\tSigno      *int32\n\tExitStatus *int32\n}\n```\nEvent signalling that a process exited\n\n```go\nfunc (t ProcessTermination) Exited() *int32\n```\nIt not nil, the process exited (as opposed to killed by a signal). The returned value is the exit\\_status returned by the process\n\n```go\nfunc (t ProcessTermination) Signaled() *int32\n```\nIf not nil, the process was terminated by an unhandled signal. The returned value is the number of the signal that terminated the process\n\n```go\nfunc (t ProcessTermination) String() string\n```\nTransform the process termination status in a string that is equal to what would be returned by golang exec.ExitError.Error() We used to rely on this format to report errors to customer (sigh) so we keep this for backwards compatibility\n\n```go\nfunc (t ProcessTermination) Success() bool\n```\n\n```go\ntype StartRequest struct {\n\tDomain string `json:\"domain\"`\n}\n```\n\n```go\ntype StopRequest struct {\n\tDomain   string    `json:\"domain\"`\n\tDeadline time.Time `json:\"deadline\"`\n}\n```\nStop the domain.\n\n```go\ntype StopResponse struct {\n\tCycleDeltaMetrics CycleDeltaMetrics `json:\"cycle_delta_metrics\"`\n}\n```\n\n```go\ntype SupervisorClient interface {\n\tContainerSupervisor\n\tProcessSupervisor\n\tPing(ctx context.Context) error\n}\n```\n\n```go\ntype SupervisorError struct {\n\tKind    ErrorKind `json:\"error_kind\"`\n\tMessage *string   `json:\"message\"`\n}\n```\n\n```go\nfunc (e *SupervisorError) Error() string\n```\n\n```go\ntype TerminateRequest struct {\n\tName   string `json:\"name\"`\n\tDomain string `json:\"domain\"`\n}\n```\nSend SIGETERM asynchrnously to a process\n\n```go\ntype ThawRequest struct {\n\tDomain string `json:\"domain\"`\n}\n```\n\n","path":"github.com/aws/aws-lambda-runtime-interface-emulator/internal/lambda/supervisor/model","name":"model","synopsis":"","isRedistributable":true}
