A BackupQueue for timestamped backups, e.g. foo.log
, foo.2020-07-24_10-54-30.log
rotor::DirectoryQueue
-> rotor::BackupQueue
-> BackupQueueDateTime
fmt
See format
argument of rotate_date()
logical
scalar. If TRUE
(the default) the list of backups is cached,
if FALSE
it is read from disk every time this appender triggers.
Caching brings a significant speedup for checking whether to rotate or
not based on the age
of 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)
POSIXct
scalar. Timestamp of the last rotation (the last backup)
new()
BackupQueueDateTime$new( origin, dir = dirname(origin), max_backups = Inf, compression = FALSE, fmt = "%Y-%m-%d--%H-%M-%S", cache_backups = FALSE, backup_dir = NULL )
push()
Create a new time-stamped backup (e.g. logfile.2020-07-22_12-26-29.log
)
BackupQueueDateTime$push(overwrite = FALSE, now = Sys.time())
overwrite
logical
scalar. Overwrite backups with the same
filename (i.e timestamp)?
now
POSIXct
scalar. Can be used as an override mechanism for
the current system time if necessary.
prune()
BackupQueueDateTime$prune(max_backups = self$max_backups)
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.
BackupQueueDateTime$should_rotate( size, age, now = Sys.time(), last_rotation = self$last_rotation %||% file.info(self$origin)$ctime, verbose = FALSE )
TRUE
or FALSE
update_backups_cache()
Force update of the backups cache (only if $cache_backups == TRUE
).
BackupQueueDateTime$update_backups_cache()
set_max_backups()
BackupQueueDateTime$set_max_backups(x)
set_fmt()
BackupQueueDateTime$set_fmt(x)
set_cache_backups()
BackupQueueDateTime$set_cache_backups(x)
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()
).
Other R6 Classes:
BackupQueueDate
,
BackupQueueIndex
,
BackupQueue
,
Cache
,
DirectoryQueue