chunker v0.12.0 Chunker View Source

Provides functions to interact with chunked files.

Link to this section Summary

Functions

Appends data to the given chunked_file

Closes the given chunked_file

Returns true if the given chunked_file has already been closed

Commits the given chunked_file

Returns the data of the chunk with index from the given chunked_file

Inserts data to the given chunked_file at the position specified by index

Returns the number of individual chunks the given chunked_file consists of

Prepends data to the given chunked_file

Removes the given chunked_file

Removes the chunk with the corresponding index from the given chunked_file

Replaces the chunk with the corresponding index with the given data

Returns true if chunks can be added or removed from the given chunked_file

Link to this section Types

Link to this type error_tuple() View Source
error_tuple() :: {:error, reason()}
Link to this type success_tuple() View Source
success_tuple() :: {:ok, t()}

Link to this section Functions

Link to this function append_chunk(chunked_file, data) View Source
append_chunk(t(), bitstring()) :: result()

Appends data to the given chunked_file.

Link to this function close(chunked_file) View Source
close(t()) :: :ok | error_tuple()

Closes the given chunked_file.

After the file has been closed, it is not possible to read from it nor write to it.

Link to this function closed?(chunked_file) View Source
closed?(t()) :: boolean()

Returns true if the given chunked_file has already been closed.

Link to this function commit(chunked_file) View Source
commit(t()) :: result()

Commits the given chunked_file.

After the file has been committed, chunks can no longer be added or removed.

Link to this function get_chunk(chunked_file, index) View Source
get_chunk(t(), integer()) :: {:ok, bitstring()} | error_tuple()

Returns the data of the chunk with index from the given chunked_file.

Link to this function insert_chunk(chunked_file, data, index) View Source
insert_chunk(t(), bitstring(), integer()) :: result()

Inserts data to the given chunked_file at the position specified by index.

Link to this function length(chunked_file) View Source
length(t()) :: {:ok, integer()} | error_tuple()

Returns the number of individual chunks the given chunked_file consists of.

Link to this function prepend_chunk(chunked_file, data) View Source
prepend_chunk(t(), bitstring()) :: result()

Prepends data to the given chunked_file.

Link to this function remove(chunked_file) View Source
remove(t()) :: :ok | error_tuple()

Removes the given chunked_file.

Link to this function remove_chunk(chunked_file, index) View Source
remove_chunk(t(), integer()) :: result()

Removes the chunk with the corresponding index from the given chunked_file.

Link to this function replace_chunk(chunked_file, data, index) View Source
replace_chunk(t(), bitstring(), integer()) :: result()

Replaces the chunk with the corresponding index with the given data.

Link to this function writeable?(chunked_file) View Source
writeable?(t()) :: boolean()

Returns true if chunks can be added or removed from the given chunked_file.