Documentation
¶
Index ¶
- Variables
- type EntitySource
- type EntitySourceOption
- func WithContext(ctx context.Context) EntitySourceOption
- func WithDisplayName(name string) EntitySourceOption
- func WithDownload(isDownload bool) EntitySourceOption
- func WithExpire(expire *time.Time) EntitySourceOption
- func WithNoInternalProxy() EntitySourceOption
- func WithSpeedLimit(limit int64) EntitySourceOption
- func WithThumb(isThumb bool) EntitySourceOption
- type EntitySourceOptionFunc
- type EntitySourceOptions
- type EntityUrl
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoContentLength is returned by Seek when the initial http response did not include a Content-Length header ErrNoContentLength = errors.New("Content-Length was not set") )
Functions ¶
This section is empty.
Types ¶
type EntitySource ¶
type EntitySource interface { io.ReadSeekCloser io.ReaderAt // Url generates a download url for the entity. Url(ctx context.Context, opts ...EntitySourceOption) (*EntityUrl, error) // Serve serves the entity to the client, with supports on Range header and If- cache control. Serve(w http.ResponseWriter, r *http.Request, opts ...EntitySourceOption) // Entity returns the entity of the source. Entity() fs.Entity // IsLocal returns true if the source is in local machine. IsLocal() bool // LocalPath returns the local path of the source file. LocalPath(ctx context.Context) string // Apply applies the options to the source. Apply(opts ...EntitySourceOption) // CloneToLocalSrc clones the source to a local file source. CloneToLocalSrc(t types.EntityType, src string) (EntitySource, error) // ShouldInternalProxy returns true if the source will/should be proxied by internal proxy. ShouldInternalProxy(opts ...EntitySourceOption) bool }
func NewEntitySource ¶
func NewEntitySource( e fs.Entity, handler driver.Handler, policy *ent.StoragePolicy, generalAuth auth.Auth, settings setting.Provider, hasher hashid.Encoder, c request.Client, l logging.Logger, config conf.ConfigProvider, mime mime.MimeDetector, opts ...EntitySourceOption, ) EntitySource
NewEntitySource creates a new EntitySource.
type EntitySourceOption ¶
type EntitySourceOption interface {
Apply(any)
}
func WithContext ¶
func WithContext(ctx context.Context) EntitySourceOption
WithContext set context for file source
func WithDisplayName ¶
func WithDisplayName(name string) EntitySourceOption
WithDisplayName set display name for file source
func WithDownload ¶
func WithDownload(isDownload bool) EntitySourceOption
WithDownload set file URL as download
func WithExpire ¶
func WithExpire(expire *time.Time) EntitySourceOption
WithExpire set expire time for file source
func WithNoInternalProxy ¶
func WithNoInternalProxy() EntitySourceOption
WithNoInternalProxy overwrite policy's internal proxy setting
func WithSpeedLimit ¶
func WithSpeedLimit(limit int64) EntitySourceOption
WithSpeedLimit set speed limit for file source (if supported)
func WithThumb ¶
func WithThumb(isThumb bool) EntitySourceOption
WithThumb set entity source as thumb. This will result in entity source URL generated with thumbnail processing parameters. For sidecar thumb files, this option will be ignored.
type EntitySourceOptionFunc ¶
type EntitySourceOptionFunc func(any)
func (EntitySourceOptionFunc) Apply ¶
func (f EntitySourceOptionFunc) Apply(option any)
type EntitySourceOptions ¶
Click to show internal directories.
Click to hide internal directories.