queue: mutant queue

Description Public fields Methods Examples

Description

queue R6 class, for queueing mutant jobs

Public fields

q

(liteq_queue) the liteq queue object

qpath

(character) path to the queue on disk

Methods

Public methods


Method print()

print method for queue objects

Usage
queue$print(x, ...)
Arguments
x

self

...

ignored


Method new()

Create a new queue object

Usage
queue$new(temporary = TRUE)
Arguments
temporary

(logical) create a temporary queue that is cleaned up at the end of your R session? default: TRUE. if FALSE, we use rappdirs::user_data_dir() to cache the file. use $queue_path() to get the path for the queue

Returns

A new queue object


Method publish()

publish a job into the queue

Usage
queue$publish(message, title = uuid::UUIDgenerate())
Arguments
message

(character) job message, a JSON string with fields path and mutant_location, for the file path to the mutated package to test and information on the location of the mutation, respectively

title

(character) job title, a UUID, generated from uuid::UUIDgenerate()


Method consume()

consume a job from the queue

Usage
queue$consume()

Method done()

tell the queue the job can be removed from the queue

Usage
queue$done(message)
Arguments
message

(character) message object, of class liteq_message


Method messages()

list jobs in the queue

Usage
queue$messages()

Method count()

count jobs in the queue

Usage
queue$count()

Method queue_path()

fetch the queue path. NULL if there's no queue

Usage
queue$queue_path()

Method destroy()

destroy the queue - in practice this only means deleting the SQLite file

Usage
queue$destroy()

Method clone()

The objects of this class are cloneable with this method.

Usage
queue$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
x <- queue$new()
x
x$q
x$queue_path()
x$messages()
z <- list(
  path = tempfile(), 
  mutant_location = list(
    `some-file.R` = 
      list(line1 = 45, line2 = 46, column = 4, from = "==", to = ">")))
x$publish(as.character(jsonlite::toJSON(z)))
x
x$messages()
mssg <- x$consume()
mssg
mssg$title
mssg$message
jsonlite::fromJSON(mssg$message)
x$messages()
x$done(mssg)
x$messages()
x

## End(Not run)

ropensci/mutant documentation built on Dec. 30, 2021, 11:53 a.m.