Documentation ¶
Index ¶
- Constants
- Variables
- func ParsePropertiesFile(path string) (map[string]string, error)
- func SetInternalLogOutput(w io.Writer)
- func SetLogLevel(logLevel string)
- type DoneWithState
- type EmulatorAPI
- type InvokeContext
- type LambdaInvokeAPI
- type Logging
- type ReserveResponse
- type RuntimeRelease
- type SandboxBuilder
- func (b *SandboxBuilder) AddShutdownFunc(shutdownFunc func()) *SandboxBuilder
- func (b *SandboxBuilder) Create() (interop.SandboxContext, interop.InternalStateGetter)
- func (b *SandboxBuilder) DefaultInteropServer() *Server
- func (b *SandboxBuilder) DisableStandaloneMode() *SandboxBuilder
- func (b *SandboxBuilder) LambdaInvokeAPI() LambdaInvokeAPI
- func (b *SandboxBuilder) SetEventsAPI(eventsAPI interop.EventsAPI) *SandboxBuilder
- func (b *SandboxBuilder) SetExtensionsFlag(extensionsEnabled bool) *SandboxBuilder
- func (b *SandboxBuilder) SetHandler(handler string) *SandboxBuilder
- func (b *SandboxBuilder) SetInitCachingFlag(initCachingEnabled bool) *SandboxBuilder
- func (b *SandboxBuilder) SetInteropServer(interopServer interop.Server) *SandboxBuilder
- func (b *SandboxBuilder) SetLogsEgressAPI(logsEgressAPI telemetry.StdLogsEgressAPI) *SandboxBuilder
- func (b *SandboxBuilder) SetRuntimeAPIAddress(runtimeAPIAddress string) *SandboxBuilder
- func (b *SandboxBuilder) SetRuntimeFsRootPath(rootPath string) *SandboxBuilder
- func (b *SandboxBuilder) SetSupervisor(supervisor supvmodel.ProcessSupervisor) *SandboxBuilder
- func (b *SandboxBuilder) SetTelemetrySubscription(logsSubscriptionAPI telemetry.SubscriptionAPI, ...) *SandboxBuilder
- func (b *SandboxBuilder) SetTracer(tracer telemetry.Tracer) *SandboxBuilder
- type SandboxContext
- func (s SandboxContext) Init(init *interop.Init, timeoutMs int64) interop.InitContext
- func (s SandboxContext) Reset(reset *interop.Reset) (interop.ResetSuccess, *interop.ResetFailure)
- func (s SandboxContext) Restore(restore *interop.Restore) (interop.RestoreResult, error)
- func (s *SandboxContext) SetInvokeResponseMetrics(metrics *interop.InvokeResponseMetrics)
- func (s *SandboxContext) SetRuntimeStartedTime(runtimeStartedTime int64)
- func (s SandboxContext) Shutdown(shutdown *interop.Shutdown) interop.ShutdownSuccess
- type Server
- func (s *Server) AwaitInitialized() error
- func (s *Server) AwaitRelease() (*statejson.ReleaseResponse, error)
- func (s *Server) Clear()
- func (s *Server) CurrentToken() *interop.Token
- func (s *Server) FastInvoke(w http.ResponseWriter, i *interop.Invoke, direct bool) error
- func (s *Server) GetCurrentInvokeID() string
- func (s *Server) GetInvokeContext() *InvokeContext
- func (s *Server) GetInvokeTimeout() time.Duration
- func (s *Server) Init(i *interop.Init, invokeTimeoutMs int64) error
- func (s *Server) InternalState() (*statejson.InternalStateDescription, error)
- func (s *Server) Invoke(responseWriter http.ResponseWriter, invoke *interop.Invoke) error
- func (s *Server) Release() error
- func (s *Server) Reserve(id string, traceID, lambdaSegmentID string) (*ReserveResponse, error)
- func (s *Server) Reset(reason string, timeoutMs int64) (*statejson.ResetDescription, error)
- func (s *Server) Restore(restore *interop.Restore) (interop.RestoreResult, error)
- func (s *Server) SendErrorResponse(invokeID string, resp *interop.ErrorInvokeResponse) error
- func (s *Server) SendInitErrorResponse(resp *interop.ErrorInvokeResponse) error
- func (s *Server) SendResponse(invokeID string, resp *interop.StreamableInvokeResponse) error
- func (s *Server) SendRuntimeReady() error
- func (s *Server) SetInternalStateGetter(cb interop.InternalStateGetter)
- func (s *Server) SetInvokeTimeout(timeout time.Duration)
- func (s *Server) SetSandboxContext(sbCtx interop.SandboxContext)
- func (s *Server) Shutdown(shutdown *interop.Shutdown) *statejson.InternalStateDescription
Constants ¶
const ( RuntimeLogSink logSink = iota ExtensionLogSink )
const RuntimeReleasePath = "/var/runtime/runtime-release"
Variables ¶
var ErrAlreadyInvocating = errors.New("AlreadyInvocating")
var ErrAlreadyReplied = errors.New("AlreadyReplied")
var ErrAlreadyReserved = errors.New("AlreadyReserved")
var ErrInitDoneFailed = errors.New("InitDoneFailed")
var ErrInitNotStarted = errors.New("InitNotStarted")
var ErrInitResetReceived = errors.New("InitResetReceived")
var ErrInternalServerError = errors.New("InternalServerError")
var ErrInvokeDoneFailed = errors.New("InvokeDoneFailed")
var ErrInvokeReservationDone = errors.New("InvokeReservationDone")
var ErrInvokeResponseAlreadyWritten = errors.New("InvokeResponseAlreadyWritten")
var ErrInvokeTimeout = errors.New("InvokeTimeout")
var ErrNotReserved = errors.New("NotReserved")
var ErrReleaseReservationDone = errors.New("ReleaseReservationDone")
var ErrReserveReservationDone = errors.New("ReserveReservationDone")
Functions ¶
func ParsePropertiesFile ¶
ParsePropertiesFile reads key-value pairs from file in newline-separated list of environment-like shell-compatible variable assignments. Format: https://www.freedesktop.org/software/systemd/man/os-release.html Value quotes are trimmed. Latest write wins for duplicated keys.
func SetInternalLogOutput ¶
func SetLogLevel ¶
func SetLogLevel(logLevel string)
SetLogLevel sets the log level for internal logging. Needs to be called very early during startup to configure logs emitted during initialization
Types ¶
type DoneWithState ¶
type DoneWithState struct { *interop.Done State statejson.InternalStateDescription }
func (*DoneWithState) String ¶
func (s *DoneWithState) String() string
type EmulatorAPI ¶
type EmulatorAPI struct {
// contains filtered or unexported fields
}
EmulatorAPI wraps the standalone interop server to provide a convenient interface for Rapid Standalone
func NewEmulatorAPI ¶
func NewEmulatorAPI(s *Server) *EmulatorAPI
func (*EmulatorAPI) Init ¶
func (l *EmulatorAPI) Init(i *interop.Init, timeoutMs int64)
Init method is only used by the Runtime interface emulator
func (*EmulatorAPI) Invoke ¶
func (l *EmulatorAPI) Invoke(w http.ResponseWriter, i *interop.Invoke) error
Invoke method is only used by the Runtime interface emulator
type InvokeContext ¶
type LambdaInvokeAPI ¶
type LambdaInvokeAPI interface { Init(i *interop.Init, invokeTimeoutMs int64) Invoke(responseWriter http.ResponseWriter, invoke *interop.Invoke) error }
LambdaInvokeAPI are the methods used by the Runtime Interface Emulator
type ReserveResponse ¶
type ReserveResponse struct { Token interop.Token InternalState *statejson.InternalStateDescription }
type RuntimeRelease ¶
RuntimeRelease stores runtime identification data
func GetRuntimeRelease ¶
func GetRuntimeRelease(path string) (*RuntimeRelease, error)
GetRuntimeRelease reads Runtime identification data from config file and parses it into a struct
type SandboxBuilder ¶
type SandboxBuilder struct {
// contains filtered or unexported fields
}
func NewSandboxBuilder ¶
func NewSandboxBuilder() *SandboxBuilder
func (*SandboxBuilder) AddShutdownFunc ¶
func (b *SandboxBuilder) AddShutdownFunc(shutdownFunc func()) *SandboxBuilder
func (*SandboxBuilder) Create ¶
func (b *SandboxBuilder) Create() (interop.SandboxContext, interop.InternalStateGetter)
func (*SandboxBuilder) DefaultInteropServer ¶
func (b *SandboxBuilder) DefaultInteropServer() *Server
func (*SandboxBuilder) DisableStandaloneMode ¶
func (b *SandboxBuilder) DisableStandaloneMode() *SandboxBuilder
func (*SandboxBuilder) LambdaInvokeAPI ¶
func (b *SandboxBuilder) LambdaInvokeAPI() LambdaInvokeAPI
func (*SandboxBuilder) SetEventsAPI ¶
func (b *SandboxBuilder) SetEventsAPI(eventsAPI interop.EventsAPI) *SandboxBuilder
func (*SandboxBuilder) SetExtensionsFlag ¶
func (b *SandboxBuilder) SetExtensionsFlag(extensionsEnabled bool) *SandboxBuilder
func (*SandboxBuilder) SetHandler ¶
func (b *SandboxBuilder) SetHandler(handler string) *SandboxBuilder
func (*SandboxBuilder) SetInitCachingFlag ¶
func (b *SandboxBuilder) SetInitCachingFlag(initCachingEnabled bool) *SandboxBuilder
func (*SandboxBuilder) SetInteropServer ¶
func (b *SandboxBuilder) SetInteropServer(interopServer interop.Server) *SandboxBuilder
func (*SandboxBuilder) SetLogsEgressAPI ¶
func (b *SandboxBuilder) SetLogsEgressAPI(logsEgressAPI telemetry.StdLogsEgressAPI) *SandboxBuilder
func (*SandboxBuilder) SetRuntimeAPIAddress ¶
func (b *SandboxBuilder) SetRuntimeAPIAddress(runtimeAPIAddress string) *SandboxBuilder
func (*SandboxBuilder) SetRuntimeFsRootPath ¶
func (b *SandboxBuilder) SetRuntimeFsRootPath(rootPath string) *SandboxBuilder
func (*SandboxBuilder) SetSupervisor ¶
func (b *SandboxBuilder) SetSupervisor(supervisor supvmodel.ProcessSupervisor) *SandboxBuilder
func (*SandboxBuilder) SetTelemetrySubscription ¶
func (b *SandboxBuilder) SetTelemetrySubscription(logsSubscriptionAPI telemetry.SubscriptionAPI, telemetrySubscriptionAPI telemetry.SubscriptionAPI) *SandboxBuilder
func (*SandboxBuilder) SetTracer ¶
func (b *SandboxBuilder) SetTracer(tracer telemetry.Tracer) *SandboxBuilder
type SandboxContext ¶
type SandboxContext struct {
// contains filtered or unexported fields
}
SandboxContext and other structs form the implementation of the SandboxAPI interface defined in interop/sandbox_model.go, using the implementation of Init, Invoke and Reset handlers in rapid/sandbox.go
func (SandboxContext) Init ¶
func (s SandboxContext) Init(init *interop.Init, timeoutMs int64) interop.InitContext
Init starts the runtime domain initialization in a separate goroutine. Return value indicates that init request has been accepted and started.
func (SandboxContext) Reset ¶
func (s SandboxContext) Reset(reset *interop.Reset) (interop.ResetSuccess, *interop.ResetFailure)
Reset triggers a reset. In case of timeouts, the reset handler cancels all flows which triggers ongoing invoke handlers to return before proceeding with invoke TODO: move this method to the initialization context, since reset is conceptually on RT domain
func (SandboxContext) Restore ¶
func (s SandboxContext) Restore(restore *interop.Restore) (interop.RestoreResult, error)
func (*SandboxContext) SetInvokeResponseMetrics ¶
func (s *SandboxContext) SetInvokeResponseMetrics(metrics *interop.InvokeResponseMetrics)
func (*SandboxContext) SetRuntimeStartedTime ¶
func (s *SandboxContext) SetRuntimeStartedTime(runtimeStartedTime int64)
func (SandboxContext) Shutdown ¶
func (s SandboxContext) Shutdown(shutdown *interop.Shutdown) interop.ShutdownSuccess
Reset triggers a shutdown. This is similar to a reset, except that this is a terminal state and no further invokes are allowed
type Server ¶
type Server struct { InternalStateGetter interop.InternalStateGetter InitDoneChan chan DoneWithState InvokeDoneChan chan DoneWithState ResetDoneChan chan *interop.Done ShutdownDoneChan chan *interop.Done // contains filtered or unexported fields }
func (*Server) AwaitInitialized ¶
AwaitInitialized waits until init is complete. It must be idempotent, since it can be called twice when a caller wants to wait until init is complete
func (*Server) AwaitRelease ¶
func (s *Server) AwaitRelease() (*statejson.ReleaseResponse, error)
func (*Server) CurrentToken ¶
func (*Server) FastInvoke ¶
func (*Server) GetInvokeContext ¶
func (s *Server) GetInvokeContext() *InvokeContext
func (*Server) GetInvokeTimeout ¶
func (*Server) InternalState ¶
func (s *Server) InternalState() (*statejson.InternalStateDescription, error)
func (*Server) Invoke ¶
Invoke is used by the Runtime Interface Emulator (Rapid Local) https://github.com/aws/aws-lambda-runtime-interface-emulator
func (*Server) Reserve ¶
func (s *Server) Reserve(id string, traceID, lambdaSegmentID string) (*ReserveResponse, error)
Reserve allocates invoke context
func (*Server) SendErrorResponse ¶
func (s *Server) SendErrorResponse(invokeID string, resp *interop.ErrorInvokeResponse) error
func (*Server) SendInitErrorResponse ¶
func (s *Server) SendInitErrorResponse(resp *interop.ErrorInvokeResponse) error
func (*Server) SendResponse ¶
func (s *Server) SendResponse(invokeID string, resp *interop.StreamableInvokeResponse) error
func (*Server) SendRuntimeReady ¶
func (*Server) SetInternalStateGetter ¶
func (s *Server) SetInternalStateGetter(cb interop.InternalStateGetter)
SetInternalStateGetter is used to set callback which returnes internal state for /test/internalState request
func (*Server) SetInvokeTimeout ¶
func (*Server) SetSandboxContext ¶
func (s *Server) SetSandboxContext(sbCtx interop.SandboxContext)
SetSandboxContext is used to set the sandbox context after intiialization of interop server. After refactoring all messages, this needs to be removed and made an struct parameter on initialization.