trevrpc/schema
What a method is: its path, how its messages are encoded, and what its schema options allow. Code that protoc-gen-trevrpc-gleam generates describes every method this way, for its client functions and routes.
Types
How the messages of one type are encoded and decoded. A message that
cannot be decoded is Error(Nil).
pub type Codec(a) {
Codec(
encode: fn(a) -> BitArray,
decode: fn(BitArray) -> Result(a, Nil),
)
}
Constructors
-
Codec( encode: fn(a) -> BitArray, decode: fn(BitArray) -> Result(a, Nil), )
How a direction’s messages may be compressed without a dictionary: not at all, each on its own, or with a context per call, for a direction that streams.
pub type Compression {
NoCompression
MessageCompression
StreamCompression
}
Constructors
-
NoCompression -
MessageCompression -
StreamCompression
pub type Method(request, response) {
Method(
path: String,
request: Codec(request),
response: Codec(response),
request_type: String,
response_type: String,
request_compression: Compression,
response_compression: Compression,
unreliable_requests: Bool,
unreliable_responses: Bool,
)
}
Constructors
-
Method( path: String, request: Codec(request), response: Codec(response), request_type: String, response_type: String, request_compression: Compression, response_compression: Compression, unreliable_requests: Bool, unreliable_responses: Bool, )Arguments
- path
-
/package.Service/Method. - request_type
-
The protobuf full names of the messages, which pick their compression dictionaries; empty for none.
- unreliable_requests
-
Whether the requests and responses of a streaming direction may travel as datagrams.