Skip to main content

Module delivery

Module delivery 

Source
Expand description

The delivery and network rules every file destination shares, written once.

A destination implements a few primitives on its server (Store: write a file, rename, exists, delete, and what it can do atomically). deliver applies the rules on top:

  • if_exists (IfExists): replace a file already at the path, fail, or keep both by numbering the new one (report_2.xlsx);
  • atomic and temp_dir: upload under a temporary name (.<name>.dre-part, in the same folder or in temp_dir), then rename, so a half-written file never appears under its final name;
  • retries: try again on a temporary error (a dropped connection, a 429 or 5xx), with backoff and Retry-After;
  • connect_timeout and timeout, which the plugin applies to its client (Rules parses them).

The Go plugin module has the same rules (go/plugin/delivery.go). LocalStore is the local file system, used by core’s built-in local destination.

Structs§

Caps
What a store can do in one step.
Delivered
Where a delivery landed.
DeliveryError
A failed delivery.
LocalStore
The local file system, for core’s local destination. Paths are file system paths.
Rules
The rules for one delivery.

Enums§

IfExists
What to do when a file already exists at the delivery path.
Retry
What one try of a retry step gave.
StoreError
Why a store operation failed.

Constants§

DEFAULT_CONNECT_TIMEOUT
DEFAULT_MAX_RETRY_WAIT
DEFAULT_RETRIES
DEFAULT_TIMEOUT

Traits§

Store
A destination’s primitives. Paths are the destination’s own (outbound/report.xlsx).

Functions§

connection_fields
The connection fields every network plugin shares, for its connection_fields().
content_type
The media type of a delivered file, by its extension: what an email attachment or an uploaded object is labelled, so the recipient’s mail client or browser opens it.
deliver
Deliver local to remote under rules, sleeping between retries.
deliver_with
deliver, with the wait between retries supplied (tests don’t wait).
is_connection_error
Whether an I/O error is a connection failing (refused, reset, aborted, timed out, closed early), which trying again may fix.
option_fields
The options every file destination shares, for its options().
parse_duration
A duration: 30s, 5m, 2h, 1500ms, or a bare number of seconds.
retry
Run f, trying again on Retry::Temporary up to retries more times, with backoff (about 1s, then 4s, then 16s) or the server’s Retry-After. Each retry is logged at info level, naming what; a step that needed several tries is reported to core.
retry_after
The Retry-After of a 429 or 503, in seconds (an HTTP date isn’t read).
retry_option_fields
The retry options a destination entry may set over its profile’s: retries, retry_wait and max_retry_wait, for the plugin’s options() (file destinations get them through option_fields).
retry_rules
retry with a destination’s Rules: its retries, retry_wait and max_retry_wait.
retry_with
retry, with the wait between tries supplied (tests don’t wait).
take_attempts
The most tries a step took since the last call, at least 1; resets the count.
timeout_fields
The timeouts every network plugin shares (connect_timeout, timeout), for its connection_fields(). Read them with Rules::from_settings.