Documentation
¶
Overview ¶
Copyright 2019 Gravitational, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProgressReporter ¶
func NewProgressReporter(ctx context.Context, dispatcher EventDispatcher, title string) utils.Progress
NewProgressReporter creates a new progress reporter using the specified dispatcher disp as output sink
Types ¶
type Event ¶
type Event struct { // Progress describes the operation progress Progress *ops.ProgressEntry // Error specifies the error if any Error error // Completed indicates whether this event is terminal Status Status }
Event describes the installer progress step
func (*Event) AsProgressResponse ¶
func (r *Event) AsProgressResponse() *installpb.ProgressResponse
AsProgressResponse translates this event to proto format
func (Event) IsCompleted ¶
IsCompleted determines if this event indicates a completed operation event
type EventDispatcher ¶
type EventDispatcher interface { // Send sends the specified event to the client Send(Event) // Close stops the dispatcher and release its resources. // It is an error to invoke Send after Close Close() // Chan returns the channel that receives events. // Close closes this channel Chan() <-chan *installpb.ProgressResponse }
EventDispatcher dispatches progress events to clients
type EventWriter ¶
type EventWriter struct {
EventDispatcher
}
EventWriter is an event dispatcher that can be used as an output sink for progress reporter. Implements io.Writer.
func NewWriter ¶
func NewWriter(dispatcher EventDispatcher) *EventWriter
NewWriter creates a new event writer that can be used as a progress output sink
type Status ¶
type Status byte
Status defines the progress status
func (Status) IsCompleted ¶
IsCompleted returns true if this status indicates completion
Directories
¶
Path | Synopsis |
---|---|
package buffered implements an event dispatcher with buffering semantics
|
package buffered implements an event dispatcher with buffering semantics |
package direct implements a synchronous event dispatcher
|
package direct implements a synchronous event dispatcher |
internal
|
|