miniogw

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 29 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrBandwidthLimitExceeded is a custom error for when a user has reached their
	// Satellite bandwidth limit.
	//
	// Note: we went with 403 Forbidden over 509 Bandwidth Limit Exceeded, as 509
	// is not an official status code and rarely used outside of Apache/cPanel.
	// In this case though the user can solve it themselves by getting a
	// limit increase, so it should be treated as a 4xx level error, not 5xx.
	ErrBandwidthLimitExceeded = miniogo.ErrorResponse{
		Code:       "XStorjBandwidthLimitExceeded",
		StatusCode: http.StatusForbidden,
		Message:    "You have reached your Storj project bandwidth limit on the Satellite.",
	}

	// ErrStorageLimitExceeded is a custom error for when a user has reached their
	// Satellite storage limit.
	//
	// Note: we went with 403 Forbidden over 507 Insufficient Storage, as 507
	// doesn't fit this case exactly. 507 is for when the server cannot
	// physically store any further data, e.g. the disk has filled up. In this
	// case though the user can solve this themselves by upgrading their plan,
	// so it should be treated as a 4xx level error, not 5xx.
	ErrStorageLimitExceeded = miniogo.ErrorResponse{
		Code:       "XStorjStorageLimitExceeded",
		StatusCode: http.StatusForbidden,
		Message:    "You have reached your Storj project storage limit on the Satellite.",
	}

	// ErrSegmentsLimitExceeded is a custom error for when a user has reached their
	// Satellite segment limit.
	ErrSegmentsLimitExceeded = miniogo.ErrorResponse{
		Code:       "XStorjSegmentsLimitExceeded",
		StatusCode: http.StatusForbidden,
		Message:    "You have reached your Storj project segment limit on the Satellite.",
	}

	// ErrSlowDown is a custom error for when a user is exceeding Satellite
	// request rate limits. We don't use the built-in `minio.SlowDown{}` error
	// because minio doesn't expect this error would be returned by the object
	// API. e.g. it would map errors like `minio.InsufficientWriteQuorum` to
	// `minio.SlowDown`, but not SlowDown to itself.
	ErrSlowDown = miniogo.ErrorResponse{
		Code:       "SlowDown",
		StatusCode: http.StatusTooManyRequests,
		Message:    "Please reduce your request rate.",
	}

	// ErrNoUplinkProject is a custom error that indicates there was no
	// `*uplink.Project` in the context for the gateway to pick up. This error
	// may signal that passing credentials down to the object layer is working
	// incorrectly.
	ErrNoUplinkProject = errs.Class("uplink project")

	// ErrTooManyItemsToList indicates that ListObjects/ListObjectsV2 failed
	// because of too many items to list for gateway-side filtering using an
	// arbitrary delimiter and/or prefix.
	ErrTooManyItemsToList = minio.NotImplemented{
		Message: "ListObjects(V2): listing too many items for gateway-side filtering using arbitrary delimiter/prefix",
	}
)

Functions

func GetUplinkProject added in v1.3.0

func GetUplinkProject(ctx context.Context) (*uplink.Project, bool)

GetUplinkProject retrieves libuplink's *Project from ctx and reports whether it was successful.

func NewSingleTenantGateway added in v1.3.0

func NewSingleTenantGateway(log *zap.Logger, access *uplink.Access, config uplink.Config, gateway minio.Gateway, website bool) minio.Gateway

NewSingleTenantGateway returns a wrapper of minio.Gateway that logs responses and makes gateway single-tenant.

func WithUplinkProject added in v1.3.0

func WithUplinkProject(ctx context.Context, project *uplink.Project) context.Context

WithUplinkProject injects project into ctx under a specific key. Use GetUplinkProject to retrieve project from ctx.

Types

type Gateway

type Gateway struct {
	// contains filtered or unexported fields
}

Gateway is the implementation of cmd.Gateway.

func NewStorjGateway

func NewStorjGateway(compatibilityConfig S3CompatibilityConfig) *Gateway

NewStorjGateway creates a new Storj S3 gateway.

func (*Gateway) Name

func (gateway *Gateway) Name() string

Name implements cmd.Gateway.

func (*Gateway) NewGatewayLayer

func (gateway *Gateway) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, error)

NewGatewayLayer implements cmd.Gateway.

func (*Gateway) Production

func (gateway *Gateway) Production() bool

Production implements cmd.Gateway.

type MinioConfig

type MinioConfig struct {
	AccessKey string `help:"Minio Access Key to use" default:"insecure-dev-access-key" basic-help:"true"`
	SecretKey string `help:"Minio Secret Key to use" default:"insecure-dev-secret-key" basic-help:"true"`
	Dir       string `help:"Minio generic server config path" default:"$CONFDIR/minio"`
}

MinioConfig is a configuration struct that keeps details about starting Minio.

type S3CompatibilityConfig added in v1.3.0

type S3CompatibilityConfig struct {
	IncludeCustomMetadataListing bool  `help:"include custom metadata in S3's ListObjects, ListObjectsV2 and ListMultipartUploads responses" default:"true"`
	MaxKeysLimit                 int   `help:"MaxKeys parameter limit for S3's ListObjects and ListObjectsV2 responses" default:"1000"`
	MaxKeysExhaustiveLimit       int   `help:"maximum number of items to list for gateway-side filtering using arbitrary delimiter/prefix" default:"100000"`
	FullyCompatibleListing       bool  `` /* 136-byte string literal not displayed */
	DisableCopyObject            bool  `help:"return 501 (Not Implemented) for CopyObject calls" default:"false"`
	MinPartSize                  int64 `help:"minimum part size for multipart uploads" default:"5242880"` // 5 MiB
}

S3CompatibilityConfig is a configuration struct that determines details about how strict the gateway should be S3-compatible.

type ServerConfig

type ServerConfig struct {
	Address string `help:"address to serve S3 api over" default:"127.0.0.1:7777" basic-help:"true"`
}

ServerConfig determines how minio listens for requests.

Jump to

Keyboard shortcuts

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