source/exe/admin_response.md
stateDiagram-v2
direction TB
[*] --> Uninit: Created
Uninit --> GetChunks: nextChunk()
Uninit --> Done: Cancel / Failure / Shutdown
GetChunks --> GetChunks: nextChunk(): Sync, more data
GetChunks --> Continue: nextChunk(): Async op started
GetChunks --> Done: nextChunk(): Final sync chunk
GetChunks --> Done: Error in nextChunk()
GetChunks --> Done: Cancel / Failure / Shutdown
Continue --> GetChunks: onChunk(): Async data received
Continue --> Done: onDrained(): Async finished
Continue --> Done: Error in callback
Continue --> Done: Cancel / Failure / Shutdown
state Done {
description: Terminal State
}
This describes the lifecycle of an AdminResponse object, used for streaming potentially large responses from Envoy's admin interface.
Uninit:
AdminResponse after it has been created.GetChunks:
nextChunk() method is called when the response is in this state.Continue:
nextChunk() initiates an operation that doesn't return data immediately (e.g., fetching data from another thread or component).Done:
AdminResponse.[*] --> Uninit (Label: Created)
AdminResponse object is instantiated and starts in the Uninit state.Uninit --> GetChunks (Label: nextChunk())
nextChunk() moves the state from Uninit to GetChunks, initiating the data generation process.GetChunks --> GetChunks (Label: nextChunk(): Sync, more data)
nextChunk() is called, it synchronously produces one or more data chunks, but there's still more data to come in subsequent calls. The state remains GetChunks.GetChunks --> Continue (Label: nextChunk(): Async op started)
nextChunk() initiates an asynchronous operation to fetch/generate the next chunk. The state transitions to Continue to wait for the callback.GetChunks --> Done (Label: nextChunk(): Final sync chunk)
nextChunk() synchronously produces the final data chunk. The response is now complete.Continue --> GetChunks (Label: onChunk(): Async data received)
GetChunks) completes and provides a data chunk via the onChunk() callback. The state returns to GetChunks to process this chunk and prepare for the next.Continue --> Done (Label: onDrained(): Async finished)
onDrained().Uninit --> Done (Label: Cancel / Failure / Shutdown)
Uninit state. This can happen if cancel() is called, onFailure() is invoked, or the main Envoy server context is shutting down before nextChunk() is ever called.GetChunks --> Done (Label: Error in nextChunk() or Cancel / Failure / Shutdown)
GetChunks state. This can be due to:
nextChunk().cancel() being called.onFailure() being invoked.Continue --> Done (Label: Error in callback or Cancel / Failure / Shutdown)
Continue state. This can be due to:
onChunk() or onDrained()).cancel() being called.onFailure() being invoked.