std/io¶
module io
Input and output: endpoints, the data sources read from them, and the
data targets written to them. An endpoint names where bytes are and
performs no I/O; a format type (module format) states how the bytes are
documents; a source or target joins the two, and Seq and Stream state
whether the documents end.
Endpoint— The abstract type of every endpoint: where bytes are.Readable— An endpoint bytes can be read from, bysourceandtap.Replayable— AReadableendpoint that gives the same bytes on every read in one evaluation, sosourcereads what it holds as aSeq.Writable— An endpoint bytes can be written to, bytargetandsink.Transport— An endpoint outside the evaluation: a file, a process stream, a network resource, a database table or a broker's log.Direct— ATransporton this machine: a process stream or the file system.Network— ATransportin another process, reached over a connection.ByteTransport— ATransportthat moves bytes: a format separates the documents.MessageTransport— ATransportthat moves framed messages: each message is one document, decoded by the format,Jsonwhere none is named.RowTransport— ATransportthat moves rows of named columns: it takes no format.Transactional— ATransportwhose system has an atomic scope: statements over it begin, commit and roll back as one unit.Insertable— ATransportthat takes rows it does not hold, byinsert.Updatable— ATransportwhose held rows a statement changes in place, byupdate.Deletable— ATransportwhose held rows a statement removes, bydelete.IsolationLevel— How much of other transactions a scope sees.ReadCommitted— TheIsolationLevelat which a statement sees what was committed before it began: PostgreSQL's default.RepeatableRead— TheIsolationLevelat which every statement of a scope sees the snapshot its first statement saw.Serializable— TheIsolationLevelat which concurrent scopes behave as if run one after another: SQLite's only level.Transaction— The handle of a transaction scope, bound bywith transaction tx on …(HQL-0051).TransactionFailure— Why a transaction scope did not commit, theerrof itsResult:kindis"rolled_back"fortx.rollback,"conflict"for a concurrent transaction after the last attempt,"constraint"for a row the system refused, and"exhausted"fortx.retrywith no attempt left;reasonis therollbackargument or what the system said;attemptscounts the attempts run.Stdin— The program's standard input, bound asstdin: read once, as it arrives.Stdout— The program's standard output, bound asstdout: written while the program runs, before the host presents its result.Stderr— The program's standard error, bound asstderr: where diagnostics go, apart from the result.FileEnd— The end of a file, after what it holds, asfile(path).end: a write there appends, andtapfollows what is written next, astail -fdoes.File— A local file, the whole of it: read, every document it holds; written, it is replaced.Path— A place in a file system, written as text: segments separated by/.Channel— An endpoint of values rather than bytes, held in memory for one execution scope: a program run, or one cell.DataSource— What a program reads: a configured endpoint by id, or an endpoint read in a format.FiniteSource— A source of every document, in order, that ends: read from aReplayableendpoint.LiveSource— A source of each document as it arrives, with no replay: read from a live endpoint.KeyedSource— A finite source whose contents are addressable by a key of typeK.Position— A message's place in its log, ordered as the log is.Message— One element of a stream with where and when it sits in it: itsvalue, itsposition, an optionalkeyandtime, and itsheaders.StreamSource— A log:Message<T>s in order, replayable within its retention.Catalog— An endpoint that contains sources of typeS: a database of tables, a cluster of topics.VaultSource— A vault as a source: an endpoint that holds its cards, as a catalog holds tables, with its members as fields rather than names.DataTarget— What a program writes to: an endpoint written in a format, or a configured endpoint by its id.file— TheFileatpath.join—selfwithsegmentappended as its last segment, separated by/:Path("data").join("birds.csv")isPath("data/birds.csv").parent—selfwithout its last segment,some(Path), ornonefor a path of one segment:Path("a/b").parent()issome(Path("a")), andPath("a").parent()isnone.name— The last segment ofself:Path("data/birds.csv").name()is"birds.csv".stem— The last segment ofselfwithout its extension:Path("data/birds.csv").stem()is"birds".extension— The text after the last.of the last segment,some(String), ornonewhere the segment has none:Path("a/b.csv").extension()issome("csv").configured— The endpoint configured under the literalidin .hql/config.toml, as the transport its kind states, with its schema boundary: apostgresendpoint is aPostgres, acsvendpoint aFile.source— Every document read fromendpointinformat, decoded toT: aSeqfrom aReplayableendpoint, aStreamfrom a live one.tap— The documents read fromendpointinformat, one held at a time, as aStream<T>.target— Writesvalueas one document toendpointinformat, or to the target configured underid, and givesStep.sink— Writes each ofvaluestoendpointinformat, one document per value, and givesStep:[{a: 1}, {a: 2}] | sink(stdout, Json)writes{"a":1}and{"a":2}on two lines.