which in turn calls do stuff like db.ReadNode(nodeId, commitId, node).
We want to cache some index data from the Index tables.
For this in-memory cache to implement the same set of methods, TIndexTabletDatabase is replaced with an interface IIndexTabletDatabase, which is implemented by TInMemoryIndexState (which, for now, is a stub). Its superset, IIndexTabletDatabase is also implemented by TIndexTabletDatabase.
To ensure in-memory cache validity, every RW transaction that modifies inode index records all modifying operations, and on completion of those transactions, these operations will be applied to the in-memory state. This is done using TIndexTabletDatabaseProxy : public TIndexTabletDatabase (to be implemented), which forwards all requests to the underlying TIndexTabletDatabase.
classDiagram
TNiceDb <|-- TIndexTabletDatabase
TIndexTabletDatabase : actual implementation that accesses LocalDB
IIndexTabletDatabase <|-- TInMemoryIndexState
class TInMemoryIndexState {
- ApplyDelta(changes to inmemory state)
}
IIndexTabletDatabase <|-- TIndexTabletDatabase
class IIndexTabletDatabase {
+ bool ReadNode()
+ bool ReadNodeVer()
+ bool ReadNodeAttr_s()
+ bool ReadNodeAttrVer_s()
+ bool ReadNodeRef_s()
+ bool PrechargeNodeRefs()
+ bool ReadNodeRefVer_s()
}
TIndexTabletDatabase<|-- TIndexTabletDatabaseProxy : forwards all DB accesses
TIndexTabletDatabaseProxy: records all modifications of the tables
TInMemoryIndexState<|.. TIndexTabletDatabaseProxy : can apply recorded changes\nto in-memory state
Currently RO transactions access
TIndexTabletDatabase
viaTIndexTabletState
methods likewhich in turn calls do stuff like
db.ReadNode(nodeId, commitId, node)
.We want to cache some index data from the Index tables.
For this in-memory cache to implement the same set of methods,
TIndexTabletDatabase
is replaced with an interfaceIIndexTabletDatabase
, which is implemented byTInMemoryIndexState
(which, for now, is a stub). Its superset,IIndexTabletDatabase
is also implemented byTIndexTabletDatabase
.To ensure in-memory cache validity, every RW transaction that modifies inode index records all modifying operations, and on completion of those transactions, these operations will be applied to the in-memory state. This is done using
TIndexTabletDatabaseProxy : public TIndexTabletDatabase
(to be implemented), which forwards all requests to the underlyingTIndexTabletDatabase
.