# `EctoFoundationDB.Indexer.SchemaMetadata`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L1)

This Indexer keeps track of various actions for a Schema:

- `inserts`: Incremented for each insert or upsert
- `deletes`: Incremented for each delete
- `collection`: Incremented for each insert, upsert, or delete
- `updates`: Incremented for each update (via `Repo.update/*`)
- `changes`: Incremented for each insert, upsert, delete, or update

These keys are useful for creating watches that will notify your application of those actions. For example, if you create a watch on the `inserts` key,
your application will be notified when a new record is inserted, and you can react however you like.

See it in action: [Sync Engine Part II - Collections](collection_syncing.html)

# `async_changes`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L256)

Asynchronously get the `changes` key.

# `async_changes_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L281)

Asynchronously get the `changes` key.

# `async_collection`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L246)

Asynchronously get the `collection` key.

# `async_collection_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L271)

Asynchronously get the `collection` key.

# `async_deletes`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L241)

Asynchronously get the `deletes` key.

# `async_deletes_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L266)

Asynchronously get the `deletes` key.

# `async_inserts`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L236)

Asynchronously get the `inserts` key.

# `async_inserts_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L261)

Asynchronously get the `inserts` key.

# `async_updates`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L251)

Asynchronously get the `updates` key.

# `async_updates_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L276)

Asynchronously get the `updates` key.

# `changes`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L52)

Synchronous get on the `changes` key.

# `changes_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L81)

Synchronous get on the `changes` key for the provided indexed values.

# `clear`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L84)

# `clear_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L86)

# `collection`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L42)

Synchronous get on the `collection` key.

# `collection_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L69)

Synchronous get on the `collection` key for the provided indexed values.

# `deletes`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L37)

Synchronous get on the `deletes` key.

# `deletes_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L63)

Synchronous get on the `deletes` key for the provided indexed values.

# `inserts`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L32)

Synchronous get on the `inserts` key.

# `inserts_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L57)

Synchronous get on the `inserts` key for the provided indexed values.

# `updates`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L47)

Synchronous get on the `updates` key.

# `updates_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L75)

Synchronous get on the `updates` key for the provided indexed values.

# `watch`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L182)

Creates a watch on the provided SchemaMetadata named key.

## Arguments

- `queryable`: The schema to watch, or a query
- `name`: The name of the watch
- `opts`: The options for the watch

### Name

- `:inserts`: Signals for each insert or upsert
- `:deletes`: Signals for each delete
- `:collection`: Signals for each insert, upsert, or delete
- `:updates`: Signals for each update (via `Repo.update/*`)
- `:changes`: Signals for each insert, upsert, delete, or update

### Options

- `:label`: An optional atom label that if provided, will be used by subsequent calls
  to `Repo.assign_ready/3` to store the data into the assigns map. There is no default
  behavior. If a label is not provided, `assign_ready` will fail.
  to `Repo.assign_ready/3` to query the database for data to be stored in the assigns map.
  By default, `Repo.all(schema)` is used.

# `watch_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L186)

# `watch_changes`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L125)

Equivalent to `watch(schema, :changes, opts)`

# `watch_changes_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L154)

Equivalent to `watch_by(schema, indexed_values, :changes, opts)`

# `watch_collection`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L115)

Equivalent to `watch(schema, :collection, opts)`

# `watch_collection_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L142)

Equivalent to `watch_by(schema, indexed_values, :collection, opts)`

# `watch_deletes`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L110)

Equivalent to `watch(schema, :deletes, opts)`

# `watch_deletes_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L136)

Equivalent to `watch_by(schema, indexed_values, :deletes, opts)`

# `watch_inserts`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L105)

Equivalent to `watch(schema, :inserts, opts)`

# `watch_inserts_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L130)

Equivalent to `watch_by(schema, indexed_values, :inserts, opts)`

# `watch_updates`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L120)

Equivalent to `watch(schema, :updates, opts)`

# `watch_updates_by`
[🔗](https://github.com/foundationdb-beam/ecto_foundationdb/blob/main/lib/ecto_foundationdb/indexer/schema_metadata.ex#L148)

Equivalent to `watch_by(schema, indexed_values, :updates, opts)`

---

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