process

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeApp

func MakeApp(process Process) *cli.App

MakeApp return cli.App corresponding for given Process

Types

type Feature added in v0.11.0

type Feature int

Feature represent a process feature

const (

	// EventFeature is the feature to plug the process to the event server
	EventFeature Feature = iota
	// ConfigFeature is the feature to plug the process to the ConfigAPI framework
	ConfigFeature
	// CacheFeature is the feature to plug the process to the cache server
	CacheFeature
	// CrawlingFeature is the feature to plug the process with a tor-compatible HTTP client
	CrawlingFeature

	// EventPrefetchFlag is the prefetch count for the event subscriber
	EventPrefetchFlag = "event-prefetch"
)

type Process

type Process interface {
	Name() string
	Features() []Feature
	CustomFlags() []cli.Flag
	Initialize(provider Provider) error
	Subscribers() []SubscriberDef
	HTTPHandler() http.Handler
}

Process is a component of Trandoshan

type Provider

type Provider interface {
	// Clock return a clock implementation
	Clock() (clock.Clock, error)
	// ConfigClient return a new configured configapi.Client
	ConfigClient(keys []string) (configapi.Client, error)
	// Subscriber return a new configured subscriber
	Subscriber() (event.Subscriber, error)
	// Publisher return a new configured publisher
	Publisher() (event.Publisher, error)
	// Cache return a new configured cache
	Cache(keyPrefix string) (cache.Cache, error)
	// HTTPClient return a new configured http client
	HTTPClient() (chttp.Client, error)
	// GetStrValue return string value for given key
	GetStrValue(key string) string
	// GetStrValues return string slice for given key
	GetStrValues(key string) []string
	// GetIntValue return int value for given key
	GetIntValue(key string) int
}

Provider is the implementation provider

func NewDefaultProvider

func NewDefaultProvider(ctx *cli.Context) Provider

NewDefaultProvider create a brand new default provider using given cli.Context

type SubscriberDef

type SubscriberDef struct {
	Exchange string
	Queue    string
	Handler  event.Handler
}

SubscriberDef is the subscriber definition

Jump to

Keyboard shortcuts

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