importer

package
v0.51.33 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context) error

Run executes the import pipeline: fetch events, score reputation, generate insights.

Types

type RepoWork added in v0.33.0

type RepoWork struct {
	Org     string
	Repo    string
	Weight  int // event count for sharding weight; 0 = new repo
	Tenants []TenantRef
}

RepoWork represents a unique repo to import, with all tenants that track it.

func BuildWorkList added in v0.33.0

func BuildWorkList(rows []tenant.ImportWorkRow) []RepoWork

BuildWorkList deduplicates tenant_repo rows by (org, repo), grouping tenant refs under each unique repo. Preserves exact org/repo casing.

func ShardRepos added in v0.33.0

func ShardRepos(repos []RepoWork, taskCount, taskIndex int) []RepoWork

ShardRepos deterministically assigns repos to a task shard using greedy bin-packing by weight. Heavy repos are spread across tasks to balance cumulative import cost. Ties broken by lower task index for determinism. Guarantees: union of all shards == input, no gaps, no overlaps.

type TenantRef added in v0.33.0

type TenantRef struct {
	TenantRepoID string
	TenantID     string
	Plan         string
}

TenantRef links a tenant to their tenant_repo row for post-import bookkeeping.

Jump to

Keyboard shortcuts

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