Andrey Smirnov b58f567a13
refactor: optimize Runtime config interface to avoid config marshaling
This refactors the API to avoid marshaling/unmarshaling config in the
most common scenario: when config is loaded from disk and applied to be
used.

There should be no functional changes.

This reduces GC garbage left from the YAML encoding procedure.

Fixes #4685

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2021-12-15 17:33:09 +03:00

22 lines
606 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package runtime
import (
"github.com/talos-systems/talos/pkg/machinery/config"
)
// Runtime defines the runtime parameters.
type Runtime interface {
Config() config.Provider
LoadAndValidateConfig([]byte) (config.Provider, error)
SetConfig(config.Provider) error
CanApplyImmediate(config.Provider) error
State() State
Events() EventStream
Logging() LoggingManager
NodeName() (string, error)
}