exfile v0.0.3 Exfile.Backend behaviour
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
upload/2 must handle at least three cases of uploadable
Types
backend :: map
uploadable :: pid | Exfile.File.t | tempfile_path
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)
Callbacks
Specs
upload(backend, uploadable) ::
{:ok, Exfile.File.t} |
{:error, atom}
upload/2 must handle at least three cases of uploadable
:
- an IO (pid)
- an %Exfile.File{}
- a path to a tempfile
You may elect to implement a fourth 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.