RegisterSign In

API Documentation: Class SDBSession

Package: com.mckoi.sdb

The client interface for interacting with a Simple Database path instance. The object provides a stable session state in which transactions can be started and interaction with the data model can be performed. SDBSession objects are intended to be long lived.

Constructors Summary

SDBSession(MckoiDDBClient client, String path_name)

Methods Summary

String getPathName()
SDBTransaction createTransaction(SDBRootAddress root_address)
SDBTransaction createTransaction()
SDBRootAddress getCurrentSnapshot()
SDBRootAddress[] getHistoricalSnapshots(long time_start, long time_end)
boolean equals(Object ob)

Constructor Details

SDBSession(MckoiDDBClient client, String path_name)

Constructs the SDBSession with the MckoiDDBClient object (needed to talk with the network) and the path instance name of the database on the network.

Method Details

String getPathName()

Returns the name of the path instance of this session.

SDBTransaction createTransaction(SDBRootAddress root_address)

Returns an SDBTransaction object based on the data in the given root address. This method is useful for reducing the amount of traffic on the network needed to check if an instance path has changed. Many applications do not always need to fetch the most current snapshot when reading data because it doesn't matter if the information is slightly out of date.

This method allows a client to decide for itself when it wants to check if the state of a database has been updated, and allows reusing the old snapshot views when it is appropriate to do so.

SDBTransaction createTransaction()

Creates a current snapshot transaction object used for accessing and modifying this Simple Database path instance. This method will query the network and fetch the latest version of the path instance from the root server.

This is the same as calling 'createTransaction(getCurrentSnapshot())'.

SDBRootAddress getCurrentSnapshot()

Returns an SDBRootAddress that represents the most current snapshot of this path instance. This method will query the network and fetch the latest version from the root server.

SDBRootAddress[] getHistoricalSnapshots(long time_start, long time_end)

Returns an historical set of root node addresses committed to this path between the times given, where the time values follow the conventions of System.currentTimeMillis().

Note that the returned root nodes may not be completely accurate because the mechanism that records the time for each commit does not follow a strict requirement for accuracy. For example, if a root server managing commits for a path instance fails over to a new host, the clock on the new host may be out of sync with the previous host thus it may appear that some commits have happened at the same time and not in a serial sequence.

Therefore consider the nodes returned by this method to be a reasonable approximation of all the snapshot states committed in the given time span.

boolean equals(Object ob)

Returns true if the sessions compare equally.

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 - 2018 Diehl and Associates, Inc. All rights reserved.