devseed

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package devseed fills a local akari server with realistic example data for development. It is a dev-only convenience, not part of the production server.

The approach is deliberately not synthetic: rather than fabricate message and usage rows, it creates a handful of demo accounts, then runs the real akari client in-process for a short, bounded window so it discovers this machine's actual agent session logs and pushes them through the server's true ingest and parse pipeline. The freshly ingested sessions all land under one uploader, so a final pass randomly reassigns them across the demo accounts, leaving the store looking as though several people had each backed up their own work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, st *store.Store, opts Options) error

Run performs a full seed: ensure the demo accounts, and (unless the store already holds sessions) ingest this machine's local agent sessions and spread them across those accounts. It is idempotent: the accounts are upserted, and the expensive ingest is skipped when sessions already exist and Force is unset.

Types

type Options

type Options struct {
	// ServerURL is the base URL of the running akari server the client uploads
	// to, e.g. http://localhost:8080. Required.
	ServerURL string
	// NumUsers is how many demo accounts to create, clamped to the roster size.
	NumUsers int
	// Password is the shared plaintext login password for every demo account, so
	// a developer can sign in to any of them.
	Password string
	// TimeLimit bounds how long the in-process client keeps starting new uploads;
	// the upload in flight when it elapses still finishes. Zero means no limit.
	TimeLimit time.Duration
	// Concurrency caps how many session files upload in parallel.
	Concurrency int
	// Force re-seeds even when the store already holds sessions: it clears the
	// existing sessions first, then re-ingests and re-shuffles. Without it, a
	// populated store is left untouched so the hook is cheap to re-run on every
	// `eph up`. The clean slate is what keeps re-ingest from creating duplicate
	// rows once a prior run moved sessions off the ingest account.
	Force bool
	// Logf receives progress lines; defaults to log.Printf.
	Logf func(format string, args ...any)
}

Options configures a seed run. The zero value is unusable; applyDefaults fills in sensible defaults for everything except ServerURL, which the caller must supply (it is the base URL of the running server the client uploads through).

Jump to

Keyboard shortcuts

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