<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1999</year><year>2016</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    
    </legalnotice>

    <title>CosTransactions_Coordinator</title>
    <prepared></prepared>
    <docno></docno>
    <checked></checked>
    <date>1999-04-12</date>
    <rev>PA1</rev>
  </header>
  <module>CosTransactions_Coordinator</module>
  <modulesummary>This module implements the OMG CosTransactions::Coordinator interface.</modulesummary>
  <description>
    <p>To get access to the record definitions for the structures use:      <br></br>
<c>-include_lib("cosTransactions/include/CosTransactions.hrl").</c></p>
  </description>
  <funcs>
    <func>
      <name>create_subtransaction(Coordinator) -> Control</name>
      <fsummary>Create a new subtransaction.</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Control = #objref</v>
      </type>
      <desc>
        <p>A new subtransaction is created whose parent is the Coordinator argument.</p>
        <p>Raises exception:</p>
        <list type="bulleted">
          <item>'SubtransactionsUnavailable' - if nested transactions are not supported.</item>
          <item>'Inactive' - if target transaction has already been prepared.</item>
        </list>
      </desc>
    </func>
    <func>
      <name>get_transaction_name(Coordinator) -> Name</name>
      <fsummary>Return the name associated with the object.</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Name = string() of type "oe_name@machine_type_timestamp"</v>
      </type>
      <desc>
        <p>Returns a printable string, which describe the transaction. The main purpose is to support debugging.</p>
      </desc>
    </func>
    <func>
      <name>get_parent_status(Coordinator) -> Status</name>
      <fsummary>Return the status of the parent transaction.</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Status = atom()</v>
      </type>
      <desc>
        <p>Returns the status of the parent transaction
          associated with the target object. If the target object is a top-level
          transaction this operation is equivalent to <c>get_status/1</c> operation. </p>
        <p>Possible Status replies:</p>
        <list type="bulleted">
          <item>'StatusCommitted'</item>
          <item>'StatusCommitting'</item>
          <item>'StatusMarkedRollback'</item>
          <item>'StatusRollingBack'</item>
          <item>'StatusRolledBack'</item>
          <item>'StatusActive'</item>
          <item>'StatusPrepared'</item>
          <item>'StatusUnknown'</item>
          <item>'StatusNoTransaction'</item>
          <item>'StatusPreparing'</item>
        </list>
      </desc>
    </func>
    <func>
      <name>get_status(Coordinator) -> Status</name>
      <fsummary>Return the status of the transaction associated with the target object</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Status = atom()</v>
      </type>
      <desc>
        <p>Returns the status of the transaction associated with the target object.</p>
      </desc>
    </func>
    <func>
      <name>get_top_level_status(Coordinator) -> Status</name>
      <fsummary>Return the status of the top-level transaction associated with the target object</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Status = atom()</v>
      </type>
      <desc>
        <p>Returns the status of the top-level transaction associated with the target object.</p>
      </desc>
    </func>
    <func>
      <name>hash_top_level_tran(Coordinator) -> Return</name>
      <fsummary>Return a hash code for the top-level transaction  associated with the target object</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Return = integer()</v>
      </type>
      <desc>
        <p>Returns a hash code for the top-level transaction 
          associated with the target object. Equals the operation
          <c>hash_transaction/1</c> if the target object is a top-level transaction.</p>
      </desc>
    </func>
    <func>
      <name>hash_transaction(Coordinator) -> Return</name>
      <fsummary>Return a hash code for the transaction associated with the target object.</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Return = integer()</v>
      </type>
      <desc>
        <p>Returns a hash code for the transaction associated with the target object.</p>
      </desc>
    </func>
    <func>
      <name>is_descendant_transaction(Coordinator, OtherCoordinator) -> Return</name>
      <fsummary>Return a boolean which indicates whether the transaction associated  with the target object is a descendant of the transaction associated with the parameter object</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>OtherCoordinator = #objref</v>
        <v>Return = Boolean</v>
      </type>
      <desc>
        <p>Returns true if the transaction associated with the target object is a 
          descendant of the transaction associated with the parameter object.</p>
      </desc>
    </func>
    <func>
      <name>is_same_transaction(Coordinator, OtherCoordinator) -> Return</name>
      <fsummary>Return true if the transaction associated with the target object is  related to the transaction associated with the parameter object</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>OtherCoordinator = #objref</v>
        <v>Return = Boolean</v>
      </type>
      <desc>
        <p>Returns true if the transaction associated with the target object is 
          related to the transaction associated with the parameter object.</p>
      </desc>
    </func>
    <func>
      <name>is_top_level_transaction(Coordinator) -> Return</name>
      <fsummary>Return true if the transaction associated with the target object is  a top-level transaction</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Return = Boolean</v>
      </type>
      <desc>
        <p>Returns true if the transaction associated with the target object is 
          a top-level transaction.</p>
      </desc>
    </func>
    <func>
      <name>register_resource(Coordinator, Resource) -> RecoveryCoordinator</name>
      <fsummary>Register the parameter <c>Resource</c>object as a participant in the transaction associated with the target object</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Resource = #objref</v>
        <v>RecoveryCoordinator = #objref</v>
      </type>
      <desc>
        <p>This operation registers the parameter <c>Resource</c> object as a participant in the
          transaction associated with the target object. The <c>RecoveryCoordinator</c> returned
          by this operation can be used by this Resource during recovery.</p>
        <note>
          <p>The Resources will be called in FIFO-order when preparing or committing.
            Hence, be sure to register the Resources in the correct order.</p>
        </note>
        <p>Raises exception:</p>
        <list type="bulleted">
          <item>'Inactive' - if target transaction has already been prepared.</item>
        </list>
      </desc>
    </func>
    <func>
      <name>register_subtran_aware(Coordinator, SubtransactionAwareResource) -> Return</name>
      <fsummary>Register the parameter <c>SubtransactionAwareResource</c>object such that it will be notified when the transaction, associated wit the target object,  has committed or rolled back</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Return = ok</v>
      </type>
      <desc>
        <p>This operation registers the parameter <c>SubtransactionAwareResource</c> object such that
          it will be notified when the transaction, associated wit the target object, 
          has committed or rolled back.</p>
        <note>
          <p>The Resources will be called in FIFO-order.
            Hence, be sure to register the Resources in the correct order.</p>
        </note>
      </desc>
    </func>
    <func>
      <name>rollback_only(Coordinator) -> Return</name>
      <fsummary>Modify the transaction associated with the target object so the only possible outcome is to rollback the transaction</fsummary>
      <type>
        <v>Coordinator = #objref</v>
        <v>Return = ok</v>
      </type>
      <desc>
        <p>The transaction associated with the target object is modified so the only
          possible outcome is to rollback the transaction.</p>
      </desc>
    </func>
  </funcs>
  
</erlref>

