driver

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package driver defines the interface for serverless function service implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionConfig

type FunctionConfig struct {
	Name        string
	Runtime     string
	Handler     string
	Memory      int // MB
	Timeout     int // seconds
	Environment map[string]string
	Tags        map[string]string
}

FunctionConfig describes a serverless function to create.

type FunctionInfo

type FunctionInfo struct {
	Name         string
	ARN          string
	Runtime      string
	Handler      string
	Memory       int
	Timeout      int
	State        string
	Environment  map[string]string
	Tags         map[string]string
	LastModified string
}

FunctionInfo describes a serverless function.

type HandlerFunc

type HandlerFunc func(ctx context.Context, payload []byte) ([]byte, error)

HandlerFunc is a function handler that processes invocations.

type InvokeInput

type InvokeInput struct {
	FunctionName string
	Payload      []byte
	InvokeType   string // "RequestResponse" or "Event"
}

InvokeInput configures a function invocation.

type InvokeOutput

type InvokeOutput struct {
	StatusCode int
	Payload    []byte
	Error      string
}

InvokeOutput is the result of a function invocation.

type Serverless

type Serverless interface {
	CreateFunction(ctx context.Context, config FunctionConfig) (*FunctionInfo, error)
	DeleteFunction(ctx context.Context, name string) error
	GetFunction(ctx context.Context, name string) (*FunctionInfo, error)
	ListFunctions(ctx context.Context) ([]FunctionInfo, error)
	UpdateFunction(ctx context.Context, name string, config FunctionConfig) (*FunctionInfo, error)
	Invoke(ctx context.Context, input InvokeInput) (*InvokeOutput, error)
	RegisterHandler(name string, handler HandlerFunc)
}

Serverless is the interface that serverless provider implementations must satisfy.

Jump to

Keyboard shortcuts

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