github.com/vmware/govmomi@v0.51.0/vim25/progress/sinker.go (about) 1 // © Broadcom. All Rights Reserved. 2 // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. 3 // SPDX-License-Identifier: Apache-2.0 4 5 package progress 6 7 // Sinker defines what is expected of a type that can act as a sink for 8 // progress reports. The semantics are as follows. If you call Sink(), you are 9 // responsible for closing the returned channel. Closing this channel means 10 // that the related task is done, or resulted in error. 11 type Sinker interface { 12 Sink() chan<- Report 13 } 14 15 // SinkFunc defines a function that returns a progress report channel. 16 type SinkFunc func() chan<- Report 17 18 // Sink makes the SinkFunc implement the Sinker interface. 19 func (fn SinkFunc) Sink() chan<- Report { 20 return fn() 21 }