summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/CosConcurrencyControl.idl
blob: 7c6b7fe83d0354e096f341159f88e32e40a1919d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    cos
//
// = FILENAME
//    CosTransaction.idl
//
// = DESCRIPTION
//    Described in CORBAservices: Common Object Services
//    Specification, chapter 7 The concurrency service description can
//    be downloaded from
//    ftp://www.omg.org/pub/docs/formal/97-11-02.idl
//
// = AUTHOR
//    OMG and Torben Worm <tworm@cs.wustl.edu>
//
// ============================================================================

//CosConcurrencyControl Module, page 7-8
//Includes the following interfaces:
//  LockCoordinator, LockSet, TransactionalLockSet, LockSetFactory

// The part depending on the transaction service may be included by defining
// TAO_HAS_TRANSACTION_CONTROL_SERVICE

#if defined (TAO_HAS_TRANSACTION_CONTROL_SERVICE)
#include <CosTransactions.idl>
#endif /* TAO_HAS_TRANSACTION_CONTROL_SERVICE */

module CosConcurrencyControl 
// = TITLE
//     CosConcurrencyControl
//
// = DESCRIPTION
//     This idl file describes the concurrency control service.
//     The purpose of the concurrency control service is to mediate
//     concurrent access to an pbject such that the consistency of
//     the object is not compromised when accessed by concurrently
//     executing computations.
{
  enum lock_mode 
  {
    read,
    write,
    upgrade,
    intention_read,
    intention_write
  };
  // This is the different lock types supported by this module. For a
  // description of the compatability between the different lock types
  // please consult the service description (OMG).

  exception LockNotHeld {};
  // The LockNotHeld exception is is raised when an operation to unlock
  // or change the mode of a lock is called and the specified lock is not
  // held

#if defined (TAO_HAS_TRANSACTION_CONTROL_SERVICE)
  // @@TAO I'm in doubt here. The lock coordinator is designed for
  //       transactional lock sets?? - tworm
  interface LockCoordinator
    {
      // = TITLE
      //     LockCoordinator drops all locks associated with a transaction.
      // = DESCRIPTION
      //     The LockCoordinator interface enables a transaction service to 
      //     drop all locks held by a transaction.

      void drop_locks ();
      // Releases all the locks held by the transaction. Designet to be
      // used by transaction service when a transaction commits or aborts.
    };
#endif /* TAO_HAS_TRANSACTION_CONTROL_SERVICE */

  interface LockSet
    {
      // = TITLE
      //     LockSet inteface to the concurrency service in implicit mode
      // = DESCRIPTION
      //     Clients operating in the implicit mode (i.e. non-transactional
      //     mode) acquire and release locks in lock sets throug this
      //     interface. The interface only provides operations to acquire
      //     and release locks on behalf of the calling thread or transaction.

      void lock (in lock_mode mode);
      // Acquires a lock on the specified lock set in the specified mode.
      // Blocks until lock is obtained

      boolean try_lock (in lock_mode mode);
      // Tries to acquire a lock on the specified lock set. If it is not
      // possible to acquire the lock false is returned

      void unlock (in lock_mode mode)
        raises (LockNotHeld);
      // Releases a single lock on the specified lock set. A lock can be
      // held multiple times in the same mode. If the lock is not held the
      // exception LockNotHeld is raised

      void change_mode (in lock_mode held_mode,
                        in lock_mode new_mode)
        raises (LockNotHeld);
      // Changes the mode of the lock on the specified lock set. If a
      // conflicting lock is held by another client the call blocks until
      // the new mode can be granted. If the lock is not held in the
      // specified mode the exception LockNotHeld is raised.

#if defined (TAO_HAS_TRANSACTION_CONTROL_SERVICE)
      LockCoordinator get_coordinator (in CosTransactions::Coordinator which);
      // Returns the lock coordinator associated with the specified
      // transaction.
#endif /* TAO_HAS_TRANSACTION_CONTROL_SERVICE */
    };

#if defined (TAO_HAS_TRANSACTION_CONTROL_SERVICE)
  interface TransactionalLockSet
    {
      // = TITLE
      //     TransactionalLockSet interface to the concurrency service
      //     in transactional mode
      // = DESCRIPTION
      //     Clients operating in the transactional mode acquire and
      //     release locks in lock sets through this interface. The
      //     interface provides operations identical to the operations
      //     described in the LockSet interface section. The difference
      //     beeing that the coordinator for the transaction is explicitly
      //     passed as a reference to the operations. Please see the
      //     description of the LockSet interface for a detailed description.
      
      void lock (in CosTransactions::Coordinator current,
                 in lock_mode mode);
      // See LockSet::lock
      
      boolean try_lock (in CosTransactions::Coordinator current,
                        in lock_mode mode);
      // See LockSet::try_lock
      
      void unlock (in CosTransactions::Coordinator current,
                   in lock_mode mode)
        raises (LockNotHeld);
      // See LockSet::unlock
      
      void change_mode (in CosTransactions::Coordinator current,
                        in lock_mode held_mode,
                        in lock_mode new_mode)
        raises (LockNotHeld);
      // See LockSet::change_mode
      
      LockCoordinator get_coordinator (in CosTransactions::Coordinator which);
      // See LockSet::get_coordinator
    };
#endif /* TAO_HAS_TRANSACTION_CONTROL_SERVICE */

  interface LockSetFactory
    {
      // = TITLE
      //     Factory interface for the LockSet and TransactionalLockSet
      //     interfaces
      // = DESCRIPTION
      //     Factory for creating the lock sets

      LockSet create ();
      // Creates a new LockSet and lock coordinator
      // @@TAO ??? is this correct? Lock coordinators are associated with
      //       transactions. - tworm

      LockSet create_related (in LockSet which);
      // Creates a lock set related to the specified lock set. Related lock
      // sets drop their locks together.

#if defined (TAO_HAS_TRANSACTION_CONTROL_SERVICE)
      TransactionalLockSet create_transactional ();
      // Creates a new TransactionalLockSet and lock coordinator for
      // transactional mode clients.

      TransactionalLockSet
	create_transactional_related (in TransactionalLockSet which);
      // Creates a new transactional lock set related to the specified lock
      // set. Related lock sets drop locks together.
#endif /* TAO_HAS_TRANSACTION_CONTROL_SERVICE */
    };
};