Packmatic v0.1.0 Packmatic.Source behaviour View Source

Defines how data can be acquired in a piecemeal fashion, perhaps by reading only a few pages from the disk at a time or only a few MBs of data from an open socket.

Link to this section Summary

Functions

Transforms an Entry into a Source ready for acquisition. Called by Packmatic.Encoder.

Consumes bytes off an initialised Source. Called by Packmatic.Encoder.

Callbacks

Converts the Entry to a Source, or return failure.

Iterates the Source and return data as an IO List, :eof, or failure.

Link to this section Types

Link to this section Functions

Link to this function

build(arg)

View Source
build(entry_file()) :: {:ok, Packmatic.Source.File.t()} | {:error, term()}
build(entry_url()) :: {:ok, Packmatic.Source.URL.t()} | {:error, term()}
build(entry_random()) :: {:ok, Packmatic.Source.Random.t()} | {:error, term()}
build(entry_dynamic()) :: {:ok, Packmatic.Source.Dynamic.t()} | {:error, term()}

Transforms an Entry into a Source ready for acquisition. Called by Packmatic.Encoder.

Consumes bytes off an initialised Source. Called by Packmatic.Encoder.

Link to this section Callbacks

Link to this callback

init(term)

View Source
init(term()) :: {:ok, struct()} | {:error, term()}

Converts the Entry to a Source, or return failure.

Link to this callback

read(struct)

View Source
read(struct()) :: iodata() | :eof | {:error, term()}

Iterates the Source and return data as an IO List, :eof, or failure.