config

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureExists

func EnsureExists(path string) error

Types

type AsynqWorkerConfig added in v0.10.0

type AsynqWorkerConfig struct {
	RedisConfig  RedisConfig
	WorkerConfig WorkerConfig
}

type Conf

type Conf struct {
	config.Common
	Client     config.Client
	Chainstore config.Chainstore
	Storage    StorageConf
	Queue      QueueConfig
}

Conf defines the daemon config. It should be compatible with Lotus config.

func DefaultConf

func DefaultConf() *Conf

func FromFile

func FromFile(path string) (*Conf, error)

FromFile loads config from a specified file. If file does not exist or is empty defaults are assumed.

func FromReader

func FromReader(reader io.Reader, def *Conf) (*Conf, error)

FromReader loads config from a reader instance.

func SampleConf

func SampleConf() *Conf

SampleConf is the example configuration that is written when lily is first started. All entries will be commented out.

type FileStorageConf

type FileStorageConf struct {
	Format      string
	Path        string
	OmitHeader  bool   // when true, don't write column headers to new output files
	FilePattern string // pattern to use for filenames written in the path specified
}

type PgStorageConf

type PgStorageConf struct {
	URLEnv          string // name of an environment variable that contains the database URL
	URL             string // URL used to connect to postgresql if URLEnv is not set
	ApplicationName string
	SchemaName      string
	PoolSize        int
	AllowUpsert     bool
}

type QueueConfig added in v0.10.0

type QueueConfig struct {
	Workers   map[string]AsynqWorkerConfig
	Notifiers map[string]RedisConfig
}

type RedisConfig added in v0.10.0

type RedisConfig struct {
	// Network type to use, either tcp or unix.
	// Default is tcp.
	Network string

	// Redis server address in "host:port" format.
	Addr    string
	AddrEnv string

	// Username to authenticate the current connection when Redis ACLs are used.
	// See: https://redis.io/commands/auth.
	Username    string
	UsernameEnv string

	// Password to authenticate the current connection.
	// See: https://redis.io/commands/auth.
	Password    string
	PasswordEnv string

	// Redis DB to select after connecting to a server.
	// See: https://redis.io/commands/select.
	DB int

	// Maximum number of socket connections.
	// Default is 10 connections per every CPU as reported by runtime.NumCPU.
	PoolSize int
}

type StorageConf

type StorageConf struct {
	Postgresql map[string]PgStorageConf
	File       map[string]FileStorageConf
}

type WorkerConfig added in v0.10.0

type WorkerConfig struct {
	// Maximum number of concurrent processing of tasks.
	//
	// If set to a zero or negative value, NewServer will overwrite the value
	// to the number of CPUs usable by the current process.
	Concurrency int

	// LogLevel specifies the minimum log level to enable.
	//
	// If unset, InfoLevel is used by default.
	LoggerLevel string

	// Priority is treated as follows to avoid starving low priority queues.
	//
	// Example:
	//
	//	 WatchQueuePriority: 	5
	//	 FillQueuePriority:		3
	//	 IndexQueuePriority:	1
	//	 WalkQueuePriority: 	1
	//
	// With the above config and given that all queues are not empty, the tasks
	// in "watch", "fill", "index", "walk" should be processed 50%, 30%, 10%, 10% of
	// the time respectively.
	WatchQueuePriority int
	FillQueuePriority  int
	IndexQueuePriority int
	WalkQueuePriority  int

	// StrictPriority indicates whether the queue priority should be treated strictly.
	//
	// If set to true, tasks in the queue with the highest priority is processed first.
	// The tasks in lower priority queues are processed only when those queues with
	// higher priorities are empty.
	StrictPriority bool

	// ShutdownTimeout specifies the duration to wait to let workers finish their tasks
	// before forcing them to abort when stopping the server.
	//
	// If unset or zero, default timeout of 8 seconds is used.
	ShutdownTimeout time.Duration
}

func (WorkerConfig) LogLevel added in v0.10.0

func (q WorkerConfig) LogLevel() asynq.LogLevel

func (WorkerConfig) Queues added in v0.10.0

func (q WorkerConfig) Queues() map[string]int

Jump to

Keyboard shortcuts

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