storage

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePath

func CreatePath(ctx context.Context, storageRoot, docUUID string) error

func GetFile

func GetFile(ctx context.Context, storageRoot, docUUID string, imageInfo ImageInfo) (string, string, error)

func HashFile

func HashFile(ctx context.Context, filename string) (string, error)

func ReplaceUrls

func ReplaceUrls(ctx context.Context, content string, imageUrls []ImageInfo) string

func StorageGetFiles

func StorageGetFiles(ctx context.Context, storage NotesStorage, db db.NotesDatabase, note db.Note) error

Types

type ImageInfo

type ImageInfo struct {
	Original    OrignalImage
	Replacement string
}

func GetAllImageUrls

func GetAllImageUrls(ctx context.Context, content string) []ImageInfo

type NotesStorage

type NotesStorage interface {
	GetFiles(ctx context.Context, docUUID string, imageUrls []ImageInfo) ([]ImageInfo, error)
	Cleanup(ctx context.Context, docUUID string) error
	GetObject(ctx context.Context, filename string, expiration int) (string, error)
}
var Storage NotesStorage

type OrignalImage

type OrignalImage struct {
	URL       string
	Extension string
}

type S3MinioStorage

type S3MinioStorage struct {
	BucketName  string
	AppRoot     string
	StorageRoot string
	Client      *minio.Client
}

func NewS3MinioStorage

func NewS3MinioStorage(ctx context.Context) (*S3MinioStorage, error)

func (*S3MinioStorage) Cleanup

func (s *S3MinioStorage) Cleanup(ctx context.Context, docUUID string) error

func (*S3MinioStorage) GetFiles

func (s *S3MinioStorage) GetFiles(ctx context.Context, docUUID string, imageUrls []ImageInfo) ([]ImageInfo, error)

func (*S3MinioStorage) GetObject

func (s *S3MinioStorage) GetObject(ctx context.Context, filename string, expiration int) (string, error)

Jump to

Keyboard shortcuts

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