config

package
v0.0.0-...-712fbb6 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2015 License: ISC Imports: 3 Imported by: 0

README

config

import "github.com/tmc/prism/config"

type Config

type Config struct {
    // Configuration of the splitters
    Splitters []SplitterConfig
    // address to set up HTTP monitoring interface
    MonitorAddr string
}

Config is the top level configuration description for a prism Server instance. Each Server has one monitor address (a debug and stats collection endpoint) and a set of Splitters.

func NewConfig
func NewConfig(conf io.Reader) (*Config, error)

NewConfig constructs a Config instance from a io.Reader.

func (Config) String
func (c Config) String() string

String provides a string representation of a Config.

type Sink

type Sink struct {
    Name string
    Addr string
}

Sink is a downstream http server that gets copies of the incoming requests.

type SplitterConfig

type SplitterConfig struct {
    Label      string // arbitrary label for humans
    ListenAddr string // listen Addr
    Source     string // upstream source http address

    WaitForResponse    bool // if true, the requests are not relayed to sinks until the upstream response has been read.
    Sinks              []Sink
    SinkRequestTimeout int `json:",omitempty"` // timeout on request to sinks in seconds
    RequestBufferSize  int `json:",omitempty"` // size of request queue
}

SplitterConfig describes an instance of a splitter.

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Configuration of the splitters
	Splitters []SplitterConfig
	// address to set up HTTP monitoring interface
	MonitorAddr string
}

Config is the top level configuration description for a prism Server instance. Each Server has one monitor address (a debug and stats collection endpoint) and a set of Splitters.

Example
package main

import (
	"fmt"

	"github.com/tmc/prism/config"
)

func main() {
	c := config.Config{
		Splitters: []config.SplitterConfig{
			{
				Label:      "main",
				ListenAddr: "localhost:7000",
				Source:     "localhost:8000",
				Sinks: []config.Sink{
					{"version a", "localhost:8001"},
					{"version b", "localhost:8002"},
				},
				// Doesn't send requests to sinks until the response from
				// source arrives.
				WaitForResponse: true,
			},
		},
		MonitorAddr: ":7070",
	}
	fmt.Println(c)
}
Output:

{"Splitters":[{"Label":"main","ListenAddr":"localhost:7000","Source":"localhost:8000","WaitForResponse":true,"Sinks":[{"Name":"version a","Addr":"localhost:8001"},{"Name":"version b","Addr":"localhost:8002"}]}],"MonitorAddr":":7070"}

func NewConfig

func NewConfig(conf io.Reader) (*Config, error)

NewConfig constructs a Config instance from a io.Reader.

func (Config) String

func (c Config) String() string

String provides a string representation of a Config.

type Sink

type Sink struct {
	Name string
	Addr string
}

Sink is a downstream http server that gets copies of the incoming requests.

type SplitterConfig

type SplitterConfig struct {
	Label      string // arbitrary label for humans
	ListenAddr string // listen Addr
	Source     string // upstream source http address

	WaitForResponse    bool // if true, the requests are not relayed to sinks until the upstream response has been read.
	Sinks              []Sink
	SinkRequestTimeout int `json:",omitempty"` // timeout on request to sinks in seconds
	RequestBufferSize  int `json:",omitempty"` // size of request queue
}

SplitterConfig describes an instance of a splitter.

Jump to

Keyboard shortcuts

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