filesystem

package
v0.0.0-...-fb5fdcc Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_component_filesystem_filesystem_proto protoreflect.FileDescriptor

Functions

func FromMultiResult

func FromMultiResult(r Result) multiResults

func IsMultiResult

func IsMultiResult(r Result) bool

func RegisterTarget

func RegisterTarget(target Target)

RegisterTarget registers the provided Target for use with all Transport clients and servers.

Types

type Config

type Config struct {
	Default string                      `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"`
	Disks   map[string]*structpb.Struct `` /* 151-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetDefault

func (x *Config) GetDefault() string

func (*Config) GetDisks

func (x *Config) GetDisks() map[string]*structpb.Struct

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type Disk

type Disk interface {
	Exists(key string, options ...HandleFunc) bool
	Upload(filename, key string, options ...HandleFunc) (Result, error)
	Url(key string, options ...HandleFunc) string
	Delete(key string, options ...HandleFunc) error
}

func NewMultiDisks

func NewMultiDisks(disks map[string]Disk) Disk

type FileSystem

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

func New

func New(config *Config, p *proxy.Client) *FileSystem

func (*FileSystem) Delete

func (f *FileSystem) Delete(key string, options ...HandleFunc) error

func (*FileSystem) Download

func (f *FileSystem) Download(ctx context.Context, downloadUrl, filename string) error

func (*FileSystem) Exists

func (f *FileSystem) Exists(filename string, options ...HandleFunc) bool

func (*FileSystem) Setup

func (f *FileSystem) Setup() (err error)

func (*FileSystem) Upload

func (f *FileSystem) Upload(filename string, key string, options ...HandleFunc) (Result, error)

func (*FileSystem) Url

func (f *FileSystem) Url(key string, options ...HandleFunc) string

func (*FileSystem) Use

func (f *FileSystem) Use(name string) Disk

type HandleFunc

type HandleFunc func(Option)

func IsExist

func IsExist(exists bool) HandleFunc

func WithContext

func WithContext(ctx context.Context) HandleFunc

type LocalDisk

type LocalDisk struct {
	Enable   bool   `json:"enable,omitempty"`
	Root     string `json:"root,omitempty"`
	Domain   string `json:"domain,omitempty"`
	BasePath string `json:"basePath,omitempty"`
}

func (LocalDisk) Delete

func (l LocalDisk) Delete(key string, options ...HandleFunc) error

func (LocalDisk) Exists

func (l LocalDisk) Exists(key string, options ...HandleFunc) bool

func (LocalDisk) Fullname

func (l LocalDisk) Fullname(key string) string

func (LocalDisk) IsEnable

func (l LocalDisk) IsEnable() bool

func (LocalDisk) Upload

func (l LocalDisk) Upload(filename, key string, options ...HandleFunc) (Result, error)

func (LocalDisk) Url

func (l LocalDisk) Url(key string, options ...HandleFunc) string

type LocalResult

type LocalResult string

func (LocalResult) Name

func (l LocalResult) Name() string

func (LocalResult) Raw

func (l LocalResult) Raw() any

type Option

type Option interface {
}

type Result

type Result interface {
	Name() string
	Raw() any
}

type Target

type Target interface {
	Name() string
	Register(map[string]interface{}) (Disk, error)
}

func GetTarget

func GetTarget(contentSubtype string) Target

GetTarget gets a registered Target by content-subtype, or nil if no Target is registered for the content-subtype.

The content-subtype is expected to be lowercase.

Jump to

Keyboard shortcuts

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