upload

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resumable

type Resumable struct {
	ChunkNumber      int    `schema:"resumableChunkNumber"`
	ChunkSize        int    `schema:"resumableChunkSize"`
	CurrentChunkSize int    `schema:"resumableCurrentChunkSize"`
	TotalSize        int    `schema:"resumableTotalSize"`
	Type             string `schema:"resumableType"`
	Identifier       string `schema:"resumableIdentifier"`
	FileName         string `schema:"resumableFilename"`
	RelativePath     string `schema:"resumableRelativePath"`
	TotalChunks      int    `schema:"resumableTotalChunks"`
	AliasName        string `schema:"aliasName"`
}

Resumable represents resumable js upload query pararmeters

type S3Client

type S3Client interface {
	UploadPart(ctx context.Context, req *s3client.UploadPartRequest, payload []byte) error
	UploadPartWithPsk(ctx context.Context, req *s3client.UploadPartRequest, payload []byte, psk []byte) error
	CheckPartUploaded(ctx context.Context, req *s3client.UploadPartRequest) (bool, error)
	Checker(ctx context.Context, state *healthcheck.CheckState) error
}

S3Client is an interface to represent methods called to action upon S3 (implemented by dp-s3)

type Uploader

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

Uploader represents the necessary configuration for uploading a file

func New

func New(s3 S3Client, vc VaultClient, vaultPath, s3Region, s3Bucket string) *Uploader

New returns a new Uploader from the provided clients and vault path

func (*Uploader) CheckUploaded

func (u *Uploader) CheckUploaded(w http.ResponseWriter, req *http.Request)

CheckUploaded checks to see if a chunk has been uploaded

func (*Uploader) GetS3URL

func (u *Uploader) GetS3URL(w http.ResponseWriter, req *http.Request)

GetS3URL returns an S3 URL for a requested path, and the client's region and bucket name. Path corresponds to the S3 object key

func (*Uploader) Upload

func (u *Uploader) Upload(w http.ResponseWriter, req *http.Request)

Upload handles the uploading of a file to AWS s3

type VaultClient

type VaultClient interface {
	ReadKey(path, key string) (string, error)
	WriteKey(path, key, value string) error
	Checker(ctx context.Context, state *healthcheck.CheckState) error
}

VaultClient is an interface to represent methods called to action upon vault (implemented by dp-vault)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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