> ## Documentation Index
> Fetch the complete documentation index at: https://ladygraph.io.vn/llms.txt
> Use this file to discover all available pages before exploring further.

# stores

> Where the index lives.

## `stores.index`

One way to open an index: a Ladybug server, an index file, or a whole build folder.

#### `open_index`

```python theme={null}
open_index(target: str | pathlib.Path, *, read_only: bool = True, headers: dict[str, str] | None = None, tls_root_certs: bytes | None = None, timeout_s: float = 30.0)
```

The store for `target`: a `grpc://` address, an index file, or a folder that holds one.

## `stores.ladybug`

A GraphStore on LadybugDB, an embedded graph database (docs/DATASTURCTURE.md section 7).

#### `LadybugStore`

A GraphStore on LadybugDB.

Construct with `LadybugStore(path: str \| pathlib.Path \| None = None, *, read_only: bool = False)`.

| Method | What it does |
| - | - |
| `close(self) -> None` | — |
| `apply(self, contribution: Contribution) -> None` | — |
| `drop_unit(self, scope: str, unit: str) -> None` | — |
| `rebuild_edges(self, scope: str) -> None` | Throw the edges of a scope away and make them again from the relation rows. |
| `search(self, q: Query) -> list[Hit]` | — |
| `export(self, scope: str, path: pathlib.Path) -> None` | — |

## `stores.ladybug_flight`

A store over a Ladybug Flight server: search an index, and (when asked) save into it, from another machine.

#### `LadybugFlightStore`

The `ConceptSource` and a `GraphStore`, on a Ladybug Flight server.

Construct with `LadybugFlightStore(uri: str, *, read_only: bool = True, headers: dict[str, str] \| None = None, tls_root_certs: bytes \| None = None, timeout_s: float = 30.0, write_timeout_s: float = 300.0, attempts: int = 6)`.

| Method | What it does |
| - | - |
| `close(self) -> None` | — |
| `apply(self, contribution) -> None` | — |
| `drop_unit(self, scope: str, unit: str) -> None` | — |
| `search(self, q: Query) -> list[Hit]` | — |
| `export(self, scope: str, path) -> None` | — |

#### `assert_read_only`

```python theme={null}
assert_read_only(text: str) -> None
```

Refuse anything but a plain read.

#### `fill`

```python theme={null}
fill(query: str, params: dict[str, typing.Any] | None) -> str
```

The query with every `$name` replaced by its literal.

#### `literal`

```python theme={null}
literal(value: Any) -> str
```

A Cypher literal for a Python value, safe to put inside a query.

#### `transaction_body`

```python theme={null}
transaction_body(steps: list, check: dict | None) -> bytes
```

The JSON the server's `transaction` action takes: the optional revision check, then every step with its parameters.

## `stores.memory`

GraphStore - store the Concept Indexing Graph

#### `InMemoryStore`

An in-memory GraphStore: for tests and dry runs.

| Method | What it does |
| - | - |
| `(property)` | — |
| `apply(self, contribution: Contribution) -> None` | — |
| `drop_unit(self, scope: str, unit: str) -> None` | — |
| `versions(self, scope: str) -> dict[str, DocVersion]` | — |
| `pinned(self, scope: str, unit: str) -> list[ContextChoice]` | — |
| `known_types(self, scope: str) -> dict[str, str]` | — |
| `registry(self, scope: str) -> ContextRegistry` | — |
| `concepts_in(self, scope: str) -> list[Concept]` | — |
| `search(self, q: Query) -> list[Hit]` | — |
| `export(self, scope: str, path: pathlib.Path) -> None` | — |

## `stores.plan`

How a save is PLANNED: the exact list of statements that applies a Contribution, worked out before any is run.

#### `Plan`

| Field | Type | Default |
| - | - | - |
| `steps` | `list[Step]` | required |
| `revision` | `str \| None` | required |
| `next_revision` | `str` | required |

## `stores.reads`

The READ side of a LadyGraph index on LadybugDB, with no database engine imported.

#### `Edge`

A relation whose two ends both exist, as the store keeps it for graph queries.

| Field | Type | Default |
| - | - | - |
| `source` | `str` | required |
| `target` | `str` | required |
| `type` | `str` | required |
| `weight` | `float` | required |
| `unit` | `str` | required |

#### `SaveRecord`

One committed save. A save that failed leaves no record, because it left nothing in the database.

| Field | Type | Default |
| - | - | - |
| `kind` | `str` | required |
| `scope` | `str` | required |
| `unit` | `str` | required |
| `statements` | `int` | required |
| `seconds` | `float` | required |

#### `StoreError`

The store cannot do what was asked.

#### `StoreLockedError`

Another process has this database open.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.