Storehouse.Tus (Storehouse v0.2.0)

Copy Markdown View Source

The uploads in progress of Storehouse.Tus.Plug: their state, kept in ETS by this process, and those that expired, given up every :sweep_every seconds (their parts deleted from the store).

# lib/my_app/application.ex
children = [
  MyApp.Repo,
  Storehouse.Tus,
  MyAppWeb.Endpoint
]

ETS is one node's: on several nodes behind a load balancer, a client's next request can reach another, which does not know its upload. There, keep the state in the app's database instead, with a module of Storehouse.Tus.State given to the plug as state:.

Options

  • :sweep_every - in seconds. The default is an hour.

Summary

Functions

Starts the process, which owns the table of uploads.

Gives up the uploads of state that expired: {:ok, count}. The process does it every :sweep_every seconds, with its own state.

Functions

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

Starts the process, which owns the table of uploads.

sweep(state \\ ETS, opts \\ [])

@spec sweep(module(), keyword()) :: {:ok, non_neg_integer()}

Gives up the uploads of state that expired: {:ok, count}. The process does it every :sweep_every seconds, with its own state.