> ## 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

> Nơi chỉ mục được lưu.

## `stores.index`

Một cách để mở một chỉ mục: một máy chủ Ladybug, một tệp chỉ mục, hoặc cả một thư mục dựng.

#### `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)
```

Kho cho `target`: một địa chỉ `grpc://`, một tệp chỉ mục, hoặc một thư mục chứa một tệp chỉ mục.

## `stores.ladybug`

Một GraphStore trên LadybugDB, một cơ sở dữ liệu đồ thị nhúng (docs/DATASTURCTURE.md mục 7).

#### `LadybugStore`

Một GraphStore trên LadybugDB.

Khởi tạo bằng `LadybugStore(path: str \| pathlib.Path \| None = None, *, read_only: bool = False)`.

| Phương thức | Làm gì |
| - | - |
| `close(self) -> None` | — |
| `apply(self, contribution: Contribution) -> None` | — |
| `drop_unit(self, scope: str, unit: str) -> None` | — |
| `rebuild_edges(self, scope: str) -> None` | Bỏ các cạnh của một phạm vi đi và tạo lại chúng từ các dòng quan hệ. |
| `search(self, q: Query) -> list[Hit]` | — |
| `export(self, scope: str, path: pathlib.Path) -> None` | — |

## `stores.ladybug_flight`

Một kho qua một máy chủ Flight của Ladybug: tìm kiếm một chỉ mục, và (khi được yêu cầu) lưu vào đó, từ một máy khác.

#### `LadybugFlightStore`

`ConceptSource` và một `GraphStore`, trên một máy chủ Flight của Ladybug.

Khởi tạo bằng `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)`.

| Phương thức | Làm gì |
| - | - |
| `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
```

Từ chối mọi thứ trừ một lần đọc thường.

#### `fill`

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

Truy vấn với mỗi `$name` được thay bằng giá trị literal của nó.

#### `literal`

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

Một literal Cypher cho một giá trị Python, an toàn để đặt bên trong một truy vấn.

#### `transaction_body`

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

JSON mà hành động `transaction` của máy chủ nhận: bước kiểm tra phiên bản tùy chọn, rồi mỗi bước kèm các tham số của nó.

## `stores.memory`

GraphStore - lưu Đồ thị Lập chỉ mục Khái niệm

#### `InMemoryStore`

Một GraphStore trong bộ nhớ: cho các bài kiểm thử và các lần chạy thử.

| Phương thức | Làm gì |
| - | - |
| `(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`

Cách một lần lưu được LẬP KẾ HOẠCH: danh sách chính xác các câu lệnh áp dụng một Contribution, được tính ra trước khi chạy bất kỳ câu nào.

#### `Plan`

| Trường | Kiểu | Mặc định |
| - | - | - |
| `steps` | `list[Step]` | required |
| `revision` | `str \| None` | required |
| `next_revision` | `str` | required |

## `stores.reads`

Phía ĐỌC của một chỉ mục LadyGraph trên LadybugDB, không import engine cơ sở dữ liệu nào.

#### `Edge`

Một quan hệ có cả hai đầu đều tồn tại, như kho giữ nó cho các truy vấn đồ thị.

| Trường | Kiểu | Mặc định |
| - | - | - |
| `source` | `str` | required |
| `target` | `str` | required |
| `type` | `str` | required |
| `weight` | `float` | required |
| `unit` | `str` | required |

#### `SaveRecord`

Một lần lưu đã commit. Một lần lưu thất bại không để lại bản ghi, vì nó không để lại gì trong cơ sở dữ liệu.

| Trường | Kiểu | Mặc định |
| - | - | - |
| `kind` | `str` | required |
| `scope` | `str` | required |
| `unit` | `str` | required |
| `statements` | `int` | required |
| `seconds` | `float` | required |

#### `StoreError`

Kho không thể làm điều được yêu cầu.

#### `StoreLockedError`

Một tiến trình khác đang mở cơ sở dữ liệu này.


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