asset

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileGetter added in v1.6.2

type FileGetter interface {
	GetFileReader(name string) (io.ReadCloser, error)
}

FileGetter defines the interface of a getter for files

type FilePostRequestGenerator added in v1.6.2

type FilePostRequestGenerator interface {
	GeneratePostFileRequest(
		name string,
		contentType string,
		length int64,
	) (*PostFileRequest, error)
}

FilePostRequestGenerator defines the interface of a generator for post file request

type FilePutter added in v1.6.2

type FilePutter interface {
	PutFileReader(
		name string,
		src io.Reader,
		length int64,
		contentType string,
	) error
}

FilePutter defines the interface of a putter for files

type FileRange added in v1.6.2

type FileRange struct {
	From int64
	To   int64
}

FileRange models a byte range of a file

type FileRangeNotAcceptedError added in v1.6.2

type FileRangeNotAcceptedError struct {
	Range FileRange
}

FileRangeNotAcceptedError defines the range not accepted error

func (FileRangeNotAcceptedError) Error added in v1.6.2

type FileRangedGetResult added in v1.6.2

type FileRangedGetResult struct {
	ReadCloser    io.ReadCloser
	AcceptedRange FileRange
	TotalSize     int64
}

FileRangedGetResult models the result of getting a ranged file

type FileRangedGetter added in v1.6.2

type FileRangedGetter interface {
	GetRangedFileReader(
		name string,
		fileRange FileRange,
	) (*FileRangedGetResult, error)
}

FileRangedGetter defines the interface of a getter for files supportting getting file within a byte range

type PostFileRequest

type PostFileRequest struct {
	Action      string                 `json:"action"`
	ExtraFields map[string]interface{} `json:"extra-fields,omitempty"`
}

PostFileRequest models the POST request for upload asset file

type SignatureParser

type SignatureParser interface {
	ParseSignature(signed string, name string, expiredAt time.Time) (valid bool, err error)
}

SignatureParser parses a signed signature string

type Store

Store specify the interfaces of an asset store

func NewCloudStore

func NewCloudStore(
	appName string,
	host string,
	authToken string,
	publicURLPrefix string,
	privateURLPrefix string,
	public bool,
) (Store, error)

NewCloudStore creates a new cloud asset store

func NewFileStore

func NewFileStore(dir, prefix, secret string, public bool) Store

NewFileStore creates a new fileStore

func NewS3Store

func NewS3Store(
	accessKey string,
	secretKey string,
	regionName string,
	bucketName string,
	urlPrefix string,
	public bool,
) (Store, error)

NewS3Store returns a new s3Store

type URLSigner

type URLSigner interface {
	// SignedURL returns a url with access to the named file. If asset
	// store is private, the returned URL is a signed one, allowing access
	// to asset for a short period.
	SignedURL(name string) (string, error)
	IsSignatureRequired() bool
}

URLSigner signs a signature and returns a URL accessible to that asset.

type URLSignerStore added in v1.6.0

type URLSignerStore interface {
	Store
	URLSigner
}

URLSignerStore is an interface that is a union of Store and URLSigner.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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