Idris2Doc : IO.Async.Posix

IO.Async.Posix

(source)

Reexports

importpublic IO.Async
importpublic IO.Async.Loop.PollH
importpublic IO.Async.Loop.TimerH
importpublic System.Posix.File
importpublic System.Posix.Poll.Types
importpublic System.Posix.Time

Definitions

poll : HasErrnoes=>PollHe=>FileDescf=>f->PollEvent->AsynceesPollEvent
  Polls the file descriptor for the given events without blocking
an operating system thread.

If the file descriptor does not support polling, for instance,
because it is a regular file, this will immediately return
`ev`.

Totality: total
Visibility: export
onEvent : HasErrnoes=>PollHe=>FileDescf=>f->PollEvent->Asynceesa->Asynceesa
  Runs a computation after polling a file descriptor.

This allows us to read from or write to a file descriptor
without blocking an operating system thread.

Totality: total
Visibility: export
readnb : HasErrnoes=>PollHe=>FileDescf=>f-> (0r : Type) ->FromBufr=>Bits32->Asynceesr
  Reads from a file descriptor without blocking.

If the descriptor corresponds to a regular file, this will just
read up to the given amount of bytes from the file. If the descriptor
corresponds to a socket or FIFO (pipe), the `O_NONBLOCK` flag of
the descriptor *must* have been set (via `addFlags` for instance).

This will then first try to read from the descriptor without
polling, and if this fails with `EAGAIN`, proper file polling is used.

Totality: total
Visibility: export
readRawNb : HasErrnoes=>PollHe=>FileDescf=>f->Buf->AsynceesEMBuffer
  Like `readnb` but reads data into a pre-allocated buffer.

If the descriptor corresponds to a regular file, this will just
read up to the given amount of bytes from the file. If the descriptor
corresponds to a socket or FIFO (pipe), the `O_NONBLOCK` flag of
the descriptor *must* have been set (via `addFlags` for instance).

Totality: total
Visibility: export
readPtrNB : HasErrnoes=>PollHe=>FileDescf=>f-> (0r : Type) ->FromPtrr=>CPtr->Asynceesr
  Like `readnb` but reads data into a pre-allocated C-pointer and
converts it from there.

This is useful for re-using a (reasonably large) buffer when
streaming lots of comparably small chunks of data. Instead of
allocating a new - potentially much too large - buffer with every
read (as is the case with `readnb`), we allocate a buffer once
and copy only the bytes we actually read into an immutable
data type such as a string or byte vector.

Totality: total
Visibility: export
writenb : HasErrnoes=>PollHe=>FileDescf=>f->ToBufr=>r->AsynceesBits32
  Writes to a file descriptor without blocking.

If the descriptor corresponds to a regular file, this will just
write up to the given amount of bytes to the file. If the descriptor
corresponds to a socket or FIFO (pipe), the `O_NONBLOCK` flag of
the descriptor *must* have been set (via `addFlags` for instance).

This will then first try to write to the descriptor without
polling, and if this fails with `EAGAIN`, proper file polling is used.

Totality: total
Visibility: export
fwritenb : HasErrnoes=>PollHe=>FileDescf=>f->ToBufr=>r->Asyncees ()
  Iteratively writes a value to a file descriptor making sure
that the whole value is written. Use this, if a single call to
`write` might not write the complete data (for instance, when
writing to a pipe or socket).


Totality: total
Visibility: export
stream : HasErrnoes=>PollHe=>FileDescf=>f-> (0r : Type) ->FromBufr=>Bits32-> (r->Asyncees ()) ->Asyncees ()
  Continously reads and transforms data from a file
descriptor without blocking.

Visibility: export
streamp : HasErrnoes=>PollHe=>FileDescf=>f-> (0r : Type) ->FromPtrr=>CPtr-> (r->Asyncees ()) ->Asyncees ()
  Continously reads and transforms data from a file
descriptor without blocking by loading data into a
preallocated pointer.

For very large files, this can be faster than `stream` if
the data in question can be transformed in place without allocating
additional memory. This also allows us to use a very large buffer
even in case we often only read small amounts of data.

Visibility: export
sleepTill : TimerHe=> (Tm->ClockUTC) ->Asyncees ()
  Wait until the given UTC time, which is computed from the
current time.

Totality: total
Visibility: export
nextMinute : Tm->ClockUTC
  Computes local time of the next full minute.

Totality: total
Visibility: export
nextHour : Tm->ClockUTC
  Computes local time of the next full hour.

Totality: total
Visibility: export
nextDay : Tm->ClockUTC
  Computes local time of 00:00:00 of the next day.

Totality: total
Visibility: export
nextYear : Tm->ClockUTC
  Computes local time of 00:00:00 on January 1 of the next day.

Totality: total
Visibility: export
nextMonth : Tm->ClockUTC
  Computes local time of 00:00:00 of the first day of the next month.

Totality: total
Visibility: export
nextWeek : Tm->ClockUTC
  Computes local time of 00:00:00 of the next Sunday

Totality: total
Visibility: export