RegisterSign In

API Documentation: Class ObjectDatabase

Package: com.mckoi.odb
implements com.mckoi.network.ConsensusProcessor

An implementation of a ConsensusProcessor for the Object Database data model. This class manages a the transaction rules of the object data model.

As a summary commit faults are generated in the following situations; 1) When an object is mutated concurrently (mutable components are ODBObjects with mutable fields and ODBData). 2) When a duplicate key is added to a list that does not allow duplicates. 3) When the same entry is removed from a list. 4) When the same named item is created or deleted concurrently. 5) When an object is created or modified and it references an object that is no longer valid, or the reference is added to a list or as a named item and is invalid.

Constructors Summary

ObjectDatabase()

Methods Summary

String getName()
String getDescription()
String getStats(ConsensusDDBConnection connection, DataAddress snapshot)
void initialize(ConsensusDDBConnection connection)
DataAddress commit(ConsensusDDBConnection connection, DataAddress proposal) throws CommitFaultException

Constructor Details

ObjectDatabase()

Method Details

String getName()

The name of this processor, displayed in the administration user interface.

String getDescription()

A description of this processor appropriate for display in the help section of the user interface.

String getStats(ConsensusDDBConnection connection, DataAddress snapshot)

Returns a String that briefly describes basic stats about the data model of the given snapshot. This function can return null if there are no stat functions implemented.

This string is intended to be displayed in a user interface to give some status feedback about a path instance to an administrator.

void initialize(ConsensusDDBConnection connection)

This function creates an initial data model state on a completely blank database. This is only ever called once during the lifespan of a particular state, and the given connection will always be a blank untouched database.

This function is intended to setup the state of a database to a beginning state.

DataAddress commit(ConsensusDDBConnection connection, DataAddress proposal)

Attempts to commit a proposed change and create an updated database state. The given ConsensusDDBConnection object provides access to the latest version of the database as well as historical information about previous states. The proposal is represented as a DataAddress object which is the root node of a data tree that will contain the details of the changes proposed.

If a proposed commit is rejected, this function throws a CommitFaultException and no change is made. If the proposal is accepted, the returned DataAddress is the new root node of this path instance.

Note that this method should be efficiently implemented because it is not possible to perform this function on a single path instance in multiple processes. The reason for this is because the current database state must be deterministic.

The text on this page is licensed under the Creative Commons Attribution 3.0 License. Java is a registered trademark of Oracle and/or its affiliates.
Mckoi is Copyright © 2000 - 2020 Diehl and Associates, Inc. All rights reserved.