boskworks / bosk

Apache License 2.0
2 stars 1 forks source link

Support writes inside Polyfills #34

Open prdoyle opened 1 day ago

prdoyle commented 1 day ago

MongoDriver should support writes inside polyfiled objects. Currently, such objects are present in memory, and can be read using Reference.value(), but MongoDriver differs from LocalDriver in that writes inside such objects will be ignored.

Copied from https://github.com/venasolutions/bosk/issues/108.

prdoyle commented 1 day ago

One way would be to to generate initialize calls just in case the infill objects don't exist; but I'm not sure that's even thread-safe.

Another way would be to "enlarge" the update so it actually updates the outermost enclosing polyfill. We'd need a way to modify the polyfill value to include the smaller value written inside it. In the case of MongoDriver this sort of manipulation is done using BSON; we could do the same for this case, though then this would not generalize to other kind of drivers unless they also use BSON.

prdoyle commented 1 day ago

Oh... a problem with the "enlarging" concept is that if another thread writes a value in there, we'll overwrite it. I think enlarging is out.

It either needs to be initialize or else some new driver operation. 🤔