exfile v0.3.6 Exfile.Backend.FileSystem View Source

A local filesystem-backed backend.

FileSystem accepts the standard initialization options, plus one:

  • :ttl — configurable TTL (in seconds) for files stored in the backend. Files are checked and vacuumed on initialization or by calling vacuum/1 manually. Note that the mtime (file modification timestamp) is used to determine if a file should be deleted or not. This option only makes sense in an ephemeral cache configuration, never a persistent store.

Link to this section Summary

Functions

Delete a file from the backend, identified by file_id

Callback implementation for Exfile.Backend.exists?/2

Construct an Exfile.File struct representing the given file_id

Callback implementation for Exfile.Backend.init/1

Open a file from the backend. This function should download the file either to a temporary file or to memory in the Exfile.LocalFile struct

Callback implementation for Exfile.Backend.path/2

Get the size of a file from the backend

upload/2 must handle at least two cases of uploadable

Scan & delete files in backend that have expired

Link to this section Functions

Delete a file from the backend, identified by file_id.

Callback implementation for Exfile.Backend.delete/2.

Callback implementation for Exfile.Backend.exists?/2.

Construct an Exfile.File struct representing the given file_id.

Callback implementation for Exfile.Backend.get/2.

Callback implementation for Exfile.Backend.init/1.

Open a file from the backend. This function should download the file either to a temporary file or to memory in the Exfile.LocalFile struct.

Callback implementation for Exfile.Backend.open/2.

Callback implementation for Exfile.Backend.path/2.

Get the size of a file from the backend

Callback implementation for Exfile.Backend.size/2.

Link to this function upload(backend, other_file) View Source

upload/2 must handle at least two cases of uploadable:

  1. an %Exfile.File{}
  2. an %Exfile.LocalFile{}

You may elect to implement a third case that handles uploading between identical backends, if there is a more efficient way to implement it. See Exfile.Backend.FileSystem.upload/2 for an example.

Callback implementation for Exfile.Backend.upload/2.

Link to this function vacuum(backend) View Source
vacuum(Exfile.Backend.t) :: :ok | {:error, :file.posix}

Scan & delete files in backend that have expired

No-op when the :ttl option is “infinity” or nil (default).