Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-document "Pando" MongoDriver format #71

Merged
merged 26 commits into from
Sep 17, 2023

Conversation

prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Sep 17, 2023

Implements #2.

Make sure we're starting from a clean slate.
Turns out all the pain of dealing with Document vs BsonDocument was
self-inflicted. We can just deal with BsonDocument everywhere and
benefit from increased type safety.
Transactions don't work the way I assumed, so I've decided to make a
wrapper class, TransactionalCollection, that works the way I want.

It maintains a ThreadLocal<ClientSession> and injects that into every
operation, ensuring that we won't accidentally do a one-off operation
that punches through the transaction.

It's also flexible about transaction semantics. Code that needs its
operations to be in a single transaction can call
ensureTransactionStarted, and it's ok for this to be called repeatedly
at mutiple levels of the stack. Then MainDriver calls
commitTransactionIfAny at the end of every session (unless an exception
is thrown). The result is that transactions can be begun at any level of
the stack, and will be committed at the appropriate time.

This flexibility allows code like SequoiaDriver to remain agnostic about
transactions, since that driver doesn't actually need them for its own
sake; but MainDriver needs a transaction for refurbish, and it can
establish one with no cooperation from SequoiaDriver. Conversely,
PandoDriver will need transactions for almost every operation, and it
can establish them too; and yet later, if PandoDriver finds ways to skip
transactions in certain cases, it has the freedom to do so.
@prdoyle prdoyle force-pushed the mongo-multi branch 3 times, most recently from 188b067 to bdda81d Compare September 17, 2023 18:19
This allows the initial Pando implementation commit to show all the
changes between the two.
@prdoyle prdoyle mentioned this pull request Sep 17, 2023
@prdoyle prdoyle changed the title Mongo multi Multi-document "Pando" MongoDriver format Sep 17, 2023
@prdoyle prdoyle merged commit a54fa15 into venasolutions:develop Sep 17, 2023
1 check passed
@prdoyle prdoyle deleted the mongo-multi branch September 17, 2023 20:45
@prdoyle prdoyle restored the mongo-multi branch May 2, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant