[][src]Struct glean_core::upload::PingUploadManager

pub struct PingUploadManager { /* fields omitted */ }

Manages the pending pings queue and directory.

Implementations

impl PingUploadManager[src]

pub fn new<P: Into<PathBuf>>(data_path: P, sync_scan: bool) -> Self[src]

Create a new PingUploadManager.

Spawns a new thread and processes the pending pings directory, filling up the queue with whatever pings are in there.

Arguments

  • data_path - Path to the pending pings directory.
  • sync_scan - Whether or not ping directory scanning should be synchronous.

Panics

Will panic if unable to spawn a new thread.

pub fn enqueue_ping(&self, document_id: &str, path: &str, body: JsonValue)[src]

Creates a PingRequest and adds it to the queue.

pub fn clear_ping_queue(&self) -> RwLockWriteGuard<VecDeque<PingRequest>>[src]

Clears the pending pings queue, leaves the deletion-request pings.

pub fn get_upload_task(&self, log_ping: bool) -> PingUploadTask[src]

Gets the next PingUploadTask.

Arguments

  • log_ping - Whether to log the ping before returning.

Return value

PingUploadTask - see PingUploadTask for more information.

pub fn process_ping_upload_response(
    &self,
    document_id: &str,
    status: UploadResult
)
[src]

Processes the response from an attempt to upload a ping.

Based on the HTTP status of said response, the possible outcomes are:

  • 200 - 299 Success Any status on the 2XX range is considered a succesful upload, which means the corresponding ping file can be deleted. Known 2XX status:

    • 200 - OK. Request accepted into the pipeline.
  • 400 - 499 Unrecoverable error Any status on the 4XX range means something our client did is not correct. It is unlikely that the client is going to recover from this by retrying, so in this case the corresponding ping file can also be deleted. Known 4XX status:

    • 404 - not found - POST/PUT to an unknown namespace
    • 405 - wrong request type (anything other than POST/PUT)
    • 411 - missing content-length header
    • 413 - request body too large Note that if we have badly-behaved clients that retry on 4XX, we should send back 202 on body/path too long).
    • 414 - request path too long (See above)
  • Any other error For any other error, a warning is logged and the ping is re-enqueued. Known other errors:

    • 500 - internal error

Note

The disk I/O performed by this function is not done off-thread, as it is expected to be called off-thread by the platform.

Arguments

document_id - The UUID of the ping in question. status - The HTTP status of the response.

Trait Implementations

impl Debug for PingUploadManager[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,