Closed phritz closed 4 years ago
On further thought, I think that it probably does not actually make sense to do puts/dels atomically with indexes in Replicache. This is different than a normal database where you'd be migrating old data because in Repliache the client is not the authority over the shape of the client view, the server is.
So I think we pull create/delIndex out of write tx and have it on its own for now.
sounds right, will do.
looks like the cleanest way to do this would be to introduce a new type of db transaction, say IndexChange, which would get the index methods from Write.
background: https://github.com/rocicorp/replicache-sdk-js/pull/168#pullrequestreview-518184528 https://github.com/rocicorp/replicache-sdk-js/pull/168#issuecomment-718967142
right now we have the ability to create indexes within normal transactions. because creating an index can be mixed in with other kinds of db ops, we have to have a mutator for it and it must be sent to the data layer. IF we decided that create/dropindex CANNOT be mixed in with other kinds of db ops -- that if you do a create/dropindex in a tx you can't do anything else -- then index changes can go into a separate kind of commit that we dont push to the server. this is cleaner for the customers data layer, but less nice as far as the transaction api is concerned because it makes index txs special which aaron has called out as annoying.
we need to make the call about whether to keep status quo or to make index txs exclusive of puts/dels/etc. i don't really have an opinion, happy to do what @arv or @aboodman think.