Documentation
¶
Index ¶
- Variables
- func AppendYearStorage(ctx context.Context, noYearKey string, userID uuid.UUID) (string, error)
- func CleanupOld(prefix, rmDir string, retentionDays int, user *database.User) error
- func CreateUserTempDir(userID uuid.UUID) (string, error)
- func CreateUserTempFile(userID uuid.UUID, pattern string) (string, error)
- func DefaultRmDir() string
- func FoldersHandler(c *gin.Context)
- func InitializeUserFolderCache(db *gorm.DB)
- func IsSingleUserPaired() 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(storageKey, prefix, rmDir string, user *database.User, ...) (string, error)
- func RenameStorage(ctx context.Context, srcKey, prefix string, userID uuid.UUID) (string, error)
- func RenameStorageNoYear(ctx context.Context, srcKey, prefix string, userID uuid.UUID) (string, error)
- func SanitizePrefix(p string) (string, error)
- func SimpleUpload(path, rmDir string, user *database.User, requestConflictResolution string, ...) (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 AppendYearStorage ¶ added in v1.6.0
AppendYearStorage renames a file in storage to append the current year
func CleanupOld ¶
func CreateUserTempDir ¶ added in v1.6.0
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
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
FoldersHandler writes a JSON {"folders": ["/path", ...]}.
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 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 ¶
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
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
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
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