Module cartridge.upload

Spread the data across instances in a network-efficient manner.

(Added in v2.4.0-43)

Functions

upload (data, uri_list)

Spread the data across the cluster.

For each separate upload, a random upload_id is generated. All the instances try to create /tmp/<upload_id> on their side, and those who succeed act as transmitters.

When the upload finishes, all the instances load the data into the inbox table and the temporary files are cleared. The inbox isn’t garbage-collected automatically. It’s the user’s responsibility to clean it up after use.

Parameters:

  • data: any Lua object.

  • uri_list: ({string,…}) array of URIs.

Returns:

(string) upload_id (if at least one upload succeded)

Or

(nil)

(table) Error description

Tables

inbox

The uploaded data. {[upload_id] = data}