# `TdsCdc.Persistence.File`

Default file-based LSN position persistence.

Saves positions as JSON to disk at a configurable path. The default path
is `<system_tmp>/tds_cdc/<client_name>.json`.

## Configuration

Pass via the `:persistence` option:

    TdsCdc.start_link(
      conn: [...],
      capture_instances: ["dbo_users"],
      persistence: {TdsCdc.Persistence.File, path: "/var/lib/myapp/lsn_positions.json"}
    )

Options:

  * `:path` - Directory where position files are stored.
    Defaults to `<system_tmp>/tds_cdc/`.

Each client writes a file named `<client_name>.json` inside the path.
For example, a client named `TdsCdc.Client` writes
`<path>/TdsCdc.Client.json`.

The file format is JSON:

    {
      "dbo_users": "0x0000002800000B800052",
      "dbo_orders": "0x0000002800000C010003"
    }

You can also configure the default path via application config:

    config :tds_cdc, persistence: [path: "/var/lib/myapp/lsn"]

---

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