exfile v0.2.2 Exfile.Backend behaviour
Represents a backend that stores files.
Summary
Functions
A convenience function to call backend.backend_mod.delete(backend, file_id)
A convenience function to call backend.backend_mod.exists?(backend, file_id)
A convenience function to call backend.backend_mod.get(backend, file_id)
A convenience function to call backend.backend_mod.open(backend, file_id)
A convenience function to call backend.backend_mod.path(backend, file_id)
A convenience function to call backend.backend_mod.size(backend, file_id)
A convenience function to call backend.backend_mod.upload(backend, uploadable)
Callbacks
Delete a file from the backend, identified by file_id
Construct an Exfile.File struct representing the given file_id
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
Get the size of a file from the backend
upload/2 must handle at least two cases of uploadable
Types
Functions
A convenience function to call backend.backend_mod.delete(backend, file_id)
A convenience function to call backend.backend_mod.exists?(backend, file_id)
Specs
A convenience function to call backend.backend_mod.get(backend, file_id)
Specs
A convenience function to call backend.backend_mod.open(backend, file_id)
A convenience function to call backend.backend_mod.path(backend, file_id)
A convenience function to call backend.backend_mod.size(backend, file_id)
Specs
upload(backend, uploadable) ::
{:ok, %Exfile.File{backend: term, backend_meta: term, id: term, meta: term}} |
{:error, atom}
A convenience function to call backend.backend_mod.upload(backend, uploadable)
Callbacks
Delete a file from the backend, identified by file_id.
Specs
Construct an Exfile.File struct representing the given file_id.
Specs
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.
Get the size of a file from the backend
Specs
upload(backend, uploadable) ::
{:ok, %Exfile.File{backend: term, backend_meta: term, id: term, meta: term}} |
{:error, atom}
upload/2 must handle at least two cases of uploadable
:
- an %Exfile.File{}
- 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.