| BackupQueueDateTime {rotor} | R Documentation |
An R6 class for managing timestamped backups
Description
A BackupQueue for timestamped backups, e.g. foo.log, foo.2020-07-24_10-54-30.log
Details
This class is part of the R6 API of rotor which is
intended for developers that want to extend this package. For normal usage,
the simpler functional API is recommended (see rotate()).
Super classes
rotor::DirectoryQueue -> rotor::BackupQueue -> BackupQueueDateTime
Active bindings
fmtSee
formatargument ofrotate_date()logicalscalar. IfTRUE(the default) the list of backups is cached, ifFALSEit is read from disk every time this appender triggers. Caching brings a significant speedup for checking whether to rotate or not based on theageof the last backup, but is only safe if there are no other programs/functions interacting with the backups. This is only advantageous for high frequency file rotation (i.e. several times per second)POSIXctscalar. Timestamp of the last rotation (the last backup)
Methods
Public methods
Inherited methods
Method new()
Usage
BackupQueueDateTime$new( origin, dir = dirname(origin), max_backups = Inf, compression = FALSE, fmt = "%Y-%m-%d--%H-%M-%S", cache_backups = FALSE, backup_dir = NULL )
Method push()
Create a new time-stamped backup (e.g. ‘logfile.2020-07-22_12-26-29.log’)
Usage
BackupQueueDateTime$push(overwrite = FALSE, now = Sys.time())
Arguments
overwritelogicalscalar. Overwrite backups with the same filename (i.e timestamp)?nowPOSIXctscalar. Can be used as an override mechanism for the current system time if necessary.
Method prune()
Usage
BackupQueueDateTime$prune(max_backups = self$max_backups)
Method should_rotate()
Should a file of size and age be rotated? See size and age
arguments of rotate_date(). now overrides the current system time,
'last_rotation“ overrides the date of the last rotation.
Usage
BackupQueueDateTime$should_rotate( size, age, now = Sys.time(), last_rotation = self$last_rotation %||% file.info(self$origin)$ctime, verbose = FALSE )
Returns
TRUE or FALSE
Method update_backups_cache()
Force update of the backups cache (only if $cache_backups == TRUE).
Usage
BackupQueueDateTime$update_backups_cache()
Method set_max_backups()
Usage
BackupQueueDateTime$set_max_backups(x)
Method set_fmt()
Usage
BackupQueueDateTime$set_fmt(x)
Method set_cache_backups()
Usage
BackupQueueDateTime$set_cache_backups(x)
See Also
Other R6 Classes:
BackupQueueDate,
BackupQueueIndex,
BackupQueue,
Cache,
DirectoryQueue