handler

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAccessDenied is returned from FrostFS in case of access violation.
	ErrAccessDenied = errors.New("access denied")
	// ErrGatewayTimeout is returned from FrostFS in case of timeout, deadline exceeded etc.
	ErrGatewayTimeout = errors.New("gateway timeout")
)

Functions

This section is empty.

Types

type AppParams added in v0.30.0

type AppParams struct {
	Logger   *zap.Logger
	FrostFS  FrostFS
	Owner    *user.ID
	Resolver ContainerResolver
	Cache    *cache.BucketCache
}

type BrowsePageData added in v0.31.0

type BrowsePageData struct {
	HasErrors bool
	Container string
	Prefix    string
	Protocol  string
	Objects   []ResponseObject
}

type Config added in v0.29.0

type Config interface {
	DefaultTimestamp() bool
	ZipCompression() bool
	ClientCut() bool
	IndexPageEnabled() bool
	IndexPageTemplate() string
	BufferMaxSizeForPut() uint64
	NamespaceHeader() string
	EnableFilepathFallback() bool
}

type ContainerResolver added in v0.30.0

type ContainerResolver interface {
	Resolve(ctx context.Context, name string) (*cid.ID, error)
}

type FrostFS added in v0.30.0

FrostFS represents virtual connection to FrostFS network.

type GetObjectsResponse added in v0.31.0

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

type Handler

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

func New

func New(params *AppParams, config Config, tree layer.TreeService, workerPool *ants.Pool) *Handler

func (*Handler) DownloadByAddressOrBucketName

func (h *Handler) DownloadByAddressOrBucketName(c *fasthttp.RequestCtx)

DownloadByAddressOrBucketName handles download requests using simple cid/oid or bucketname/key format.

func (*Handler) DownloadByAttribute

func (h *Handler) DownloadByAttribute(c *fasthttp.RequestCtx)

DownloadByAttribute handles attribute-based download requests.

func (*Handler) DownloadZipped

func (h *Handler) DownloadZipped(c *fasthttp.RequestCtx)

DownloadZipped handles zip by prefix requests.

func (*Handler) HeadByAddressOrBucketName

func (h *Handler) HeadByAddressOrBucketName(c *fasthttp.RequestCtx)

HeadByAddressOrBucketName handles head requests using simple cid/oid or bucketname/key format.

func (*Handler) HeadByAttribute

func (h *Handler) HeadByAttribute(c *fasthttp.RequestCtx)

HeadByAttribute handles attribute-based head requests.

func (*Handler) Upload

func (h *Handler) Upload(c *fasthttp.RequestCtx)

Upload handles multipart upload request.

type MultipartFile

type MultipartFile interface {
	io.ReadCloser
	FileName() string
}

MultipartFile provides standard ReadCloser interface and also allows one to get file name, it's used for multipart uploads.

type Object added in v0.30.3

type Object struct {
	// Object header (doesn't contain payload).
	Header object.Object

	// Object payload part encapsulated in io.Reader primitive.
	// Returns ErrAccessDenied on read access violation.
	Payload io.ReadCloser
}

Object represents FrostFS object.

type PrmAuth added in v0.30.0

type PrmAuth struct {
	// Bearer token to be used for the operation. Overlaps PrivateKey. Optional.
	BearerToken *bearer.Token
}

PrmAuth groups authentication parameters for the FrostFS operation.

type PrmContainer added in v0.30.0

type PrmContainer struct {
	// Container identifier.
	ContainerID cid.ID
}

PrmContainer groups parameters of FrostFS.Container operation.

type PrmInitMultiObjectReader added in v0.30.3

type PrmInitMultiObjectReader struct {
	// payload range
	Off, Ln uint64

	Addr   oid.Address
	Bearer *bearer.Token
}

type PrmObjectCreate added in v0.30.0

type PrmObjectCreate struct {
	// Authentication parameters.
	PrmAuth

	Object *object.Object

	// Object payload encapsulated in io.Reader primitive.
	Payload io.Reader

	// Enables client side object preparing.
	ClientCut bool

	// Disables using Tillich-Zémor hash for payload.
	WithoutHomomorphicHash bool

	// Sets max buffer size to read payload.
	BufferMaxSize uint64
}

PrmObjectCreate groups parameters of FrostFS.CreateObject operation.

type PrmObjectGet added in v0.30.3

type PrmObjectGet struct {
	// Authentication parameters.
	PrmAuth

	// Address to read the object header from.
	Address oid.Address
}

PrmObjectGet groups parameters of FrostFS.GetObject operation.

type PrmObjectHead added in v0.30.3

type PrmObjectHead struct {
	// Authentication parameters.
	PrmAuth

	// Address to read the object header from.
	Address oid.Address
}

PrmObjectHead groups parameters of FrostFS.HeadObject operation.

type PrmObjectRange added in v0.30.3

type PrmObjectRange struct {
	// Authentication parameters.
	PrmAuth

	// Address to read the object header from.
	Address oid.Address

	// Offset-length range of the object payload to be read.
	PayloadRange [2]uint64
}

PrmObjectRange groups parameters of FrostFS.RangeObject operation.

type PrmObjectSearch added in v0.30.0

type PrmObjectSearch struct {
	// Authentication parameters.
	PrmAuth

	// Container to select the objects from.
	Container cid.ID

	Filters object.SearchFilters
}

PrmObjectSearch groups parameters of FrostFS.sear SearchObjects operation.

type ResObjectSearch added in v0.30.0

type ResObjectSearch interface {
	Read(buf []oid.ID) (int, error)
	Iterate(f func(oid.ID) bool) error
	Close()
}

type ResponseObject added in v0.31.0

type ResponseObject struct {
	OID            string
	Created        string
	FileName       string
	FilePath       string
	Size           string
	IsDir          bool
	GetURL         string
	IsDeleteMarker bool
}

type ResponseObjectExtended added in v0.31.0

type ResponseObjectExtended struct {
	Object ResponseObject
	Error  error
}

type TestFrostFS added in v0.30.0

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

func NewTestFrostFS added in v0.30.0

func NewTestFrostFS(key *keys.PrivateKey) *TestFrostFS

func (*TestFrostFS) AllowUserOperation added in v0.30.0

func (t *TestFrostFS) AllowUserOperation(cnrID cid.ID, userID user.ID, op acl.Op, objID oid.ID)

AllowUserOperation grants access to object operations. Empty userID and objID means any user and object respectively.

func (*TestFrostFS) Container added in v0.30.0

func (t *TestFrostFS) Container(_ context.Context, prm PrmContainer) (*container.Container, error)

func (*TestFrostFS) ContainerID added in v0.30.0

func (t *TestFrostFS) ContainerID(name string) (*cid.ID, error)

func (*TestFrostFS) CreateObject added in v0.30.0

func (t *TestFrostFS) CreateObject(_ context.Context, prm PrmObjectCreate) (oid.ID, error)

func (*TestFrostFS) GetEpochDurations added in v0.30.0

func (t *TestFrostFS) GetEpochDurations(context.Context) (*utils.EpochDurations, error)

func (*TestFrostFS) GetObject added in v0.30.3

func (t *TestFrostFS) GetObject(_ context.Context, prm PrmObjectGet) (*Object, error)

func (*TestFrostFS) HeadObject added in v0.30.3

func (t *TestFrostFS) HeadObject(_ context.Context, prm PrmObjectHead) (*object.Object, error)

func (*TestFrostFS) InitMultiObjectReader added in v0.30.3

func (t *TestFrostFS) InitMultiObjectReader(context.Context, PrmInitMultiObjectReader) (io.Reader, error)

func (*TestFrostFS) RangeObject added in v0.30.3

func (t *TestFrostFS) RangeObject(_ context.Context, prm PrmObjectRange) (io.ReadCloser, error)

func (*TestFrostFS) SearchObjects added in v0.30.0

func (t *TestFrostFS) SearchObjects(_ context.Context, prm PrmObjectSearch) (ResObjectSearch, error)

func (*TestFrostFS) SetContainer added in v0.30.0

func (t *TestFrostFS) SetContainer(cnrID cid.ID, cnr *container.Container)

Directories

Path Synopsis
Package multipart implements MIME multipart parsing, as defined in RFC 2046.
Package multipart implements MIME multipart parsing, as defined in RFC 2046.

Jump to

Keyboard shortcuts

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