Documentation
¶
Index ¶
- Variables
- func AppendYearLocal(noYearPath string) (string, error)
- func CleanupOld(prefix, rmDir string, retentionDays int, user *database.User) error
- func CleanupUserTempDir(userID uuid.UUID) error
- func DefaultRmDir() string
- func FoldersHandler(c *gin.Context)
- func GetUserDataDir(userID uuid.UUID) (string, error)
- func GetUserPDFDir(userID uuid.UUID, prefix string) (string, error)
- func GetUserRmapiConfigPath(userID uuid.UUID) (string, error)
- func GetUserTempDir(userID uuid.UUID) (string, error)
- func GetUserUploadDir(userID uuid.UUID) (string, error)
- func InitializeUserFolderCache(db *gorm.DB)
- func IsSingleUserPaired() bool
- func IsUserPaired(userID uuid.UUID) bool
- func ListFolders(user *database.User) ([]string, error)
- func Logf(format string, v ...interface{})
- func LogfWithUser(user *database.User, format string, v ...interface{})
- func RefreshFolderCache() error
- func RefreshUserFolderCache(userID string) error
- func RenameAndUpload(path, prefix, rmDir string, user *database.User) (string, error)
- func RenameLocal(path, prefix string) (string, error)
- func RenameLocalNoYear(src, prefix string) (string, error)
- func SanitizePrefix(p string) (string, error)
- func SimpleUpload(path, rmDir string, user *database.User) (string, error)
- func StartFolderCache()
- type UserFolderCacheService
- func (s *UserFolderCacheService) GetUserFolders(userID uuid.UUID, force bool) ([]string, error)
- func (s *UserFolderCacheService) InvalidateUserCache(userID uuid.UUID)
- func (s *UserFolderCacheService) LoadFolderCacheFromDatabase(userID uuid.UUID) ([]string, error)
- func (s *UserFolderCacheService) StartBackgroundRefresh()
Constants ¶
This section is empty.
Variables ¶
var ExecCommand = exec.Command
ExecCommand is exec.Command by default, but can be overridden in tests.
Functions ¶
func AppendYearLocal ¶
func CleanupOld ¶
func CleanupUserTempDir ¶ added in v1.4.0
CleanupUserTempDir removes old temp files for a user
func DefaultRmDir ¶
func DefaultRmDir() string
func FoldersHandler ¶ added in v1.0.0
FoldersHandler writes a JSON {"folders": ["/path", ...]}.
func GetUserDataDir ¶ added in v1.4.0
GetUserDataDir returns the data directory for a specific user In multi-user mode, creates /data/users/{user_id}/ In single-user mode, returns /data/
func GetUserPDFDir ¶ added in v1.4.0
GetUserPDFDir returns the PDF directory for a specific user In multi-user mode, creates /data/users/{user_id}/pdfs/ In single-user mode, returns the PDF_DIR env var or /data/pdfs/
func GetUserRmapiConfigPath ¶ added in v1.4.0
GetUserRmapiConfigPath returns the path to the rmapi configuration file for a user. In multi-user mode it is stored under the user's data directory. The necessary directory structure is created if missing.
func GetUserTempDir ¶ added in v1.4.0
GetUserTempDir returns the temp directory for a specific user In multi-user mode, creates /data/users/{user_id}/temp/ In single-user mode, returns system temp directory
func GetUserUploadDir ¶ added in v1.4.0
GetUserUploadDir returns the upload directory for a specific user In multi-user mode, creates /data/users/{user_id}/uploads/ In single-user mode, returns ./uploads/
func InitializeUserFolderCache ¶ added in v1.4.0
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 IsUserPaired ¶ added in v1.4.0
IsUserPaired checks whether the rmapi configuration file exists and is non-empty for the given user.
func ListFolders ¶ added in v1.0.0
ListFolders returns a slice of all folder paths on the reMarkable device. Paths are returned with a leading slash, e.g. "/Books/Fiction".
func LogfWithUser ¶ added in v1.4.0
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
RefreshUserFolderCache manually triggers a folder cache refresh for a specific user
func RenameAndUpload ¶
RenameAndUpload renames locally, uploads via rmapi, and returns the name on the device.
func RenameLocal ¶
func RenameLocalNoYear ¶
func SanitizePrefix ¶ added in v1.0.0
SanitizePrefix ensures prefix is a simple directory name with no path separators, leading slashes, or parent directory components.
func SimpleUpload ¶
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
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