[component] clarifying lifecycle expectation (#6535)

Extended the documentation of the component to include safe Shutdown expectations.

Co-authored-by: Alex Boten <alex@boten.ca>
This commit is contained in:
Sean Marciniak 2022-11-16 11:53:52 +10:30 committed by GitHub
parent 032d7ce73f
commit ee05613162
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,10 @@ type Component interface {
// Shutdown is invoked during service shutdown. After Shutdown() is called, if the component
// accepted data in any way, it should not accept it anymore.
//
// This method must be safe to call:
// - without Start() having been called
// - if the component is in a shutdown state already
//
// If there are any background operations running by the component they must be aborted before
// this function returns. Remember that if you started any long-running background operations from
// the Start() method, those operations must be also cancelled. If there are any buffers in the