LibWeb/IDB: Add internal Index object

This commit is contained in:
stelar7 2025-04-01 18:26:13 +02:00 committed by Andrew Kaster
commit 9321ad04c0
Notes: github-actions[bot] 2025-04-09 17:50:57 +00:00
6 changed files with 119 additions and 0 deletions

View file

@ -15,6 +15,7 @@
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/IndexedDB/Internal/Algorithms.h>
#include <LibWeb/IndexedDB/Internal/Database.h>
#include <LibWeb/IndexedDB/Internal/Index.h>
#include <LibWeb/IndexedDB/Internal/KeyGenerator.h>
namespace Web::IndexedDB {
@ -39,6 +40,9 @@ public:
GC::Ref<Database> database() const { return m_database; }
void add_index(GC::Ref<Index> index) { m_indexes.append(index); }
ReadonlySpan<GC::Ref<Index>> index_set() const { return m_indexes; }
protected:
virtual void visit_edges(Visitor&) override;
@ -48,6 +52,9 @@ private:
// AD-HOC: An ObjectStore needs to know what Database it belongs to...
GC::Ref<Database> m_database;
// AD-HOC: An Index has referenced ObjectStores, we also need the reverse mapping
Vector<GC::Ref<Index>> m_indexes;
// An object store has a name, which is a name. At any one time, the name is unique within the database to which it belongs.
String m_name;