Interface MongoDriver<R extends io.vena.bosk.StateTreeNode>

All Superinterfaces:
io.vena.bosk.BoskDriver<R>
All Known Implementing Classes:
MainDriver

public interface MongoDriver<R extends io.vena.bosk.StateTreeNode> extends io.vena.bosk.BoskDriver<R>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    MongoDriver.MongoDriverFactory<RR extends io.vena.bosk.StateTreeNode>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Frees up resources used by this driver and leaves it unusable.
    static <RR extends io.vena.bosk.StateTreeNode>
    MongoDriver.MongoDriverFactory<RR>
    factory(com.mongodb.MongoClientSettings clientSettings, MongoDriverSettings driverSettings, BsonPlugin bsonPlugin)
     
    void
    Deserializes and re-serializes the entire bosk contents, thus updating the database to match the current serialized format.

    Methods inherited from interface io.vena.bosk.BoskDriver

    flush, initialRoot, submitConditionalDeletion, submitConditionalReplacement, submitDeletion, submitInitialization, submitReplacement, submitReplacement
  • Method Details

    • refurbish

      void refurbish() throws IOException
      Deserializes and re-serializes the entire bosk contents, thus updating the database to match the current serialized format.

      Used to "upgrade" the database contents for schema evolution.

      This method does not simply write the current in-memory bosk contents back into the database, because that would lead to race conditions with other update operations. Instead, in a causally-consistent transaction, it reads the current database state, deserializes it, re-serializes it, and writes it back. This produces predictable results even if done concurrently with other database updates.

      This requires the database state to be in good condition at the outset; it can't generally be used to repair corrupted databases unless the corruption is so mild that it doesn't interfere with proper functioning beforehand. It can be expected to evolve the database from that of a supported prior format, but for unsupported formats or other corruption, YMMV.

      Throws:
      IOException
    • close

      void close()
      Frees up resources used by this driver and leaves it unusable.

      This is done on a best-effort basis. It's more useful for tests than for production code, where there's usually no reason to close a driver.

    • factory

      static <RR extends io.vena.bosk.StateTreeNode> MongoDriver.MongoDriverFactory<RR> factory(com.mongodb.MongoClientSettings clientSettings, MongoDriverSettings driverSettings, BsonPlugin bsonPlugin)