Database / Mnesia intermediate to advanced Interview questions
How does mnesia:activity/4 let you customize the access context of an operation?
mnesia:activity(AccessContext, Fun, Args, Module) is the general-purpose entry point underlying
transaction/1, sync_transaction/1, and the dirty variants — those are really
just convenience wrappers around activity/4 with a specific context pre-selected.
mnesia:activity(transaction, fun update_balance/2, [AccountId, Amount], mnesia). mnesia:activity(async_dirty, fun log_event/1, [Event], mnesia).
Calling activity/4 directly is useful when you want to select the access context
dynamically — for example, choosing between a transactional and a dirty path for the same piece of
business logic based on a runtime flag, rather than hardcoding which wrapper function you call. The last
argument (Module) lets you plug in a completely custom access-context implementation, which is
also how table fragmentation's mnesia_frag module hooks into the same mechanism.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
