config

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

package config contains information needed to run gnmatcher project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// WorkDir is the main directory for gnmatcher files. It contains
	// bloom filters levenshtein automata trees, key-value stores etc.
	WorkDir string
	// MaxEditDist is the maximal allowed edit distance for levenshtein automata.
	// The number cannot exceed 2, default number is 1. The speed of execution
	// slows down dramatically with the MaxEditDist > 1.
	MaxEditDist int
	// JobsNum is the number of jobs to run in parallel
	JobsNum int
	// PgHost is a hostname for the PostgreSQL server.
	PgHost string
	// PgPort is the port of PostgreSQL server.
	PgPort int
	// PgUser is the user for the database.
	PgUser string
	// PgPass password to access PostgreSQL server.
	PgPass string
	// PgDB the database name where gnames data is located.
	PgDB string
}

Config collects and stores external configuration data.

func NewConfig

func NewConfig(opts ...Option) Config

NewConfig is a Config constructor that takes external options to update default values to external ones.

func (Config) FiltersDir

func (cfg Config) FiltersDir() string

FiltersDir returns path where to dump/restore serialized bloom filters.

func (Config) StemsDir

func (cfg Config) StemsDir() string

StemsDir returns path where stems key-value store is located

func (Config) TrieDir

func (cfg Config) TrieDir() string

TrieDir returns path where to dump/restore serialized trie.

type Option

type Option func(cfg *Config)

Option is a type of all options for Config.

func OptJobsNum

func OptJobsNum(i int) Option

OptJobsNum sets the number of jobs to run in parallel

func OptMaxEditDist

func OptMaxEditDist(i int) Option

OptMaxEditDist sets maximal possible edit distance for fuzzy matching of stemmed canonical forms.

func OptPgDB

func OptPgDB(s string) Option

OptPgDB sets the name of gnames database

func OptPgHost

func OptPgHost(s string) Option

OptPgHost sets the host of gnames database

func OptPgPass

func OptPgPass(s string) Option

OptPgPass sets the password to access gnnames database

func OptPgPort

func OptPgPort(i int) Option

OptPgPort sets the port for gnames database

func OptPgUser

func OptPgUser(s string) Option

OptPgUser sets the user of gnnames database

func OptWorkDir

func OptWorkDir(s string) Option

OptWorkDir sets a directory for key-value stores and temporary files.

Jump to

Keyboard shortcuts

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