blob

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 17 Imported by: 4 modules, 8 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

View Source
var File_blob_blob_proto protoreflect.FileDescriptor
View Source
var ProviderSet = wire.NewSet(NewFactory)

Functions

func NewAfs

func NewAfs(fs afero.Fs) *afero.Afero

func PatchOpt

func PatchOpt(cfg BlobConfig, fs afero.Fs) afero.Fs

func Register

func Register(name string, f func(cfg BlobConfig) Blob)

Types

type Blob

type Blob interface {
	GetAfero() *afero.Afero
	GeneratePreSignedURL(name string, expire time.Duration) (string, error)
	GeneratePublicUrl(name string) (string, error)
	GenerateInternalUrl(name string) (string, error)
}

type BlobConfig

type BlobConfig struct {
	Provider    string          `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"`
	BasePath    string          `protobuf:"bytes,2,opt,name=base_path,json=basePath,proto3" json:"base_path,omitempty"`
	ReadOnly    bool            `protobuf:"varint,3,opt,name=read_only,json=readOnly,proto3" json:"read_only,omitempty"`
	RegexFilter string          `protobuf:"bytes,4,opt,name=regex_filter,json=regexFilter,proto3" json:"regex_filter,omitempty"`
	PublicUrl   string          `protobuf:"bytes,5,opt,name=public_url,json=publicUrl,proto3" json:"public_url,omitempty"`
	InternalUrl string          `protobuf:"bytes,6,opt,name=internal_url,json=internalUrl,proto3" json:"internal_url,omitempty"`
	S3          *BlobProviderS3 `protobuf:"bytes,100,opt,name=s3,proto3" json:"s3,omitempty"`
	Os          *BlobProviderOs `protobuf:"bytes,101,opt,name=os,proto3" json:"os,omitempty"`
	// contains filtered or unexported fields
}

func (*BlobConfig) Descriptor deprecated

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

Deprecated: Use BlobConfig.ProtoReflect.Descriptor instead.

func (*BlobConfig) GetBasePath

func (x *BlobConfig) GetBasePath() string

func (*BlobConfig) GetInternalUrl

func (x *BlobConfig) GetInternalUrl() string

func (*BlobConfig) GetOs

func (x *BlobConfig) GetOs() *BlobProviderOs

func (*BlobConfig) GetProvider

func (x *BlobConfig) GetProvider() string

func (*BlobConfig) GetPublicUrl

func (x *BlobConfig) GetPublicUrl() string

func (*BlobConfig) GetReadOnly

func (x *BlobConfig) GetReadOnly() bool

func (*BlobConfig) GetRegexFilter

func (x *BlobConfig) GetRegexFilter() string

func (*BlobConfig) GetS3

func (x *BlobConfig) GetS3() *BlobProviderS3

func (*BlobConfig) ProtoMessage

func (*BlobConfig) ProtoMessage()

func (*BlobConfig) ProtoReflect

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

func (*BlobConfig) Reset

func (x *BlobConfig) Reset()

func (*BlobConfig) String

func (x *BlobConfig) String() string

type BlobFile

type BlobFile struct {
	Id       string           `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name     string           `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Mime     string           `protobuf:"bytes,3,opt,name=mime,proto3" json:"mime,omitempty"`
	Size     int64            `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"`
	Url      string           `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
	Metadata *structpb.Struct `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"`
	// contains filtered or unexported fields
}

func (*BlobFile) Descriptor deprecated

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

Deprecated: Use BlobFile.ProtoReflect.Descriptor instead.

func (*BlobFile) GetId

func (x *BlobFile) GetId() string

func (*BlobFile) GetMetadata

func (x *BlobFile) GetMetadata() *structpb.Struct

func (*BlobFile) GetMime

func (x *BlobFile) GetMime() string

func (*BlobFile) GetName

func (x *BlobFile) GetName() string

func (*BlobFile) GetSize

func (x *BlobFile) GetSize() int64

func (*BlobFile) GetUrl

func (x *BlobFile) GetUrl() string

func (*BlobFile) ProtoMessage

func (*BlobFile) ProtoMessage()

func (*BlobFile) ProtoReflect

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

func (*BlobFile) Reset

func (x *BlobFile) Reset()

func (*BlobFile) String

func (x *BlobFile) String() string

type BlobProviderOs

type BlobProviderOs struct {
	Dir *wrapperspb.StringValue `protobuf:"bytes,1,opt,name=dir,proto3,oneof" json:"dir,omitempty"`
	// contains filtered or unexported fields
}

func (*BlobProviderOs) Descriptor deprecated

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

Deprecated: Use BlobProviderOs.ProtoReflect.Descriptor instead.

func (*BlobProviderOs) GetDir

func (x *BlobProviderOs) GetDir() *wrapperspb.StringValue

func (*BlobProviderOs) ProtoMessage

func (*BlobProviderOs) ProtoMessage()

func (*BlobProviderOs) ProtoReflect

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

func (*BlobProviderOs) Reset

func (x *BlobProviderOs) Reset()

func (*BlobProviderOs) String

func (x *BlobProviderOs) String() string

type BlobProviderS3

type BlobProviderS3 struct {
	Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"`
	Key    string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	Secret string `protobuf:"bytes,3,opt,name=secret,proto3" json:"secret,omitempty"`
	Bucket string `protobuf:"bytes,4,opt,name=bucket,proto3" json:"bucket,omitempty"`
	// contains filtered or unexported fields
}

func (*BlobProviderS3) Descriptor deprecated

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

Deprecated: Use BlobProviderS3.ProtoReflect.Descriptor instead.

func (*BlobProviderS3) GetBucket

func (x *BlobProviderS3) GetBucket() string

func (*BlobProviderS3) GetKey

func (x *BlobProviderS3) GetKey() string

func (*BlobProviderS3) GetRegion

func (x *BlobProviderS3) GetRegion() string

func (*BlobProviderS3) GetSecret

func (x *BlobProviderS3) GetSecret() string

func (*BlobProviderS3) ProtoMessage

func (*BlobProviderS3) ProtoMessage()

func (*BlobProviderS3) ProtoReflect

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

func (*BlobProviderS3) Reset

func (x *BlobProviderS3) Reset()

func (*BlobProviderS3) String

func (x *BlobProviderS3) String() string

type Config

type Config map[string]*BlobConfig

type Factory

type Factory interface {
	Get(ctx context.Context, name string, tenancy bool) Blob
}

func NewFactory

func NewFactory(cfg Config) Factory

type FactoryImpl

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

func (*FactoryImpl) Get

func (f *FactoryImpl) Get(ctx context.Context, name string, tenancy bool) Blob

type FileBlob

type FileBlob struct {
	*afero.Afero
	BasePath  string
	PublicUrl string
}

func NewFileBlob

func NewFileBlob(a *afero.Afero, basePath, publicUrl string) *FileBlob

func (*FileBlob) GenerateInternalUrl

func (f *FileBlob) GenerateInternalUrl(name string) (string, error)

func (*FileBlob) GeneratePreSignedURL

func (f *FileBlob) GeneratePreSignedURL(name string, expire time.Duration) (string, error)

func (*FileBlob) GeneratePublicUrl

func (f *FileBlob) GeneratePublicUrl(name string) (string, error)

func (*FileBlob) GetAfero

func (f *FileBlob) GetAfero() *afero.Afero

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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