app

package
v0.0.0-...-bdfed93 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 87 Imported by: 0

Documentation

Overview

Package app wires the roles of the binary: serve, worker, runner, migrate, admin.

Every role loads the same configuration (env + *_FILE), builds its logger and runs until the context ends (SIGINT/SIGTERM). Two helper commands without a role of their own: healthcheck (for distroless containers without a shell) and version.

Index

Constants

View Source
const (
	ExitOK    = 0
	ExitError = 1
	ExitUsage = 2
)

Exit codes.

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, args []string, env Env) int

Main runs the command in args and returns the exit code.

Types

type AppMatchEvaluator

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

AppMatchEvaluator adapts matching profile evaluation to the urlimport MatchEvaluator interface.

func NewMatchEvaluator

func NewMatchEvaluator(profiles matching.Profiles, matching matching.Store) *AppMatchEvaluator

NewMatchEvaluator returns a MatchEvaluator backed by the matching module.

func (*AppMatchEvaluator) EvaluateAndSave

func (a *AppMatchEvaluator) EvaluateAndSave(ctx context.Context, userID uuid.UUID, jobID int64, p discovery.Posting, at time.Time) error

EvaluateAndSave evaluates a posting against the user's active profile and saves the match.

type BoardDiscoveryArgs

type BoardDiscoveryArgs struct{}

BoardDiscoveryArgs looks for the own boards of companies seen only on job boards; queued after each crawl.

func (BoardDiscoveryArgs) InsertOpts

func (BoardDiscoveryArgs) InsertOpts() river.InsertOpts

InsertOpts runs discovery on the crawl queue (never alongside a crawl); at most one waits or runs.

func (BoardDiscoveryArgs) Kind

func (BoardDiscoveryArgs) Kind() string

Kind implements river.JobArgs.

type CleanupArgs

type CleanupArgs struct{}

CleanupArgs removes expired sign-in tokens, sessions, invitations, and screenshots past retention.

func (CleanupArgs) Kind

func (CleanupArgs) Kind() string

Kind implements river.JobArgs.

type CrawlArgs

type CrawlArgs struct {
	Manual bool `json:"manual,omitempty"`
}

CrawlArgs starts a crawl of all sources. Manual crawls (admin crawl) are unique apart from scheduled ones, so one can wait while a scheduled crawl runs.

func (CrawlArgs) InsertOpts

func (CrawlArgs) InsertOpts() river.InsertOpts

InsertOpts puts crawls on their own queue (one runs at a time); per kind of trigger at most one waits or runs.

func (CrawlArgs) Kind

func (CrawlArgs) Kind() string

Kind implements river.JobArgs.

type DailySummaryArgs

type DailySummaryArgs struct{}

DailySummaryArgs triggers scheduled delivery of daily application summaries.

func (DailySummaryArgs) InsertOpts

func (DailySummaryArgs) InsertOpts() river.InsertOpts

InsertOpts ensures at most one daily summary check waits or runs.

func (DailySummaryArgs) Kind

func (DailySummaryArgs) Kind() string

Kind implements river.JobArgs.

type Env

type Env struct {
	Stdout io.Writer
	Stderr io.Writer
	Config config.Source
}

Env bundles everything a run gets from outside (tests replace it).

type HandoffArgs

type HandoffArgs struct{}

HandoffArgs warns before handoff windows close and parks applications whose window closed.

func (HandoffArgs) InsertOpts

func (HandoffArgs) InsertOpts() river.InsertOpts

InsertOpts places handoff watching on the apply queue.

func (HandoffArgs) Kind

func (HandoffArgs) Kind() string

Kind implements river.JobArgs.

type InboxArgs

type InboxArgs struct {
	UserID uuid.UUID `json:"user_id,omitzero"`
}

InboxArgs triggers an inbox check for a single user or all enabled mailboxes.

func (InboxArgs) InsertOpts

func (a InboxArgs) InsertOpts() river.InsertOpts

InsertOpts: at most one inbox check runs or waits.

func (InboxArgs) Kind

func (InboxArgs) Kind() string

Kind implements river.JobArgs.

type MatchArgs

type MatchArgs struct {
	UserID uuid.UUID `json:"user_id,omitzero"`
}

MatchArgs matches open jobs for one user, or for all users when UserID is nil (after a crawl).

func (MatchArgs) InsertOpts

func (a MatchArgs) InsertOpts() river.InsertOpts

InsertOpts: at most one run over all users waits or runs. Runs for one user are never merged, so a profile change during a run is not lost.

func (MatchArgs) Kind

func (MatchArgs) Kind() string

Kind implements river.JobArgs.

type PlanArgs

type PlanArgs struct{}

PlanArgs runs the planner to queue matching applications according to user quotas and pacing.

func (PlanArgs) InsertOpts

func (PlanArgs) InsertOpts() river.InsertOpts

InsertOpts: at most one planner run waits or runs.

func (PlanArgs) Kind

func (PlanArgs) Kind() string

Kind implements river.JobArgs.

type RecoverArgs

type RecoverArgs struct{}

RecoverArgs turns applications stuck in submitting into submit_unknown.

func (RecoverArgs) InsertOpts

func (RecoverArgs) InsertOpts() river.InsertOpts

InsertOpts places recovery on the apply queue.

func (RecoverArgs) Kind

func (RecoverArgs) Kind() string

Kind implements river.JobArgs.

type RiverCrawlQueue

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

RiverCrawlQueue connects the URL import service to River crawl worker jobs.

func NewCrawlQueue

func NewCrawlQueue(inserter *queue.Client, pool *pgxpool.Pool) *RiverCrawlQueue

NewCrawlQueue returns a CrawlQueue backed by River.

func (*RiverCrawlQueue) IsQueued

func (q *RiverCrawlQueue) IsQueued(ctx context.Context) (bool, error)

IsQueued reports whether a crawl job is currently waiting in the River queue.

func (*RiverCrawlQueue) QueueCrawl

func (q *RiverCrawlQueue) QueueCrawl(ctx context.Context) (bool, error)

QueueCrawl queues an immediate manual crawl.

type SearchAlertArgs

type SearchAlertArgs struct{}

SearchAlertArgs checks the saved searches with an alert for new jobs (each at most once a day).

func (SearchAlertArgs) InsertOpts

func (SearchAlertArgs) InsertOpts() river.InsertOpts

InsertOpts ensures at most one check waits or runs.

func (SearchAlertArgs) Kind

func (SearchAlertArgs) Kind() string

Kind implements river.JobArgs.

Jump to

Keyboard shortcuts

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