Documentation
¶
Overview ¶
Package lambda is doze-aws's local AWS Lambda: functions run as supervised local processes speaking the Lambda Runtime API (no Docker). It implements the control plane (create/update/get/list/delete, versions, aliases, concurrency, DLQ/destinations, tags), synchronous and async Invoke, function URLs, and SQS event source mappings that poll a queue and deliver batches.
Code packaging: ZipFile (unpacked to the data dir) and a doze extension where Code.S3Bucket == "_local_" and Code.S3Key is an absolute path to a directory or binary used in place (edit-and-reinvoke, no copy).
Runtime = a per-function concurrency pool of supervised processes that grows with demand (capped) and scales back to zero after an idle window, so an unused function holds no processes. See docs/api-support/lambda.md.
Index ¶
- type EventSourceMapping
- type Function
- type Options
- type Server
- type Store
- func (s *Store) DeleteFunction(name string) error
- func (s *Store) DeleteMapping(uuid string) error
- func (s *Store) GetFunction(name string) (*Function, error)
- func (s *Store) GetMapping(uuid string) (*EventSourceMapping, error)
- func (s *Store) ListFunctions() ([]Function, error)
- func (s *Store) ListMappings() ([]EventSourceMapping, error)
- func (s *Store) PutFunction(f *Function) error
- func (s *Store) PutMapping(m *EventSourceMapping) error
- func (s *Store) Update(name string, fn func(*Function) error) (*Function, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventSourceMapping ¶
type EventSourceMapping struct {
UUID string `json:"uuid"`
FunctionName string `json:"function_name"`
EventSourceArn string `json:"event_source_arn"`
BatchSize int `json:"batch_size"`
Enabled bool `json:"enabled"`
State string `json:"state"` // Enabled | Disabled
}
EventSourceMapping is one SQS→function poller definition.
type Function ¶
type Function struct {
Name string `json:"name"`
Runtime string `json:"runtime"`
Handler string `json:"handler"`
Role string `json:"role,omitempty"`
Description string `json:"description,omitempty"`
Timeout int `json:"timeout"` // seconds
MemorySize int `json:"memory_size"`
Env map[string]string `json:"env,omitempty"`
Command []string `json:"command,omitempty"` // doze extension
// Code location: either an unpacked dir under the data dir, or an
// in-place absolute path (the _local_ bucket convention).
CodeDir string `json:"code_dir"`
CodeSHA256 string `json:"code_sha256,omitempty"`
Version string `json:"version"` // "$LATEST" or a published number
DeadLetterArn string `json:"dead_letter_arn,omitempty"`
Destinations json.RawMessage `json:"destinations,omitempty"` // DestinationConfig round-trip
ReservedConcurrency *int `json:"reserved_concurrency,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Layers []string `json:"layers,omitempty"`
// EventInvokeConfig (async): set via PutFunctionEventInvokeConfig; the
// presence of any of these means an event-invoke config exists.
MaxRetryAttempts *int `json:"max_retry_attempts,omitempty"`
MaxEventAgeSeconds *int `json:"max_event_age_seconds,omitempty"`
HasEventInvokeCfg bool `json:"has_event_invoke_cfg,omitempty"`
Aliases map[string]string `json:"aliases,omitempty"` // alias -> version
LastMod int64 `json:"last_mod"`
Revision string `json:"revision"`
FunctionURL string `json:"function_url,omitempty"` // when a URL config exists
}
Function is a stored function definition.
type Options ¶
type Options struct {
// DataDir holds the store, unpacked code, and logs. Required.
DataDir string
// Peers resolves sibling services: injected as AWS_ENDPOINT_URL_* into
// function processes, and used by event source mappings to poll SQS.
Peers peers.Directory
// Endpoint is the shared gateway URL handlers reach siblings through
// (AWS_ENDPOINT_URL). Empty derives per-service from Peers where possible.
Endpoint string
// Logf receives log lines; nil discards.
Logf func(format string, args ...any)
// Clock overrides time.Now in tests.
Clock func() time.Time
// IdleTimeout is how long a warm function keeps its process(es) before
// scaling to zero. Zero uses lambdaruntime.DefaultIdleTimeout.
IdleTimeout time.Duration
}
Options configures the service.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the Lambda service.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the bbolt-backed Lambda control-plane state.
func (*Store) DeleteFunction ¶
DeleteFunction removes a function.
func (*Store) DeleteMapping ¶
func (*Store) GetFunction ¶
GetFunction loads a function by name.
func (*Store) GetMapping ¶
func (s *Store) GetMapping(uuid string) (*EventSourceMapping, error)
func (*Store) ListFunctions ¶
ListFunctions returns all functions, sorted by name.
func (*Store) ListMappings ¶
func (s *Store) ListMappings() ([]EventSourceMapping, error)
func (*Store) PutFunction ¶
PutFunction stores a function.
func (*Store) PutMapping ¶
func (s *Store) PutMapping(m *EventSourceMapping) error