BAM.Source.File (BAM v0.1.0)

Copy Markdown View Source

File source.

The descriptor lives in a process linked to the caller. close/1 is idempotent across copies of the source struct, which is what lets a stream and BAM.close/1 both release the same file. If that process exits first, it closes the descriptor.

Summary

Functions

Returns a specification to start this module under a supervisor.

Opens path for reading.

Types

t()

@type t() :: %BAM.Source.File{
  owner: pid() | nil,
  path: Path.t(),
  size: non_neg_integer()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

open(path)

@spec open(Path.t()) :: {:ok, t()} | {:error, BAM.Error.t()}

Opens path for reading.