Documentation ¶
Index ¶
- type Cache
- type Category
- type CategoryEngineRanking
- type CategoryRanking
- type CategoryTimings
- type Config
- type DynamoDB
- type Exchange
- type ExchangeTimings
- type ImageProxy
- type ReaderCache
- type ReaderCategory
- type ReaderCategoryEngine
- type ReaderCategoryTimings
- type ReaderConfig
- type ReaderExchange
- type ReaderExchangeEngine
- type ReaderExchangeTimings
- type ReaderImageProxy
- type ReaderServer
- type ReaderTTL
- type Redis
- type Server
- type TTL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CategoryEngineRanking ¶
type CategoryRanking ¶
type CategoryRanking struct { REXP float64 `koanf:"rexp"` A float64 `koanf:"a"` B float64 `koanf:"b"` C float64 `koanf:"c"` D float64 `koanf:"d"` TRA float64 `koanf:"tra"` TRB float64 `koanf:"trb"` TRC float64 `koanf:"trc"` TRD float64 `koanf:"trd"` Engines map[string]CategoryEngineRanking `koanf:"engines"` }
func EmptyRanking ¶
func EmptyRanking(engs []engines.Name) CategoryRanking
func ReqPrefOthRanking ¶ added in v0.29.0
type CategoryTimings ¶
type CategoryTimings struct { // Maximum amount of time to wait for the PreferredEngines (or ByOrigin) to respond. // If the search is still waiting for the RequiredEngines (or ByOrigin) after this time, the search will continue. PreferredTimeout time.Duration // Hard timeout after which the search is forcefully stopped (even if the engines didn't respond). HardTimeout time.Duration // Colly delay. Delay time.Duration // Colly random delay. RandomDelay time.Duration // Colly parallelism. Parallelism int }
Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit().
type Exchange ¶ added in v0.26.0
type Exchange struct { BaseCurrency currency.Currency Engines []engines.Name Timings ExchangeTimings }
type ExchangeTimings ¶ added in v0.26.0
type ImageProxy ¶
type ReaderCache ¶
type ReaderCache struct { // Can be "none", "redis" or "dynamodb". Type string `koanf:"type"` // Prefix to use for cache keys. KeyPrefix string `koanf:"keyprefix"` // Has no effect if type is "none". TTL ReaderTTL `koanf:"ttl"` // Redis specific settings. Redis Redis `koanf:"redis"` // DynamoDB specific settings. DynamoDB DynamoDB `koanf:"dynamodb"` }
ReaderCache is format in which the config is read from the config file and environment variables.
type ReaderCategory ¶
type ReaderCategory struct { REngines map[string]ReaderCategoryEngine `koanf:"engines"` Ranking CategoryRanking `koanf:"ranking"` RTimings ReaderCategoryTimings `koanf:"timings"` }
ReaderCategory is format in which the config is read from the config file and environment variables.
type ReaderCategoryEngine ¶
type ReaderCategoryEngine struct { // If false, the engine will not be used and other options will be ignored. Enabled bool `koanf:"enabled"` // If true, the engine will be awaited unless the hard timeout is reached. Required bool `koanf:"required"` // If true, the fastest engine that has this engine in "Origins" will be awaited unless the hard timeout is reached. // This means that we want to get results from this engine or any engine that has this engine in "Origins", whichever responds the fastest. RequiredByOrigin bool `koanf:"requiredbyorigin"` // If true, the engine will be awaited unless the preferred timeout is reached. Preferred bool `koanf:"preferred"` // If true, the fastest engine that has this engine in "Origins" will be awaited unless the preferred timeout is reached. // This means that we want to get results from this engine or any engine that has this engine in "Origins", whichever responds the fastest. PreferredByOrigin bool `koanf:"preferredbyorigin"` }
ReaderEngine is format in which the config is read from the config file and environment variables.
type ReaderCategoryTimings ¶
type ReaderCategoryTimings struct { // Maximum amount of time to wait for the PreferredEngines (or ByOrigin) to respond. // If the search is still waiting for the RequiredEngines (or ByOrigin) after this time, the search will continue. PreferredTimeout string `koanf:"preferredtimeout"` // Hard timeout after which the search is forcefully stopped (even if the engines didn't respond). HardTimeout string `koanf:"hardtimeout"` // Colly delay. Delay string `koanf:"delay"` // Colly random delay. RandomDelay string `koanf:"randomdelay"` // Colly parallelism. Parallelism int `koanf:"parallelism"` }
ReaderTimings is format in which the config is read from the config file and environment variables. In <number><unit> format. Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y. If unit is not specified, it is assumed to be milliseconds. Delegates Delay, RandomDelay, Parallelism to colly.Collector.Limit().
type ReaderConfig ¶
type ReaderConfig struct { Server ReaderServer `koanf:"server"` RCategories map[category.Name]ReaderCategory `koanf:"categories"` RExchange ReaderExchange `koanf:"exchange"` }
ReaderConfig is format in which the config is read from the config file and environment variables.
type ReaderExchange ¶ added in v0.26.0
type ReaderExchange struct { BaseCurrency string `koanf:"basecurrency"` REngines map[string]ReaderExchangeEngine `koanf:"engines"` RTimings ReaderExchangeTimings `koanf:"timings"` }
ReaderCategory is format in which the config is read from the config file and environment variables.
type ReaderExchangeEngine ¶ added in v0.26.0
type ReaderExchangeEngine struct { // If false, the engine will not be used. Enabled bool `koanf:"enabled"` }
ReaderEngine is format in which the config is read from the config file and environment variables.
type ReaderExchangeTimings ¶ added in v0.26.0
type ReaderExchangeTimings struct { // Hard timeout after which the search is forcefully stopped (even if the engines didn't respond). HardTimeout string `koanf:"hardtimeout"` }
ReaderTimings is format in which the config is read from the config file and environment variables. In <number><unit> format. Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y. If unit is not specified, it is assumed to be milliseconds.
type ReaderImageProxy ¶
type ReaderImageProxy struct { SecretKey string `koanf:"secretkey"` Timeout string `koanf:"timeout"` }
ReaderProxy is format in which the config is read from the config file and environment variables. In <number><unit> format. Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y. If unit is not specified, it is assumed to be milliseconds.
type ReaderServer ¶
type ReaderServer struct { // Environment in which the server is running (normal or lambda). Environment string `koanf:"environment"` // Port on which the API server listens. Port int `koanf:"port"` // URLs used for CORS (wildcards allowed). // Comma separated. FrontendUrls string `koanf:"frontendurls"` // Cache settings. Cache ReaderCache `koanf:"cache"` // Image proxy settings. ImageProxy ReaderImageProxy `koanf:"imageproxy"` }
ReaderServer is format in which the config is read from the config file and environment variables.
type ReaderTTL ¶
type ReaderTTL struct { // How long to store the currencies in cache. // Setting this to 0 caches the currencies forever. Currencies string `koanf:"currencies"` }
ReaderTTL is format in which the config is read from the config file and environment variables. In <number><unit> format. Example: 1s, 1m, 1h, 1d, 1w, 1M, 1y. If unit is not specified, it is assumed to be milliseconds.
type Server ¶
type Server struct { // Environment in which the server is running (normal or lambda). Environment string // Port on which the API server listens. Port int // URLs used for CORS (wildcards allowed). FrontendUrls []string // Cache settings. Cache Cache // Image proxy settings. ImageProxy ImageProxy }