Open a GraphLite database Args: path: Path to database directory Raises: GraphLiteError: If database cannot be opened
(self, path: str)
| 198 | """ |
| 199 | |
| 200 | def __init__(self, path: str): |
| 201 | """ |
| 202 | Open a GraphLite database |
| 203 | |
| 204 | Args: |
| 205 | path: Path to database directory |
| 206 | |
| 207 | Raises: |
| 208 | GraphLiteError: If database cannot be opened |
| 209 | """ |
| 210 | self._db = None |
| 211 | self._sessions = set() |
| 212 | |
| 213 | error = ctypes.c_int(0) |
| 214 | self._db = _lib.graphlite_open(path.encode('utf-8'), ctypes.byref(error)) |
| 215 | |
| 216 | if not self._db: |
| 217 | raise GraphLiteError( |
| 218 | ErrorCode(error.value), |
| 219 | f"Failed to open database at {path}" |
| 220 | ) |
| 221 | |
| 222 | def create_session(self, username: str) -> str: |
| 223 | """ |
no test coverage detected