View Source Dropkick.Storage behaviour (dropkick v0.0.1)

Link to this section Summary

Callbacks

Copies the given file with the underlyning storage module. The underlyning implementation should accept the following options (besides any specific options)

Deletes the given file with the underlyning storage module. Returns a success tuple with the deleted the file like: {:ok, %Dropkick.File{}}.

Reads the given file with the underlyning storage module. Returns a success tuple with the content of the file like: {:ok, content}.

Stores the given file with the underlyning storage module. The underlyning implementation should accept the following options (besides any specific options)

Link to this section Callbacks

@callback copy(Dropkick.File.t(), String.t(), Keyword.t()) ::
  {:ok, Dropkick.File.t()} | {:error, String.t()}

Copies the given file with the underlyning storage module. The underlyning implementation should accept the following options (besides any specific options):

  • :move: Specifies if the file should be just copied or moved entirely, defaults to false.

Returns a success tuple with the file in the new destination like: {:ok, %Dropkick.File{}}.

@callback delete(Dropkick.File.t(), Keyword.t()) ::
  {:ok, Dropkick.File.t()} | {:error, String.t()}

Deletes the given file with the underlyning storage module. Returns a success tuple with the deleted the file like: {:ok, %Dropkick.File{}}.

@callback read(Dropkick.File.t(), Keyword.t()) :: {:ok, binary()} | {:error, String.t()}

Reads the given file with the underlyning storage module. Returns a success tuple with the content of the file like: {:ok, content}.

@callback store(Dropkick.File.t(), Keyword.t()) ::
  {:ok, Dropkick.File.t()} | {:error, String.t()}

Stores the given file with the underlyning storage module. The underlyning implementation should accept the following options (besides any specific options):

  • :folder: The base location where to save the file being transfered.
  • :prefix: A sub-folder inside the current location where the file is going to be saved, defaults to /.

Returns a success tuple like: {:ok, %Dropkick.File{}}.