# orca.views.start

> A module of morca's API.

What Start runs would queue (`StartPreview`), as a sentence and as the command that queues it, for a pipeline's Operate tab and its JSON.

## Structs

### `StartPreview`

```mojo
struct StartPreview
```

What the pipeline page's Start runs form would do over a range: the backfill's runs and the keys it would leave, and the one run's size, or why the range is refused.

Implements: `Copyable`, `Movable`

Fields:

- `refused: String`
- `keys: List[String]`: The keys the backfill would queue, sorted.
- `runs: Int`: The runs they'd make, `keys_per_run` to a run.
- `keys_per_run: Int`
- `done: List[String]`
- `live: List[String]`
- `live_runs: List[Int]`
- `pace: Pace`: How long its recent runs took, for the estimates.

## Functions

### `start_preview`

```mojo
def start_preview(mut db: State, name: String, keys: String, rerun: Bool, allow_append: Bool = False) -> Optional[StartPreview]
```

The Start runs preview over `keys`: `preview_backfill`, the same logic as the backfill, in a transaction it rolls back.

### `unit_word`

```mojo
def unit_word(kind: String, n: Int) -> String
```

A partition of `kind`, as a word: hour, day, month or key, plural unless `n` is 1.

### `preview_line`

```mojo
def preview_line(p: PipelineRow, v: StartPreview) -> String
```

"This queues 30 runs: 2025-01-02 … 2025-01-31. 1 already done is skipped." and the like.

### `one_run_line`

```mojo
def one_run_line(p: PipelineRow, v: StartPreview) -> String
```

What "Start one run" would do over the same range.
