xref: /aosp_15_r20/external/grpc-grpc/doc/status_ordering.md (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1*cc02d7e2SAndroid Build Coastguard WorkerOrdering Status and Reads in the gRPC API
2*cc02d7e2SAndroid Build Coastguard Worker-----------------------------------------
3*cc02d7e2SAndroid Build Coastguard Worker
4*cc02d7e2SAndroid Build Coastguard WorkerRules for implementors:
5*cc02d7e2SAndroid Build Coastguard Worker1. Reads and Writes Must not succeed after Status has been delivered.
6*cc02d7e2SAndroid Build Coastguard Worker2. Status is only delivered after all buffered messages are read.
7*cc02d7e2SAndroid Build Coastguard Worker3. Reads May continue to succeed after a failing write.
8*cc02d7e2SAndroid Build Coastguard Worker   However, once a write fails, all subsequent writes Must fail,
9*cc02d7e2SAndroid Build Coastguard Worker   and similarly, once a read fails, all subsequent reads Must fail.
10*cc02d7e2SAndroid Build Coastguard Worker4. A non-OK status received from the server is not considered an error status.
11*cc02d7e2SAndroid Build Coastguard Worker5. When an error status is known to the library, if the user asks for status,
12*cc02d7e2SAndroid Build Coastguard Worker   the library Should discard messages received in the library but not delivered
13*cc02d7e2SAndroid Build Coastguard Worker   to the user and then deliver the status. If the user does not ask for status
14*cc02d7e2SAndroid Build Coastguard Worker   but continues reading, the library Should deliver buffered messages before
15*cc02d7e2SAndroid Build Coastguard Worker   delivering status. The library MAY choose to implement the stricter version
16*cc02d7e2SAndroid Build Coastguard Worker   where errors cause all buffered messages to be dropped, but this is not a
17*cc02d7e2SAndroid Build Coastguard Worker   requirement.
18