44 lines
1.7 KiB
Go
44 lines
1.7 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.
|
||
|
|
//
|
||
|
|
// Register with the launcher and health aggregator before starting:
|
||
|
|
//
|
||
|
|
// mc := minio.New(logger, cfg)
|
||
|
|
// launcher.Register(mc)
|
||
|
|
// health.Register(mc)
|
||
|
|
//
|
||
|
|
// # 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
|