The package-doc examples showed a fictional launcher.Register / health.Register API (and launcher.Append as a package func). Corrected to the real wiring: lc.Append + web/health.NewHandler(...).ServeHTTP. Documentation-only. No code, API, or dependency changes; version stays v1.1.0 (the v1.1.0 tag is moved to include this fix). Verified by compiling the corrected pattern against the real API. Reviewed-on: #2 Co-authored-by: Rene Nochebuena Guerrero <rene@nochebuena.dev> Co-committed-by: Rene Nochebuena Guerrero <rene@nochebuena.dev>
45 lines
1.8 KiB
Go
45 lines
1.8 KiB
Go
// Package minio provides a MinIO/S3-compatible object storage component with
|
|
// lifecycle management and health check integration.
|
|
//
|
|
// # Lifecycle
|
|
//
|
|
// The component follows the lifecycle.Component contract:
|
|
// - OnInit: initializes the minio-go SDK client from Config.
|
|
// - OnStart: verifies the configured bucket exists; creates it if absent.
|
|
// - OnStop: releases the client reference.
|
|
//
|
|
// Append to a launcher, and wire a health endpoint (mc satisfies
|
|
// [observability.Checkable]):
|
|
//
|
|
// mc := minio.New(logger, cfg)
|
|
// lc.Append(mc) // lifecycle: OnInit → OnStart → OnStop
|
|
// srv.Get("/health", health.NewHandler(logger, mc).ServeHTTP)
|
|
//
|
|
// # Operations
|
|
//
|
|
// Component embeds Provider, which covers the four most common bucket operations.
|
|
// For operations outside that set, use Native() to access the underlying minio-go client:
|
|
//
|
|
// _, err := mc.PutObject(ctx, bucket, key, reader, size, miniogo.PutObjectOptions{})
|
|
// native := mc.Native() // *miniogo.Client
|
|
//
|
|
// # Error Handling
|
|
//
|
|
// All Provider methods translate minio-go errors to core/xerrors types at the boundary.
|
|
// The standalone HandleError function provides the same translation for callers using Native():
|
|
//
|
|
// xerrors.ErrNotFound — NoSuchBucket, NoSuchKey
|
|
// xerrors.ErrPermissionDenied — AccessDenied, InvalidAccessKeyID
|
|
// xerrors.ErrAlreadyExists — BucketAlreadyExists, BucketAlreadyOwnedByYou
|
|
// xerrors.ErrInternal — all other errors
|
|
//
|
|
// # Configuration
|
|
//
|
|
// EINHERJAR_MINIO_ENDPOINT — required; MinIO server address (e.g. "minio:9000")
|
|
// EINHERJAR_MINIO_ACCESS_KEY — required
|
|
// EINHERJAR_MINIO_SECRET_KEY — required
|
|
// EINHERJAR_MINIO_BUCKET — required; bucket checked/created at startup
|
|
// EINHERJAR_MINIO_USE_SSL — optional; default false
|
|
// EINHERJAR_MINIO_REGION — optional; default "us-east-1"
|
|
package minio
|