Switch to UUID for sqlite db

This commit is contained in:
Andrew Mulbrook 2026-03-24 21:22:24 -05:00
parent 90b72ed678
commit 82c272990c
3 changed files with 59 additions and 55 deletions

View file

@ -15,20 +15,20 @@ from .tree import Tree as TreeData
from . import trove as tr
from .trove import Note, Trove, TreeNote, BlobNote, TreeEntry, NoteNotFound
from .trove import Note, Trove, TreeNote, BlobNote, TreeEntry, NoteNotFound, ObjectId
class NoteImpl(Note):
"""Concrete not implementation"""
def __init__(self, parent: 'TroveImpl', object_id: int):
def __init__(self, parent: 'TroveImpl', object_id: ObjectId):
self._parent = parent
self._db = parent.db
self._object_id = object_id
# Note protocol
@property
def object_id(self) -> int:
def object_id(self) -> ObjectId:
return self._object_id
@property
@ -123,7 +123,7 @@ class TreeNoteImpl(NoteImpl, TreeNote):
for name, object_id in tree.list().items():
yield TreeEntry(name, object_id)
def list(self) -> dict[str, int]:
def list(self) -> dict[str, ObjectId]:
"""Return all entries as {name: object_id}."""
return self._read_tree().list()
@ -168,7 +168,7 @@ class TroveImpl:
self.close()
# Trove protocol
def get_raw_note(self, note_id: int) -> Note:
def get_raw_note(self, note_id: ObjectId) -> Note:
"""Return a BlobNote or TreeNote for the given id, or None if not found."""
ot = self._db.get_object_type(note_id)
if ot is None: