storage

package
v0.0.0-...-7817c22 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close closes storage connections

func GetPresignedURL

func GetPresignedURL(ctx context.Context, objectName string, expires time.Duration) (*url.URL, error)

GetPresignedURL generates a temporary, presigned URL for downloading a file.

func ListObjects

func ListObjects(ctx context.Context) ([]string, error)

ListObjects lists all objects in the bucket for debugging purposes.

func SaveFileMeta

func SaveFileMeta(key string, metadata *FileMetadata) error

func UploadFile

func UploadFile(ctx context.Context, objectName string, reader io.Reader, size int64) (minio.UploadInfo, error)

UploadFile uploads a file to MinIO. objectName is the full path/name of the object in the bucket. reader is the file content stream. size is the total size of the file.

Types

type DragonflyStorage

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

DragonflyStorage implements the Storage interface using Dragonfly/Redis.

type FileMetadata

type FileMetadata struct {
	Filename    string `json:"filename"`
	Size        int64  `json:"size"`
	StoragePath string `json:"storagePath"`
}

FileMetadata defines the structure for storing file information. This is the canonical definition used across the application.

func GetFileMeta

func GetFileMeta(key string) (*FileMetadata, error)

type Storage

type Storage interface {
	// SaveFileMeta saves the file metadata with a given key and TTL.
	SaveFileMeta(key string, metadata *FileMetadata) error

	// GetFileMeta retrieves file metadata by its key.
	GetFileMeta(key string) (*FileMetadata, error)
}

Storage defines the interface for all data storage operations. This allows for decoupling the business logic from the concrete storage implementation.

Jump to

Keyboard shortcuts

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