devwatch

package
v5.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package devwatch implements the development loop of a project: the develop.watch triggers that sync, restart or rebuild services as the files they come from change. It sits on top of pkg/watch, which only reports the file system events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	engine.Backend
	// CLI is the Docker CLI Compose runs in: it owns the output stream the
	// sync commands write to, the config the exec hooks read, and runs them.
	CLI() command.Cli
	// Build builds the images of the project's services.
	Build(ctx context.Context, project *types.Project, options api.BuildOptions) (map[string]string, error)
	// CreateAndStart converges the project's services to their configuration
	// and starts them.
	CreateAndStart(ctx context.Context, project *types.Project, options api.CreateOptions) error
	// Restart restarts the services of a project.
	Restart(ctx context.Context, projectName string, options api.RestartOptions) error
	// RemoveDanglingImages removes the dangling images of a project, but the ones keep reports.
	RemoveDanglingImages(ctx context.Context, projectName string, keep func(image.Summary) bool) error
}

Backend is what the development loop needs from the engine it drives.

type Service

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

Service runs the development loop on a Backend.

func New

func New(backend Backend) *Service

New creates a Service driving the given Backend.

func (*Service) Rebuild

func (s *Service) Rebuild(ctx context.Context, project *types.Project, services []string, options api.WatchOptions) error

Rebuild rebuilds the given services and converges what depends on them, as the watch loop does when a rebuild trigger fires.

func (*Service) Watch

func (s *Service) Watch(ctx context.Context, project *types.Project, options api.WatchOptions) (func() error, error)

Watch starts watching the project's services and returns the function that waits for the watch to end.

type WatchFunc

type WatchFunc func(ctx context.Context, project *types.Project, options api.WatchOptions) (func() error, error)

WatchFunc starts a watch and returns the function that waits for its end.

type Watcher

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

func NewWatcher

func NewWatcher(project *types.Project, options api.UpOptions, w WatchFunc, consumer api.LogConsumer) (*Watcher, error)

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context) error

func (*Watcher) Stop

func (w *Watcher) Stop() error

Jump to

Keyboard shortcuts

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