lambda

command
v0.0.0-...-0fd1977 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package main shows the recommended pattern for using s3db from AWS Lambda.

Key points:

  • The *s3db.DB is a package-level variable, opened once in init() and reused across warm invocations. The local SQLite file under /tmp survives between warm starts, so subsequent invocations only fetch the manifest + any new changesets — not the full snapshot.

  • Business logic that shouldn't retry (sending emails, calling external APIs) runs OUTSIDE the Update closure. The closure itself only does database work, since it may be re-invoked on rebase conflict.

  • Compaction and GC are handled by a separate scheduled Lambda (not shown here) triggered on a cron — they're too slow to run inline with user requests. Alternatively, use WithAutoCompact for light workloads.

Build for Lambda (pure Go, no CGo toolchain needed):

GOOS=linux GOARCH=amd64 go build -o bootstrap ./examples/lambda
zip lambda.zip bootstrap

Jump to

Keyboard shortcuts

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