config

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CollectionInterval is the interval at which data is collected to upload.
	CollectionInterval = 33 * time.Second

	// HeartbeatInterval is the interval at which the heartbeat is sent.
	HeartbeatInterval = 60 * time.Second

	// RefreshRemoteConfigInterval is the interval at which the remote config is refreshed.
	RefreshRemoteConfigInterval = 60 * time.Second

	// TaskCheckInterval is the interval at which the task is checked.
	TaskCheckInterval = 60 * time.Second

	// ReloadRulesInterval is the interval at which the rules are reloaded.
	ReloadRulesInterval = 60 * time.Second

	// RuleCheckListenFilesInterval is the periodic interval to listen for files to be processed.
	RuleCheckListenFilesInterval = 23 * time.Second

	// RuleScanCollectInfosInterval is the interval at which the rule is scanned to collect infos.
	RuleScanCollectInfosInterval = 27 * time.Second

	// DeviceAuthCheckInterval is the interval at which the device is checked for authorization.
	DeviceAuthCheckInterval = 60 * time.Second
)
View Source
const (
	LocalFilePrefix  = "file://"
	RemoteFilePrefix = "cos://"
)

Variables

This section is empty.

Functions

func GetCollectInfoFolder

func GetCollectInfoFolder() string

func GetDBPath

func GetDBPath() string

func GetRecordCacheFolder

func GetRecordCacheFolder() string

func GetUserBaseFolder

func GetUserBaseFolder() string

Types

type ApiConfig

type ApiConfig struct {
	ServerURL   string `koanf:"server_url"   yaml:"server_url" json:"server_url"`
	ProjectSlug string `koanf:"project_slug" yaml:"project_slug" json:"project_slug"`
	OrgSlug     string `koanf:"org_slug"     yaml:"org_slug" json:"org_slug"`
	Insecure    bool   `koanf:"insecure"     yaml:"insecure" json:"insecure"`
}

type AppConfig

type AppConfig struct {
	Api ApiConfig `koanf:"api" yaml:"api" json:"api"`

	// Collector CollectorConfig `yaml:"collector"`
	Collector CollectorConfig `koanf:"collector" yaml:"collector" json:"collector"`

	// Device DeviceConfig `yaml:"device"`
	Device DeviceConfig `koanf:"device" yaml:"device" json:"device"`

	// Topics []string `yaml:"topics"`
	Topics []string `koanf:"topics" yaml:"topics" json:"topics"`

	// Register RegisterConfig `yaml:"register"`
	Register RegisterConfig `koanf:"register" yaml:"register" json:"register"`

	// Mod config
	Mod ModConfConfig `koanf:"mod" yaml:"mod" json:"mod"`

	// HttpServer HttpServerConfig `yaml:"http_server"`
	HttpServer HttpServerConfig `koanf:"http_server" yaml:"http_server" json:"http_server"`

	// PluginConfig other coscene plugin config, such as coEncoder..., which is not cos's config
	PluginConfig interface{} `koanf:"plugin_config" yaml:"plugin_config" json:"plugin_config"`

	// Upload
	Upload UploadConfig `koanf:"upload" yaml:"upload" json:"upload"`

	// import other config
	Import []string `koanf:"__import__" yaml:"__import__" json:"__import__"`
}

type CollectorConfig

type CollectorConfig struct {
	DeleteAfterIntervalInHours int  `koanf:"delete_after_interval_in_hours" yaml:"delete_after_interval_in_hours" json:"delete_after_interval_in_hours"`
	SkipCheckSameFile          bool `koanf:"skip_check_same_file" yaml:"skip_check_same_file" json:"skip_check_same_file"`
}

type ConfManager

type ConfManager struct {
	// contains filtered or unexported fields
}

func InitConfManager

func InitConfManager(cfg string, s *storage.Storage) *ConfManager

func (ConfManager) GetStorage

func (c ConfManager) GetStorage() *storage.Storage

func (ConfManager) LoadOnce

func (c ConfManager) LoadOnce() AppConfig

func (ConfManager) LoadWithRemote

func (c ConfManager) LoadWithRemote() *AppConfig

func (ConfManager) SetRemote

func (c ConfManager) SetRemote(key string, value string)

type DefaultModConfConfig

type DefaultModConfConfig struct {
	ListenDirs            []string `koanf:"listen_dirs" yaml:"listen_dirs" json:"listen_dirs"`
	CollectDirs           []string `koanf:"collect_dirs" yaml:"collect_dirs" json:"collect_dirs"`
	Ros2CustomizedMsgDirs []string `koanf:"ros2_customized_msgs_dirs" yaml:"ros2_customized_msgs_dirs" json:"ros2_customized_msgs_dirs"`
	UploadFiles           []string `koanf:"upload_files" yaml:"upload_files" json:"upload_files"`
	SkipPeriodHours       int      `koanf:"skip_period_hours" yaml:"skip_period_hours" json:"skip_period_hours"`
	RecursivelyWalkDirs   bool     `koanf:"recursively_walk_dirs" yaml:"recursively_walk_dirs" json:"recursively_walk_dirs"`
}

type DeviceConfig

type DeviceConfig struct {
	ExtraFiles []string `koanf:"extra_files" yaml:"extra_files" json:"extra_files"`
}

type FileModRegisterConfig

type FileModRegisterConfig struct {
	SnFile  string `koanf:"sn_file"  yaml:"sn_file" json:"sn_file"`
	SnField string `koanf:"sn_field" yaml:"sn_field" json:"sn_field"`
}

type HttpServerConfig

type HttpServerConfig struct {
	Port int `koanf:"port" yaml:"port" json:"port"`
}

type ModConfConfig

type ModConfConfig struct {
	Name   string      `koanf:"name" yaml:"name" json:"name"`
	Config interface{} `koanf:"conf" yaml:"conf" json:"conf"`
}

type NetworkRule added in v1.1.9

type NetworkRule struct {
	Enabled         bool     `koanf:"enabled" yaml:"enabled" json:"enabled"`
	BlackInterfaces []string `koanf:"black_interfaces" yaml:"black_interfaces" json:"black_interfaces"`
	Server          string   `koanf:"server" yaml:"server" json:"server"`
}

type RegisterConfig

type RegisterConfig struct {
	Provider string      `koanf:"type"   yaml:"type" json:"type"`
	Conf     interface{} `koanf:"config" yaml:"config" json:"config"`
}

type UploadConfig added in v1.1.9

type UploadConfig struct {
	NetworkRule NetworkRule `koanf:"network_rule" yaml:"network_rule" json:"network_rule"`
}

Jump to

Keyboard shortcuts

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