# `Electric.Shapes.Consumer.Subqueries.MoveQueue`
[🔗](https://github.com/electric-sql/electric/tree/%40core/sync-service%401.6.2/packages/sync-service/lib/electric/shapes/consumer/subqueries/move_queue.ex#L1)

Multi-dependency move queue. Tracks move_in/move_out operations per dependency index,
with deduplication and redundancy elimination scoped per dependency.

Move-outs from any dependency are drained before move-ins from any dependency.

# `batch`

```elixir
@type batch() :: {batch_kind(), non_neg_integer(), [move_value()]}
```

# `batch_kind`

```elixir
@type batch_kind() :: :move_out | :move_in
```

# `move_value`

```elixir
@type move_value() :: {term(), term()}
```

# `t`

```elixir
@type t() :: %Electric.Shapes.Consumer.Subqueries.MoveQueue{
  move_in: %{required(non_neg_integer()) =&gt; [move_value()]},
  move_out: %{required(non_neg_integer()) =&gt; [move_value()]}
}
```

# `enqueue`

```elixir
@spec enqueue(t(), non_neg_integer(), map() | keyword(), MapSet.t()) :: t()
```

Enqueue a materializer payload for a specific dependency.
`dep_view` is the current view for this dependency, used for redundancy elimination.

# `length`

```elixir
@spec length(t()) :: non_neg_integer()
```

# `new`

```elixir
@spec new() :: t()
```

# `pop_next`

```elixir
@spec pop_next(t()) :: {batch(), t()} | nil
```

Pop the next batch of operations. Returns move-out batches (any dep) before move-in batches.
Returns `{batch, updated_queue}` or `nil` if the queue is empty.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
