Skip to content

Commit

Permalink
js/modules: Drop HasModuleInstancePerVU interface
Browse files Browse the repository at this point in the history
The new modules API made this API not required anymore. Both internal
and external modules can now use the same unique way for accessing the VU State.
  • Loading branch information
codebien committed Feb 11, 2022
1 parent ebf05cf commit d1861e0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
3 changes: 0 additions & 3 deletions js/initcontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ func (i *InitContext) requireModule(name string) (goja.Value, error) {
instance := m.NewModuleInstance(i.moduleVUImpl)
return i.moduleVUImpl.runtime.ToValue(toESModuleExports(instance.Exports())), nil
}
if perInstance, ok := mod.(modules.HasModuleInstancePerVU); ok {
mod = perInstance.NewModuleInstancePerVU()
}

onceBindWarning.Do(func() {
i.logger.Warnf(`Module '%s' is using deprecated APIs that will be removed in k6 v0.38.0,`+
Expand Down
7 changes: 0 additions & 7 deletions js/modules/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ func Register(name string, mod interface{}) {
modules[name] = mod
}

// HasModuleInstancePerVU should be implemented by all native Golang modules that
// would require per-VU state. k6 will call their NewModuleInstancePerVU() methods
// every time a VU imports the module and use its result as the returned object.
type HasModuleInstancePerVU interface {
NewModuleInstancePerVU() interface{}
}

// Module is the interface js modules should implement in order to get access to the VU
type Module interface {
// NewModuleInstance will get modules.VU that should provide the module with a way to interact with the VU
Expand Down

0 comments on commit d1861e0

Please sign in to comment.