Package net.thevpc.naru.api.model
Interface NaruModelRequestSerializer
- All Known Subinterfaces:
NaruCacheAwareRequestSerializer
public interface NaruModelRequestSerializer
-
Method Summary
Modifier and TypeMethodDescriptionserialize(NaruModelRequest request, NaruModelConfig model, NaruSession session) default NElementserialize(NaruModelRequest request, NaruModelConfig model, NaruSession session, boolean stream) Serialise a request that is about to be read incrementally.
-
Method Details
-
serialize
-
serialize
default NElement serialize(NaruModelRequest request, NaruModelConfig model, NaruSession session, boolean stream) Serialise a request that is about to be read incrementally.The flag is a parameter rather than a field because a request body for the same conversation is not otherwise different: almost every protocol signals streaming with one boolean in the same payload. Carrying it on the request object instead would have made the body depend on hidden mutable state, which is exactly the kind of thing that makes a retry silently send a different request than the one that failed.
The default ignores the flag and produces the ordinary body, so a protocol that has no streaming transport stays correct: the caller reads a complete response and delivers it as one batch of chunks.
-