# bookclerk_library::entities::ingest_batches

SeaORM entity for `ingest_batches`: one batch of uploaded files or
intake references, held by one patron. Written by
`control_plane::ingest`.

| Item | Kind | Summary |
| --- | --- | --- |
| [`Model`](#model) | struct | Row shape for one batch. |
| [`ColumnIter`](#columniter) | struct | An iterator over the variants of [Column] |
| [`Entity`](#entity) | struct | Generated by sea-orm-macros |
| [`PrimaryKeyIter`](#primarykeyiter) | struct | An iterator over the variants of [PrimaryKey] |
| [`ActiveModel`](#activemodel) | struct | Generated by sea-orm-macros |
| [`RelationIter`](#relationiter) | struct | An iterator over the variants of [Relation] |
| [`Column`](#column) | enum | Generated by sea-orm-macros |
| [`PrimaryKey`](#primarykey) | enum | Generated by sea-orm-macros |
| [`Relation`](#relation) | enum | Declared SeaORM relations (none). |

## Structs

### Model

```rust
pub struct Model {
    pub id: String,
    pub user_id: i64,
    pub node_id: String,
    pub source: String,
    pub intake_instance: Option<String>,
    pub state: String,
    pub file_count: i64,
    pub declared_bytes: i64,
    pub job_id: Option<String>,
    pub detail: Option<String>,
    pub created_at: String,
    pub updated_at: String,
    pub finished_at: Option<String>,
}
```

Row shape for one batch.

**Fields**

- `id`: Batch id: 32 lower-case hex digits (`control_plane::IngestBatchId`).
- `user_id`: The patron who holds every book the batch stores (`users.id`).
- `node_id`: The node whose disk holds the staged bytes, the only one that runs
  the batch.
- `source`: `upload` (staged on `node_id`) or `intake` (read from a storage
  instance in place).
- `intake_instance`: For an intake batch, the storage plugin instance its members are
  read from; `None` for an upload.
- `state`: `open`, `committed`, `running`, `done`, `failed` or `cancelled`.
- `file_count`: Members named by the manifest (expanded archive entries excluded).
- `declared_bytes`: Sum of the manifest's declared sizes, in bytes.
- `job_id`: The `ingest_batch` job once committed.
- `detail`: Why a failed batch failed, for the person who uploaded it.
- `created_at`: RFC 3339 creation time.
- `updated_at`: RFC 3339 time of the last activity (a chunk, a commit, a state
  change); the idle prune reads it.
- `finished_at`: RFC 3339 time the batch reached a final state.

#### Model::into_ex

```rust
pub fn into_ex(self) -> Self
```

Generated by sea-orm-macros

Implements: `Clone`, `Debug`, `Eq`, `From<Model>`, `FromQueryResult`, `IntoActiveModel<ActiveModel>`, `ModelTrait`, `PartialEq`, `TryFrom<ActiveModel>`, `TryIntoModel<Model>`

### ColumnIter

```rust
pub struct ColumnIter {
    /* private fields */
}
```

An iterator over the variants of [Column](#column)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

### Entity

```rust
pub struct Entity;
```

Generated by sea-orm-macros

Implements: `Clone`, `Copy`, `Debug`, `Default`, `EntityName`, `EntityTrait`, `Iden`, `IdenStatic`

### PrimaryKeyIter

```rust
pub struct PrimaryKeyIter {
    /* private fields */
}
```

An iterator over the variants of [PrimaryKey](#primarykey)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

### ActiveModel

```rust
pub struct ActiveModel {
    pub id: ActiveValue<String>,
    pub user_id: ActiveValue<i64>,
    pub node_id: ActiveValue<String>,
    pub source: ActiveValue<String>,
    pub intake_instance: ActiveValue<Option<String>>,
    pub state: ActiveValue<String>,
    pub file_count: ActiveValue<i64>,
    pub declared_bytes: ActiveValue<i64>,
    pub job_id: ActiveValue<Option<String>>,
    pub detail: ActiveValue<Option<String>>,
    pub created_at: ActiveValue<String>,
    pub updated_at: ActiveValue<String>,
    pub finished_at: ActiveValue<Option<String>>,
}
```

Generated by sea-orm-macros

**Fields**

- `id`: Generated by sea-orm-macros
- `user_id`: Generated by sea-orm-macros
- `node_id`: Generated by sea-orm-macros
- `source`: Generated by sea-orm-macros
- `intake_instance`: Generated by sea-orm-macros
- `state`: Generated by sea-orm-macros
- `file_count`: Generated by sea-orm-macros
- `declared_bytes`: Generated by sea-orm-macros
- `job_id`: Generated by sea-orm-macros
- `detail`: Generated by sea-orm-macros
- `created_at`: Generated by sea-orm-macros
- `updated_at`: Generated by sea-orm-macros
- `finished_at`: Generated by sea-orm-macros

Implements: `ActiveModelBehavior`, `ActiveModelTrait`, `Clone`, `Debug`, `Default`, `From<Model>`, `IntoActiveModel<ActiveModel>`, `PartialEq`, `TryFrom<ActiveModel>`, `TryIntoModel<Model>`

### RelationIter

```rust
pub struct RelationIter {
    /* private fields */
}
```

An iterator over the variants of [Relation](#relation)

Implements: `Clone`, `Debug`, `DoubleEndedIterator`, `ExactSizeIterator`, `FusedIterator`, `Iterator`

## Enums

### Column

```rust
pub enum Column {
    Id,
    UserId,
    NodeId,
    Source,
    IntakeInstance,
    State,
    FileCount,
    DeclaredBytes,
    JobId,
    Detail,
    CreatedAt,
    UpdatedAt,
    FinishedAt,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros
- `UserId`: Generated by sea-orm-macros
- `NodeId`: Generated by sea-orm-macros
- `Source`: Generated by sea-orm-macros
- `IntakeInstance`: Generated by sea-orm-macros
- `State`: Generated by sea-orm-macros
- `FileCount`: Generated by sea-orm-macros
- `DeclaredBytes`: Generated by sea-orm-macros
- `JobId`: Generated by sea-orm-macros
- `Detail`: Generated by sea-orm-macros
- `CreatedAt`: Generated by sea-orm-macros
- `UpdatedAt`: Generated by sea-orm-macros
- `FinishedAt`: Generated by sea-orm-macros

Implements: `Clone`, `ColumnTrait`, `Copy`, `Debug`, `FromStr`, `Iden`, `IdenStatic`, `IntoEnumIterator`

### PrimaryKey

```rust
pub enum PrimaryKey {
    Id,
}
```

Generated by sea-orm-macros

**Variants**

- `Id`: Generated by sea-orm-macros

Implements: `Clone`, `Copy`, `Debug`, `Iden`, `IdenStatic`, `IntoEnumIterator`, `PrimaryKeyToColumn`, `PrimaryKeyTrait`

### Relation

```rust
pub enum Relation {}
```

Declared SeaORM relations (none).

Implements: `Clone`, `Copy`, `Debug`, `IntoEnumIterator`, `RelationTrait`
