Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineController

type EngineController interface {
	Start() error
	Stop()
	Pause()
	Resume()
	AddSeed(url string) error
	GetState() string
	GetStats() map[string]any
}

EngineController is the interface the API uses to control the engine.

type Job

type Job struct {
	ID        string         `json:"id"`
	Status    string         `json:"status"`
	Seeds     []string       `json:"seeds"`
	Config    map[string]any `json:"config,omitempty"`
	StartedAt time.Time      `json:"started_at"`
	Stats     map[string]any `json:"stats,omitempty"`
}

Job tracks a crawl job.

type Server

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

Server provides a REST API for external control of the crawler.

func NewServer

func NewServer(port int, logger *slog.Logger) *Server

NewServer creates a new API server.

func (*Server) SetEngine

func (s *Server) SetEngine(engine EngineController)

SetEngine sets the engine controller.

func (*Server) Start

func (s *Server) Start() error

Start starts the API server.

Jump to

Keyboard shortcuts

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