This commit is contained in:
Hong Ooi 2020-05-27 11:13:34 +10:00
Родитель cb830d71b2
Коммит 4806e44b20
8 изменённых файлов: 44 добавлений и 5 удалений

Просмотреть файл

@ -16,7 +16,6 @@ Imports:
AzureRMR (>= 2.0.0),
AzureStor (>= 3.0.0),
openssl,
xml2,
httr
Suggests:
testthat,

Просмотреть файл

@ -25,6 +25,3 @@ get_classic_metadata_headers <- getNamespace("AzureStor")$get_classic_metadata_h
set_classic_metadata_headers <- getNamespace("AzureStor")$set_classic_metadata_headers
# tag xml2 to satisfy R CMD check
xml2::as_xml_document

Просмотреть файл

@ -62,6 +62,8 @@ public=list(
#' @description
#' Deletes this message from the queue.
#' @return
#' NULL, invisibly.
delete=function()
{
private$check_receipt()
@ -76,6 +78,8 @@ public=list(
#' This operation can be used to continually extend the invisibility of a queue message. This functionality can be useful if you want a worker role to "lease" a message. For example, if a worker role calls [`get_messages`][StorageQueue] and recognizes that it needs more time to process a message, it can continually extend the message's invisibility until it is processed. If the worker role were to fail during processing, eventually the message would become visible again and another worker role could process it.
#' @param visibility_timeout The new visibility timeout (time to when the message will again be visible).
#' @param text Optionally, new message text, either a raw or character vector. If a raw vector, it is base64-encoded, and if a character vector, it is collapsed into a single string before being sent to the queue.
#' @return
#' The message object, invisibly.
update=function(visibility_timeout, text=self$text)
{
private$check_receipt()
@ -101,6 +105,8 @@ public=list(
#' @description
#' Print method for this class.
#' @param ... Not currently used.
#' @return
#' The message object, invisibly.
print=function(...)
{
cat("<queue message ", self$id, ">\n", sep="")

Просмотреть файл

@ -73,6 +73,8 @@ public=list(
#' @description
#' Creates a storage queue in Azure, using the storage endpoint and name from this R6 object.
#' @return
#' The queue object, invisibly.
create=function()
{
do_container_op(self, http_verb="PUT")
@ -82,6 +84,8 @@ public=list(
#' @description
#' Deletes this storage queue in Azure.
#' @param confirm Whether to ask for confirmation before deleting.
#' @return
#' The queue object, invisibly.
delete=function(confirm=TRUE)
{
if(!delete_confirmed(confirm, paste0(self$endpoint$url, name), "queue"))
@ -93,9 +97,12 @@ public=list(
#' @description
#' Clears (deletes) all messages in this storage queue.
#' @return
#' The queue object, invisibly.
clear=function()
{
do_container_op(self, "messages", http_verb="DELETE")
invisible(self)
},
#' @description
@ -121,7 +128,7 @@ public=list(
else list(...)
do_container_op(self, options=list(comp="metadata"), headers=set_classic_metadata_headers(meta),
http_verb = "PUT")
http_verb="PUT")
invisible(meta)
},
@ -202,6 +209,8 @@ public=list(
#' @param text The message text, either a raw or character vector. If a raw vector, it is base64-encoded, and if a character vector, it is collapsed into a single string before being sent to the queue.
#' @param visibility_timeout Optional visibility timeout after being read, in seconds. The default is 30 seconds.
#' @param time_to_live Optional message time-to-live, in seconds. The default is 7 days.
#' @return
#' The message text, invisibly.
put_message=function(text, visibility_timeout=NULL, time_to_live=NULL)
{
text <- if(is.raw(text))
@ -229,6 +238,8 @@ public=list(
#' @param msg A message object, of class [`QueueMessage`].
#' @param visibility_timeout The new visibility timeout (time to when the message will again be visible).
#' @param text Optionally, new message text, either a raw or character vector. If a raw vector, it is base64-encoded, and if a character vector, it is collapsed into a single string before being sent to the queue.
#' @return
#' The message object, invisibly.
update_message=function(msg, visibility_timeout, text=msg$text)
{
stopifnot(inherits(msg, "QueueMessage"))

Просмотреть файл

@ -8,6 +8,8 @@
#'
#' @details
#' This is the queue storage counterpart to the endpoint functions defined in the AzureStor package.
#' @return
#' An object of class `queue_endpoint`, inheriting from `storage_endpoint`.
#' @seealso
#' [`AzureStor::storage_endpoint`], [`AzureStor::blob_endpoint`], [`storage_queue`]
#' @examples

Просмотреть файл

@ -80,6 +80,9 @@ Deletes this message from the queue.
\if{html}{\out{<div class="r">}}\preformatted{QueueMessage$delete()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
NULL, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-update"></a>}}
@ -101,6 +104,9 @@ This operation can be used to continually extend the invisibility of a queue mes
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
The message object, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-print"></a>}}
@ -118,6 +124,9 @@ Print method for this class.
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
The message object, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clone"></a>}}

Просмотреть файл

@ -114,6 +114,9 @@ Creates a storage queue in Azure, using the storage endpoint and name from this
\if{html}{\out{<div class="r">}}\preformatted{StorageQueue$create()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
The queue object, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-delete"></a>}}
@ -131,6 +134,9 @@ Deletes this storage queue in Azure.
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
The queue object, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clear"></a>}}
@ -304,6 +310,9 @@ Writes a message to the back of the message queue.
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
The message text, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-update_message"></a>}}
@ -327,6 +336,9 @@ This operation can be used to continually extend the invisibility of a queue mes
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
The message object, invisibly.
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-delete_message"></a>}}

Просмотреть файл

@ -23,6 +23,9 @@ queue_endpoint(
\item{api_version}{The storage API version to use when interacting with the host. Defaults to \code{"2019-07-07"}.}
}
\value{
An object of class \code{queue_endpoint}, inheriting from \code{storage_endpoint}.
}
\description{
Create a queue endpoint object
}