Giter VIP home page Giter VIP logo

Comments (1)

rnewman avatar rnewman commented on June 15, 2024

Copying over my review comments about this:

The reason I added the watcher was to abstract away this growing set of "when this happens inside transact, do this" behaviors. Imagine that we want to add an observer that fires if a particular value is seen, a particular entity is touched, or any datom is retracted.

You can easily imagine the observer API you've built being expressed as a watcher that collects notes about tx_ids, later (when the tx is committed) using those notes to dispatch particular TxReports to particular observers. Indeed, you can use an arbitrary datom-level predicate to decide whether a report is of interest.

The watcher approach means we don't do any work unless there are caches/observers, and we don't allocate memory unless the watcher needs to.

Using TransactWatcher scopes the problem down to:

  • What changes do I need to make to TransactWatcher to support observer workloads? It probably needs to be told the tx_id.
  • How do I make a TransactWatcher from the observer service to hand off to an InProgress?
  • How do I get the value back out when it's done?
  • How do I combine the cache watcher and the observer watcher? Big chunks of the transactor are generic over W, so we should try to avoid making too many watcher types that are used in the same codebase — monomorphization will balloon our binary size. To me that points to struct DefaultTransactWatcher(cache_watcher: Option<InProgressCacheTransactWatcher>, observer_watcher: Option<ObserverWatcher>)

The end result should be that the transactor doesn't know anything at all about observers, and doesn't track anything that the observer service needs, just as it doesn't track anything for the attribute cache — the watcher does all that.

from toodle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.