type

StorageFactory

A lazy, lifecycle-owned object-storage constructor.

Source ridu.go:122

ctxcontext.Context
The server lifecycle context, cancelled during shutdown.

Returns (storage.Backend, error) One opened backend owned by Execute, or a startup error.

This is runtime infrastructure, not a plugin. Execute closes closable storage before the document store.

Use this runtime factory with WithUploadStorage. It keeps storage credentials out of the serializable config and schema manifest.

Execute closes a backend implementing Close() or Close() error before it closes the document store.

Example

go
func openStorage(context.Context) (storage.Backend, error) {
  return s3.New(s3.Config{
    Region: os.Getenv("S3_REGION"),
    Bucket: os.Getenv("S3_BUCKET"),
  })
}