pkg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRepositoryNotSync = errors.New("notsync")
	ErrCommitNotFound    = errors.New("notfound")
)
View Source
var (
	ErrServiceNotFound = errors.New("notfound")
	ErrNoAvailablePort = errors.New("noport")
)

ErrServiceNotFound default service

Functions

func Logging

func Logging(log logr.Logger, next http.Handler) http.Handler

func NewLogger

func NewLogger(name string) logr.Logger

func NewReverseProxy

func NewReverseProxy(u Upstream) http.HandlerFunc

NewReverseProxy creates a reverse proxy for the existing service

func Startup

func Startup(version, commit, date, builtBy string)

Types

type CronService

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

func NewCronService

func NewCronService() *CronService

func (*CronService) Run

func (c *CronService) Run(ctx context.Context) error

type DefaultUpstream

type DefaultUpstream struct {
	sync.RWMutex
	Versions map[string]HTTPProcess
	Default  *string
}

func (*DefaultUpstream) GetDefault

func (u *DefaultUpstream) GetDefault() (string, error)

GetDefault an upstream server for a service version

func (*DefaultUpstream) Lookup

func (u *DefaultUpstream) Lookup(service string) (string, *exec.Cmd, error)

Lookup returns the port for the version to find

func (*DefaultUpstream) NextPort

func (u *DefaultUpstream) NextPort() (string, error)

Next provides a port

func (*DefaultUpstream) Register

func (u *DefaultUpstream) Register(name, version string, process HTTPProcess, def bool)

Register an upstream server for a service version

func (*DefaultUpstream) SetDefault

func (u *DefaultUpstream) SetDefault(name, version string) error

SetDefault an upstream server for a service version

func (*DefaultUpstream) Unregister

func (u *DefaultUpstream) Unregister(name, version string)

Unregister an upstream server for a service version

type GitServer

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

func NewGitServer

func NewGitServer(
	repository, head string,
	upstream Upstream,
	action chan<- func()) (*GitServer, error)

func (*GitServer) Update

func (g *GitServer) Update(repo string)

Update refresh the workarea from the GIT repository, build the artifact and roll the upstream with the latest version

func (*GitServer) Updater

func (g *GitServer) Updater(next http.Handler) http.Handler

type HTTPListener

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

func NewHTTPListener

func NewHTTPListener() *HTTPListener

func (*HTTPListener) Run

func (l *HTTPListener) Run(ctx context.Context, addr string, handler http.Handler) error

type HTTPProcess

type HTTPProcess struct {
	Addr string
	Cmd  *exec.Cmd
}

type SignalHandler

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

func NewSignalHandler

func NewSignalHandler() *SignalHandler

func (*SignalHandler) Run

func (c *SignalHandler) Run(ctx context.Context, cancel context.CancelFunc) error

type StateMachine

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

func NewStateMachine

func NewStateMachine() *StateMachine

func (*StateMachine) Run

func (m *StateMachine) Run(ctx context.Context) error

type StoreService

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

func NewStoreService

func NewStoreService(workspace string) *StoreService

func (*StoreService) Run

func (m *StoreService) Run(ctx context.Context) error

type Updater

type Updater interface {
	Update(repo string) (string, error)
}

type Upstream

type Upstream interface {
	Register(string, string, HTTPProcess, bool)
	SetDefault(string, string) error
	GetDefault() (string, error)
	Unregister(string, string)
	Lookup(string) (string, *exec.Cmd, error)
	NextPort() (string, error)
}

Upstreamer the backend registration interface

func NewUpstream

func NewUpstream() Upstream

Jump to

Keyboard shortcuts

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