Merge pull request #407 from pulumi/ReceiveOnlyEvents
Narrow event channel types.
This commit is contained in:
commit
9a685fcf0f
|
@ -71,7 +71,7 @@ func setCurrentEnv(name tokens.QName, verify bool) error {
|
|||
// displayEvents reads events from the `events` channel until it is closed, displaying each event as it comes in.
|
||||
// Once all events have been read from the channel and displayed, it closes the `done` channel so the caller can
|
||||
// await all the events being written.
|
||||
func displayEvents(events chan engine.Event, done chan bool, debug bool) {
|
||||
func displayEvents(events <-chan engine.Event, done chan bool, debug bool) {
|
||||
defer close(done)
|
||||
|
||||
for event := range events {
|
||||
|
|
|
@ -29,7 +29,7 @@ type DeployOptions struct {
|
|||
Summary bool // true if we should only summarize resources and operations.
|
||||
}
|
||||
|
||||
func (eng *Engine) Deploy(environment tokens.QName, events chan Event, opts DeployOptions) error {
|
||||
func (eng *Engine) Deploy(environment tokens.QName, events chan<- Event, opts DeployOptions) error {
|
||||
contract.Require(environment != tokens.QName(""), "environment")
|
||||
contract.Require(events != nil, "events")
|
||||
|
||||
|
@ -59,18 +59,18 @@ func (eng *Engine) Deploy(environment tokens.QName, events chan Event, opts Depl
|
|||
}
|
||||
|
||||
type deployOptions struct {
|
||||
Create bool // true if we are creating resources.
|
||||
Destroy bool // true if we are destroying the environment.
|
||||
DryRun bool // true if we should just print the plan without performing it.
|
||||
Analyzers []string // an optional set of analyzers to run as part of this deployment.
|
||||
Parallel int // the degree of parallelism for resource operations (<=1 for serial).
|
||||
ShowConfig bool // true to show the configuration variables being used.
|
||||
ShowReplacementSteps bool // true to show the replacement steps in the plan.
|
||||
ShowSames bool // true to show the resources that aren't updated, in addition to those that are.
|
||||
Summary bool // true if we should only summarize resources and operations.
|
||||
DOT bool // true if we should print the DOT file for this plan.
|
||||
Events chan Event // the channel to write events from the engine to.
|
||||
Diag diag.Sink // the sink to use for diag'ing.
|
||||
Create bool // true if we are creating resources.
|
||||
Destroy bool // true if we are destroying the environment.
|
||||
DryRun bool // true if we should just print the plan without performing it.
|
||||
Analyzers []string // an optional set of analyzers to run as part of this deployment.
|
||||
Parallel int // the degree of parallelism for resource operations (<=1 for serial).
|
||||
ShowConfig bool // true to show the configuration variables being used.
|
||||
ShowReplacementSteps bool // true to show the replacement steps in the plan.
|
||||
ShowSames bool // true to show the resources that aren't updated, in addition to those that are.
|
||||
Summary bool // true if we should only summarize resources and operations.
|
||||
DOT bool // true if we should print the DOT file for this plan.
|
||||
Events chan<- Event // the channel to write events from the engine to.
|
||||
Diag diag.Sink // the sink to use for diag'ing.
|
||||
}
|
||||
|
||||
func (eng *Engine) deployLatest(info *planContext, opts deployOptions) error {
|
||||
|
|
|
@ -15,7 +15,7 @@ type DestroyOptions struct {
|
|||
Summary bool
|
||||
}
|
||||
|
||||
func (eng *Engine) Destroy(environment tokens.QName, events chan Event, opts DestroyOptions) error {
|
||||
func (eng *Engine) Destroy(environment tokens.QName, events chan<- Event, opts DestroyOptions) error {
|
||||
contract.Require(environment != tokens.QName(""), "environment")
|
||||
|
||||
info, err := eng.planContextFromEnvironment(environment, opts.Package)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/pulumi/pulumi/pkg/util/contract"
|
||||
)
|
||||
|
||||
func newEventSink(events chan Event, opts diag.FormatOptions) diag.Sink {
|
||||
func newEventSink(events chan<- Event, opts diag.FormatOptions) diag.Sink {
|
||||
contract.Require(events != nil, "events")
|
||||
|
||||
return &eventSink{
|
||||
|
@ -28,7 +28,7 @@ const eventSinkIDPrefix = "PU"
|
|||
|
||||
// eventSink is a sink which writes all events to a channel
|
||||
type eventSink struct {
|
||||
events chan Event // the channel to emit events into.
|
||||
events chan<- Event // the channel to emit events into.
|
||||
opts diag.FormatOptions // a set of options that control output style and content.
|
||||
counts map[diag.Severity]int // the number of messages that have been issued per severity.
|
||||
mutex sync.RWMutex // a mutex for guarding updates to the counts map
|
||||
|
|
|
@ -19,7 +19,7 @@ type PreviewOptions struct {
|
|||
Summary bool // true if we should only summarize resources and operations.
|
||||
}
|
||||
|
||||
func (eng *Engine) Preview(environment tokens.QName, events chan Event, opts PreviewOptions) error {
|
||||
func (eng *Engine) Preview(environment tokens.QName, events chan<- Event, opts PreviewOptions) error {
|
||||
contract.Require(environment != tokens.QName(""), "environment")
|
||||
contract.Require(events != nil, "events")
|
||||
|
||||
|
|
Loading…
Reference in a new issue