http

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package http implements the HTTP service for Flow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	// Address that the HTTP service is configured to listen on.
	HTTPListenAddr string

	// Address that the HTTP service is configured to listen on for in-memory
	// traffic when [DialFunc] is used to establish a connection.
	MemoryListenAddr string

	// DialFunc is a function which establishes in-memory network connection when
	// address is MemoryListenAddr. If address is not MemoryListenAddr, DialFunc
	// establishes an outbound network connection.
	DialFunc func(ctx context.Context, network, address string) (net.Conn, error)
}

Data includes information associated with the HTTP service.

type Options

type Options struct {
	Logger   log.Logger           // Where to send logs.
	Tracer   trace.TracerProvider // Where to send traces.
	Gatherer prometheus.Gatherer  // Where to collect metrics from.

	Clusterer  *cluster.Clusterer
	ReadyFunc  func() bool
	ReloadFunc func() error

	HTTPListenAddr   string // Address to listen for HTTP traffic on.
	MemoryListenAddr string // Address to accept in-memory traffic on.
	UIPrefix         string // Path prefix to host the UI at.
	EnablePProf      bool   // Whether pprof endpoints should be exposed.
}

Options are used to configure the HTTP service. Options are constant for the lifetime of the HTTP service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(opts Options) *Service

New returns a new, unstarted instance of the HTTP service.

func (*Service) Data

func (s *Service) Data() any

Data returns an instance of Data. Calls to Data are cachable by the caller.

Data must only be called after parsing command-line flags.

func (*Service) Definition

func (s *Service) Definition() service.Definition

Definition returns the definition of the HTTP service.

func (*Service) Run

func (s *Service) Run(ctx context.Context, host service.Host) error

Run starts the HTTP service. It will run until the provided context is canceled or there is a fatal error.

func (*Service) Update

func (s *Service) Update(newConfig any) error

Update implements service.Service. It is a no-op since the HTTP service does not support runtime configuration.

Jump to

Keyboard shortcuts

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