config

package
v0.0.0-...-20c3865 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2016 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MappingNotAnalyzedKey is the key for the patterns to exclude from
	// Elastic Search analysis.
	MappingNotAnalyzedKey = "not_analyzed"

	// DefaultEventSet is the name of the default set of events to subscribe
	// to. This is the name of set that will be used if it is left unspecified
	// for a given repository.
	//
	// The set doesn't have to exist for a configuration to be valid as long as
	// every repository explicitely refers to a valid event set.
	DefaultEventSet = "default"
)
View Source
const (
	GitHubTypeIssue         = "issue"
	GitHubTypePullRequest   = "pull_request"
	SnapshotIssueType       = "snapshot_issue"
	SnapshotPullRequestType = "snapshot_pull_request"
)
View Source
const (
	// MetadataType is the key for the type metadata attribute used when
	// storing a Blob instance into the Elastic Search backend.
	MetadataType = "_type"

	// MetadataSnapshotID is the key for the snapshot id metadata attribute
	// used when storing a Blob instance into the Elastic Search backend. It
	// represents the Id to be used when storing the snapshoted content of a
	// blob.
	MetadataSnapshotID = "_snapshot_id"

	// MetadataSnapshotField is the key for the snapshot id metadata attribute
	// used when storing a Blob instance into the Elastic Search backend. It
	// represents the nested object to be used when storing the snapshoted
	// content of a blob.
	MetadataSnapshotField = "_snapshot_field"
)
View Source
const (
	SyncHourly = "hourly"
	SyncDaily  = "daily"
	SyncWeekly = "weekly"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NSQConfig

type NSQConfig struct {
	Topic   string `json:"topic"`
	Channel string `json:"channel"`
	Lookupd string `json:"lookup_address"`
}

NSQConfig is the configuration for NSQ.

type PeriodicSync

type PeriodicSync string

func NewPeriodicSync

func NewPeriodicSync(v string) (PeriodicSync, error)

func (PeriodicSync) IsValid

func (p PeriodicSync) IsValid() bool

func (PeriodicSync) Next

func (p PeriodicSync) Next() time.Duration

Next calculates the time until the next full synchronization. We could argue that this would be better achived with cron: I'd like the app to know about that frequency, it makes the whole event persistence easier.

If the process is stopped, we will miss some ticks, and we won't try to catch up: I have no idea if this is going to be a problem later down to the road when querying.

type RepositoryConfig

type RepositoryConfig struct {
	User       string
	Repo       string
	Topic      string
	StartIndex int `toml:"start_index"`
	// contains filtered or unexported fields
}

RepositoryConfig is the configuration for a given repository.

func (RepositoryConfig) EventSetName

func (r RepositoryConfig) EventSetName() string

EventSetName returns the name of subscribed events set for the repository.

type SerializedConfig

type SerializedConfig struct {
	ElasticSearch   string
	GitHubAPIToken  string `toml:"github_api_token"`
	PeriodicSync    string `toml:"sync_periodicity"`
	NSQ             NSQConfig
	Functions       map[string]string
	Mapping         map[string][]string
	Repositories    map[string]RepositoryConfig
	EventSet        SerializedTable `toml:"event_set"`
	Transformations SerializedTable
}

SerializedConfig is the serialized version of the configuration.

func ParseRawConfiguration

func ParseRawConfiguration(filename string) (*SerializedConfig, error)

type SerializedTable

type SerializedTable map[string]map[string]string

Jump to

Keyboard shortcuts

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