mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
This is a first step to make it accept configuration. Most of the changes are quite trivial, but I also ran into some difficulties with query columns and filters. They need the schema for parsing, but parsing happens before dependencies are instantiated (and even if it was not the case, parsing is stateless). Therefore, I have added a `Validate()` method that must be called after instantiation. Various bits `panic()` if not validated to ensure we catch all cases. The alternative to make the component manages a global state would have been simpler but it would break once we add the ability to add or disable columns.
20 lines
495 B
Go
20 lines
495 B
Go
// SPDX-FileCopyrightText: 2023 Free Mobile
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
// Package schema is an abstraction of the data schema for flows used by
|
|
// Akvorado. It is a leaky abstraction as there are multiple parts dependant of
|
|
// the subsystem that will use it.
|
|
package schema
|
|
|
|
// Component represents the schema compomenent.
|
|
type Component struct {
|
|
Schema
|
|
}
|
|
|
|
// New creates a new schema component.
|
|
func New() (*Component, error) {
|
|
return &Component{
|
|
Schema: flows(),
|
|
}, nil
|
|
}
|