2024-02-08 03:48:59 -06:00
|
|
|
// Copyright (c) The OpenTofu Authors
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
2023-05-02 10:33:06 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-01-08 20:39:14 -06:00
|
|
|
package initwd
|
2019-01-08 18:21:31 -06:00
|
|
|
|
|
|
|
import (
|
|
|
|
version "github.com/hashicorp/go-version"
|
|
|
|
)
|
|
|
|
|
2019-01-08 20:39:14 -06:00
|
|
|
// ModuleInstallHooks is an interface used to provide notifications about the
|
2019-01-08 18:21:31 -06:00
|
|
|
// installation process being orchestrated by InstallModules.
|
|
|
|
//
|
|
|
|
// This interface may have new methods added in future, so implementers should
|
|
|
|
// embed InstallHooksImpl to get no-op implementations of any unimplemented
|
|
|
|
// methods.
|
2019-01-08 20:39:14 -06:00
|
|
|
type ModuleInstallHooks interface {
|
2019-01-08 18:21:31 -06:00
|
|
|
// Download is called for modules that are retrieved from a remote source
|
|
|
|
// before that download begins, to allow a caller to give feedback
|
|
|
|
// on progress through a possibly-long sequence of downloads.
|
|
|
|
Download(moduleAddr, packageAddr string, version *version.Version)
|
|
|
|
|
|
|
|
// Install is called for each module that is installed, even if it did
|
|
|
|
// not need to be downloaded from a remote source.
|
|
|
|
Install(moduleAddr string, version *version.Version, localPath string)
|
|
|
|
}
|
|
|
|
|
2019-01-08 20:39:14 -06:00
|
|
|
// ModuleInstallHooksImpl is a do-nothing implementation of InstallHooks that
|
2019-01-08 18:21:31 -06:00
|
|
|
// can be embedded in another implementation struct to allow only partial
|
|
|
|
// implementation of the interface.
|
2019-01-08 20:39:14 -06:00
|
|
|
type ModuleInstallHooksImpl struct {
|
2019-01-08 18:21:31 -06:00
|
|
|
}
|
|
|
|
|
2019-01-08 20:39:14 -06:00
|
|
|
func (h ModuleInstallHooksImpl) Download(moduleAddr, packageAddr string, version *version.Version) {
|
2019-01-08 18:21:31 -06:00
|
|
|
}
|
|
|
|
|
2019-01-08 20:39:14 -06:00
|
|
|
func (h ModuleInstallHooksImpl) Install(moduleAddr string, version *version.Version, localPath string) {
|
2019-01-08 18:21:31 -06:00
|
|
|
}
|
|
|
|
|
2019-01-08 20:39:14 -06:00
|
|
|
var _ ModuleInstallHooks = ModuleInstallHooksImpl{}
|