manager

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExecCommand = exec.Command

ExecCommand is exec.Command by default, but can be overridden in tests.

Functions

func AppendYearStorage added in v1.6.0

func AppendYearStorage(ctx context.Context, noYearKey string, userID uuid.UUID) (string, error)

AppendYearStorage renames a file in storage to append the current year

func CleanupOld

func CleanupOld(prefix, rmDir string, retentionDays int, user *database.User) error

func CreateUserTempDir added in v1.6.0

func CreateUserTempDir(userID uuid.UUID) (string, error)

CreateUserTempDir creates a temporary directory for user-specific operations Uses Go's native temp directory handling with user isolation

func CreateUserTempFile added in v1.6.0

func CreateUserTempFile(userID uuid.UUID, pattern string) (string, error)

CreateUserTempFile creates a temporary file for user-specific operations Uses Go's native temp file handling with user isolation

func DefaultRmDir

func DefaultRmDir() string

func FoldersHandler added in v1.0.0

func FoldersHandler(c *gin.Context)

FoldersHandler writes a JSON {"folders": ["/path", ...]}.

func InitializeUserFolderCache added in v1.4.0

func InitializeUserFolderCache(db *gorm.DB)

InitializeUserFolderCache initializes the user folder cache service

func IsSingleUserPaired added in v1.4.0

func IsSingleUserPaired() bool

IsSingleUserPaired checks if rmapi.conf exists for single-user mode

func ListFolders added in v1.0.0

func ListFolders(user *database.User) ([]string, error)

ListFolders returns a slice of all folder paths on the reMarkable device. Paths are returned with a leading slash, e.g. "/Books/Fiction".

func Logf

func Logf(format string, v ...interface{})

func LogfWithUser added in v1.4.0

func LogfWithUser(user *database.User, format string, v ...interface{})

LogfWithUser logs a message with username prefix in multi-user mode

func RefreshFolderCache added in v1.4.0

func RefreshFolderCache() error

RefreshFolderCache manually triggers a folder cache refresh (single-user mode)

func RefreshUserFolderCache added in v1.4.0

func RefreshUserFolderCache(userID string) error

RefreshUserFolderCache manually triggers a folder cache refresh for a specific user

func RenameAndUpload

func RenameAndUpload(storageKey, prefix, rmDir string, user *database.User, requestConflictResolution string, requestCoverpage string) (string, error)

RenameAndUpload takes a storage key, renames it in storage, uploads via rmapi, and creates archival copy

func RenameStorage added in v1.6.0

func RenameStorage(ctx context.Context, srcKey, prefix string, userID uuid.UUID) (string, error)

RenameStorage performs both operations: rename to no-year, then append year

func RenameStorageNoYear added in v1.6.0

func RenameStorageNoYear(ctx context.Context, srcKey, prefix string, userID uuid.UUID) (string, error)

RenameStorageNoYear renames a file in storage to include month and day but no year

func SanitizePrefix added in v1.0.0

func SanitizePrefix(p string) (string, error)

SanitizePrefix ensures prefix is a simple directory name with no path separators, leading slashes, or parent directory components.

func SimpleUpload

func SimpleUpload(path, rmDir string, user *database.User, requestConflictResolution string, requestCoverpage string) (string, error)

SimpleUpload calls `rmapi put` and returns the uploaded filename or a detailed error.

func StartFolderCache added in v1.1.0

func StartFolderCache()

StartFolderCache begins a goroutine that periodically refreshes the cached folder listing. It also performs an initial refresh so the first user request can be served quickly.

Types

type UserFolderCacheService added in v1.4.0

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

UserFolderCacheService manages per-user folder caching

func NewUserFolderCacheService added in v1.4.0

func NewUserFolderCacheService(db *gorm.DB) *UserFolderCacheService

NewUserFolderCacheService creates a new user folder cache service

func (*UserFolderCacheService) GetUserFolders added in v1.4.0

func (s *UserFolderCacheService) GetUserFolders(userID uuid.UUID, force bool) ([]string, error)

GetUserFolders returns the cached folders for a user, refreshing if necessary

func (*UserFolderCacheService) InvalidateUserCache added in v1.4.0

func (s *UserFolderCacheService) InvalidateUserCache(userID uuid.UUID)

InvalidateUserCache invalidates the cache for a specific user

func (*UserFolderCacheService) LoadFolderCacheFromDatabase added in v1.4.0

func (s *UserFolderCacheService) LoadFolderCacheFromDatabase(userID uuid.UUID) ([]string, error)

LoadFolderCacheFromDatabase loads cached folders from the database

func (*UserFolderCacheService) StartBackgroundRefresh added in v1.4.0

func (s *UserFolderCacheService) StartBackgroundRefresh()

StartBackgroundRefresh starts a background goroutine that periodically refreshes user caches

Jump to

Keyboard shortcuts

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