Liking cljdoc? Tell your friends :D

clj-grpc.metadata

io.grpc.Metadata — gRPC's headers and trailers — as Clojure data, and back.

(metadata {"authorization" "Bearer t" "x-trace-bin" some-bytes})
(header md "authorization")          ; last value, or nil
(metadata->map md)                     ; {"authorization" "Bearer t" ...}

Keys are header names: a name ending in "-bin" is a binary header carrying byte arrays, anything else is ASCII text — gRPC's own rule, applied so a caller never touches a Metadata$Key. Names may be strings or keywords; the wire form is the lower-cased string.

A Metadata stays a Metadata on the hot path. The call map an interceptor receives carries the request headers raw, because converting every header of every call into a map costs on each request and most interceptors read one name. Maps are for declaring headers, not for reading them.

io.grpc.Metadata — gRPC's headers and trailers — as Clojure data, and back.

    (metadata {"authorization" "Bearer t" "x-trace-bin" some-bytes})
    (header md "authorization")          ; last value, or nil
    (metadata->map md)                     ; {"authorization" "Bearer t" ...}

Keys are header names: a name ending in "-bin" is a binary header carrying
byte arrays, anything else is ASCII text — gRPC's own rule, applied so a
caller never touches a Metadata$Key. Names may be strings or keywords; the
wire form is the lower-cased string.

A Metadata stays a Metadata on the hot path. The call map an interceptor
receives carries the request headers raw, because converting every header
of every call into a map costs on each request and most interceptors read
one name. Maps are for declaring headers, not for reading them.
raw docstring

(header md name)

The last value sent under name, or nil. nil-safe on the Metadata.

The last value sent under `name`, or nil. nil-safe on the Metadata.
sourceraw docstring

keyclj

(key name)

The Metadata$Key for a header name: binary when the name ends in -bin, ASCII otherwise. Cached per name — grpc requires the same Key instance to read what was written.

The Metadata$Key for a header name: binary when the name ends in -bin,
ASCII otherwise. Cached per name — grpc requires the same Key instance to
read what was written.
sourceraw docstring

merge-into!clj

(merge-into! md m)

Write the headers in m — a map or another Metadata — into md, replacing each name wholesale: the names present in m end up with exactly the values m gives them, names absent from m are untouched. A vector value writes the header once per element. Returns md.

Write the headers in `m` — a map or another Metadata — into `md`, replacing
each name wholesale: the names present in `m` end up with exactly the
values `m` gives them, names absent from `m` are untouched. A vector value
writes the header once per element. Returns md.
sourceraw docstring

metadataclj

(metadata m)

A Metadata from a map — or the Metadata itself, unchanged, so callers may pass either.

A Metadata from a map — or the Metadata itself, unchanged, so callers may
pass either.
sourceraw docstring

metadata->mapclj

(metadata->map md)

The Metadata as {name last-value}: what header would answer for every name present. Repeated headers collapse to their last value; use values for all of them.

The Metadata as {name last-value}: what `header` would answer for every
name present. Repeated headers collapse to their last value; use `values`
for all of them.
sourceraw docstring

valuesclj

(values md name)

Every value sent under name, in order — headers may repeat. nil when none.

Every value sent under `name`, in order — headers may repeat. nil when none.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close