Clearly, the index maintenance aspect of a shelf can grow. With our simple data model, we could easily add more top-level indexes for tags, dates, and titles of Posts. Here's another access-layer implementation that defines two indices for Blogs. One index simply lists the keys for Blog entries. The other index provides keys based on the Blog title. We'll assume that the titles are not unique. We'll present this access layer in three parts. Here's the create part of the CRUD processing:
class Access4(Access3):
def new(self, path: Path) -> None:
super().new(path)
self.database["_Index:Blog_Title"] = dict()
def create_blog(self, blog):
super().create_blog(blog)
blog_title_dict = self.database["_Index:Blog_Title"]
blog_title_dict.setdefault(blog.title, [])
...