Class ContextVersionCounter

java.lang.Object
org.gcube.informationsystem.resourceregistry.contexts.ContextVersionCounter

public class ContextVersionCounter extends Object
Stores the authoritative version of the persisted Context topology.
Author:
Luca Frosini (ISTI - CNR)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Value returned when the authoritative version cannot be read.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    Reads the authoritative Context version from OrientDB.
    static long
    increment(com.orientechnologies.orient.core.db.document.ODatabaseDocument session)
    Advances the Context version inside the caller's active transaction.
    static void
    Creates the durable counter outside application mutation transactions when necessary.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UNKNOWN_VERSION

      public static final long UNKNOWN_VERSION
      Value returned when the authoritative version cannot be read.
      See Also:
  • Method Details

    • initialize

      public static void initialize() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates the durable counter outside application mutation transactions when necessary.
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the counter cannot be initialized
    • increment

      public static long increment(com.orientechnologies.orient.core.db.document.ODatabaseDocument session) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Advances the Context version inside the caller's active transaction.
      Parameters:
      session - the active writer session
      Returns:
      the new version
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the version cannot be advanced
    • getCurrentVersion

      public static long getCurrentVersion()
      Reads the authoritative Context version from OrientDB.
      Returns:
      the current version, zero before the first mutation, or UNKNOWN_VERSION