# orca.store

> A module of Orca's API.

Where the executor records what it does.

`Pipeline.execute` reports every attempt it starts and finishes, and every
step it skips, to a `Store`. `MemoryStore` only counts attempts, for a run
that lives as long as its process; `orca.state.PgStore` writes them to
Postgres, so a run can be resumed by another process.

## Structs

### `MemoryStore`

```mojo
struct MemoryStore
```

Keeps nothing but the attempt counts.

Implements: `Movable`, `Store`

#### `__init__`

```mojo
def __init__(out self)
```

#### `start_attempt`

```mojo
def start_attempt(mut self, step: String, partition: String, ord: Int, input: Span[UInt8]) -> Int
```

#### `finish_attempt`

```mojo
def finish_attempt(mut self, step: String, partition: String, attempt: Int, status: String, output: Span[UInt8], error: String)
```

#### `skip`

```mojo
def skip(mut self, step: String, partition: String, ord: Int, reason: String)
```

#### `pinned_reads`

```mojo
def pinned_reads(mut self, step: String, partition: String) -> Dict[String, Int64]
```

#### `recorder`

```mojo
def recorder(mut self) -> Recorder
```

#### `set_log`

```mojo
def set_log(mut self, step: String, partition: String, attempt: Int, path: String)
```

## Traits

### `Store`

```mojo
undefined
```

#### `start_attempt`

```mojo
def start_attempt(mut self, step: String, partition: String, ord: Int, input: Span[UInt8]) -> Int
```

Records that `step` for `partition` is starting, with its encoded input, and returns the attempt's number (1 for the first). `ord` is the step's place in the run order.

#### `finish_attempt`

```mojo
def finish_attempt(mut self, step: String, partition: String, attempt: Int, status: String, output: Span[UInt8], error: String)
```

Records how attempt `attempt` ended: `succeeded` with its encoded output, or `failed` with its error.

#### `skip`

```mojo
def skip(mut self, step: String, partition: String, ord: Int, reason: String)
```

Records that `step` for `partition` didn't run, and why.

#### `pinned_reads`

```mojo
def pinned_reads(mut self, step: String, partition: String) -> Dict[String, Int64]
```

The table snapshots earlier attempts of `step` for `partition` read, each table at its first attempt's snapshot.

#### `recorder`

```mojo
def recorder(mut self) -> Recorder
```

What records the reads and commits of the attempt just started.

#### `set_log`

```mojo
def set_log(mut self, step: String, partition: String, attempt: Int, path: String)
```

Records where attempt `attempt` writes its log.
