parse

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootBlocks = []RootBlock{
	{
		Name:       "server",
		StructType: reflect.TypeOf(server.Config{}),
		Desc:       "The server block configures the HTTP and gRPC server of the launched service(s).",
	},
	{
		Name:       "distributor",
		StructType: reflect.TypeOf(distributor.Config{}),
		Desc:       "The distributor block configures the distributor.",
	},
	{
		Name:       "ingester",
		StructType: reflect.TypeOf(ingester.Config{}),
		Desc:       "The ingester block configures the ingester.",
	},
	{
		Name:       "querier",
		StructType: reflect.TypeOf(querier.Config{}),
		Desc:       "The querier block configures the querier.",
	},
	{
		Name:       "query_frontend",
		StructType: reflect.TypeOf(frontend.Config{}),
		Desc:       "The query_frontend block configures the query-frontend.",
	},
	{
		Name:       "frontend_worker",
		StructType: reflect.TypeOf(worker.Config{}),
		Desc:       "The frontend_worker block configures the frontend-worker.",
	},
	{
		Name:       "query_scheduler",
		StructType: reflect.TypeOf(scheduler.Config{}),
		Desc:       "The query_scheduler block configures the query-scheduler.",
	},
	{
		Name:       "store_gateway",
		StructType: reflect.TypeOf(storegateway.Config{}),
		Desc:       "The store_gateway block configures the store-gateway.",
	},
	{
		Name:       "compactor",
		StructType: reflect.TypeOf(compactor.Config{}),
		Desc:       "The compactor block configures the compactor.",
	},
	{
		Name:       "grpc_client",
		StructType: reflect.TypeOf(grpcclient.Config{}),
		Desc:       "The grpc_client block configures the gRPC client used to communicate between two Pyroscope components.",
	},
	{
		Name:       "memberlist",
		StructType: reflect.TypeOf(memberlist.KVConfig{}),
		Desc:       "The memberlist block configures the Gossip memberlist.",
	},
	{
		Name:       "limits",
		StructType: reflect.TypeOf(validation.Limits{}),
		Desc:       "The limits block configures default and per-tenant limits imposed by components.",
	},
	{
		Name:       "s3_storage_backend",
		StructType: reflect.TypeOf(s3.Config{}),
		Desc:       "The s3_backend block configures the connection to Amazon S3 object storage backend.",
	},
	{
		Name:       "gcs_storage_backend",
		StructType: reflect.TypeOf(gcs.Config{}),
		Desc:       "The gcs_backend block configures the connection to Google Cloud Storage object storage backend.",
	},
	{
		Name:       "azure_storage_backend",
		StructType: reflect.TypeOf(azure.Config{}),
		Desc:       "The azure_storage_backend block configures the connection to Azure object storage backend.",
	},
	{
		Name:       "swift_storage_backend",
		StructType: reflect.TypeOf(swift.Config{}),
		Desc:       "The swift_storage_backend block configures the connection to OpenStack Object Storage (Swift) object storage backend.",
	},
	{
		Name:       "filesystem_storage_backend",
		StructType: reflect.TypeOf(filesystem.Config{}),
		Desc:       "The filesystem_storage_backend block configures the usage of local file system as object storage backend.",
	},
}

RootBlocks is an ordered list of root blocks. The order is the same order that will follow the markdown generation.

Functions

func FindFlagsPrefix

func FindFlagsPrefix(flags []string) []string

func Flags

func Flags(cfg flagext.Registerer, logger log.Logger) map[uintptr]*flag.Flag

func ReflectType

func ReflectType(typ string) reflect.Type

Types

type ConfigBlock

type ConfigBlock struct {
	Name          string
	Desc          string
	Entries       []*ConfigEntry
	FlagsPrefix   string
	FlagsPrefixes []string
}

func Config

func Config(cfg interface{}, flags map[uintptr]*flag.Flag, rootBlocks []RootBlock) ([]*ConfigBlock, error)

Config returns a slice of ConfigBlocks. The first ConfigBlock is a recursively expanded cfg. The remaining entries in the slice are all (root or not) ConfigBlocks.

func (*ConfigBlock) Add

func (b *ConfigBlock) Add(entry *ConfigEntry)

type ConfigEntry

type ConfigEntry struct {
	Kind     EntryKind
	Name     string
	Required bool

	// In case the Kind is KindBlock
	Block     *ConfigBlock
	BlockDesc string
	Root      bool

	// In case the Kind is KindField
	FieldFlag     string
	FieldDesc     string
	FieldType     string
	FieldDefault  string
	FieldExample  *FieldExample
	FieldCategory string

	// In case the Kind is KindMap or KindSlice
	Element *ConfigBlock
}

func (ConfigEntry) Description

func (e ConfigEntry) Description() string

type EntryKind

type EntryKind string
const (
	KindBlock EntryKind = "block"
	KindField EntryKind = "field"
	KindSlice EntryKind = "slice"
	KindMap   EntryKind = "map"
)

type ExamplerConfig

type ExamplerConfig interface {
	ExampleDoc() (comment string, yaml interface{})
}

ExamplerConfig can be implemented by configs to provide examples. If string is non-empty, it will be added as comment. If yaml value is non-empty, it will be marshaled as yaml under the same key as it would appear in config.

type FieldExample

type FieldExample struct {
	Comment string
	Yaml    interface{}
}

type RootBlock

type RootBlock struct {
	Name       string
	Desc       string
	StructType reflect.Type
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL