home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osr1.exe / src / IAVLSVR.idl < prev    next >
Text File  |  1997-03-21  |  9KB  |  213 lines

  1. /* @(#)Z 1.5 os2/src/storage/idl/IAVLSVR.idl, oddataxfer, od96os2, odos29712d 97/03/21 17:21:41 (96/08/23 01:43:18) */
  2. //#====START_GENERATED_PROLOG======================================
  3. //#
  4. //#
  5. //#   COMPONENT_NAME: oddataxfer
  6. //#
  7. //#   CLASSES: none
  8. //#
  9. //#   ORIGINS: 82,27
  10. //#
  11. //#
  12. //#   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13. //#   All Rights Reserved
  14. //#   Licensed Materials - Property of IBM
  15. //#   US Government Users Restricted Rights - Use, duplication or
  16. //#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. //#       
  18. //#   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19. //#   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. //#   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21. //#   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22. //#   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. //#   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24. //#   OR PERFORMANCE OF THIS SOFTWARE.
  25. //#
  26. //#====END_GENERATED_PROLOG========================================
  27. //#
  28.  
  29. /********************************************************************/
  30. /*                                                                  */
  31. /* Copyright (C) Apple Computer, Inc., 1994                         */
  32. /*                                                                  */
  33. /********************************************************************/
  34.  
  35. #ifndef _IAVLSVR_
  36. #define _IAVLSVR_
  37.  
  38. #include <somobj.idl>
  39. #include <snglicls.idl>
  40. #include <ILSv2AS.idl>
  41. #include <ILTr2LSr.idl>
  42.  
  43. // #ifdef __PRIVATE__
  44. //   #ifndef _AEHashTable_
  45. //     #define _AEHashTable_
  46. //     typedef somToken AEHashTable;
  47. //   #endif
  48. // #endif //__PRIVATE__
  49.  
  50. #ifdef __PRIVATE__
  51.   #ifndef _OpenHashTable_
  52.     #define _OpenHashTable_
  53.     typedef somToken OpenHashTable;
  54.   #endif
  55. #endif //__PRIVATE__
  56.  
  57. // Defect 22446
  58. #ifndef _AVSShell_
  59.   #define _AVSShell_
  60.   typedef somToken AvsShell;
  61. #endif
  62.  
  63.  
  64. interface IODAvailServerToLinkService;
  65. interface ODDraft;
  66. interface IODMutex;
  67.  
  68. /*
  69.  * AvailServer is the interface to the Availability Server (AS).  There is
  70.  * at least one instance of an AS per file system.  Usually there is one
  71.  * AS per machine.  The main purpose of the AS is to make link content
  72.  * available to inter-document link targets when the source document is not
  73.  * open.  If a document registers with a particular AS, then all
  74.  * of its LinkSource objects will register with this AS.
  75.  *
  76.  * The AS consists of a manager and a dispatcher (in one object).
  77.  *
  78.  * Targets of registered LinkSources are given a pointer to the dispatcher,
  79.  * which exposes the IODLinkTargetToLinkSource interface.
  80.  * (This interface is used by
  81.  * IODLink objects and is hidden from part programmers).  The dispatcher
  82.  * forwards all target calls to the LinkSource object in the document if
  83.  * the document is open.  Otherwise the dispatcher forwards the calls to
  84.  * a LinkSourceSurrogate object in the AS.
  85.  *
  86.  * The AS manager is responsible
  87.  * for tracking registered documents and whether they are open or not.  It
  88.  * also internalizes/externalizes LinkSourceSurrogates when needed by
  89.  * opening the appropriate document file container and locating the appropriate
  90.  * LinkSource SU.  If a document is open but a particular LinkSource
  91.  * requested by the dispatcher is not yet opened, the AS manager will contact
  92.  * the linkservice of the document and ask that this LinkSource be
  93.  * internalized.
  94.  *
  95.  * The state of each LinkSource is divided into 3 categories:
  96.  * the "main" state, the "auxiliary" state, and the lock.  The main state
  97.  * has two properties: (1) it cannot change while the document is closed;
  98.  * (2) it reverts upon a crash or an explicit rollback to an earlier draft.
  99.  * Main state includes a changeID, the contentSU, and
  100.  * references to intra-document targets.  The auxiliary
  101.  * state can change as a result of actions of remote documents,
  102.  * and wherever possible is kept up-to-data despite crashes and rollbacks.
  103.  * The auxiliary state includes information about registered and
  104.  * tracked targets.
  105.  * The lock flag is handled separately since the AS Manager
  106.  * must retain locked LinkSourceSurrogates in the AS even though
  107.  * a LinkSource is also being created in the document.  During
  108.  * the time that both a LinkSource and a LinkSourceSurrogate
  109.  * exist, the LinkSourceSurrogate can only be used for the
  110.  * purpose of reading its ContentSU.  It will be freed up
  111.  * as soon as the lock is released.
  112.  *
  113.  * LinkSources externalize both their main state and auxiliary
  114.  * state into their document's container.  LinkSourceSurrogates
  115.  * additionally maintain the auxiliary state in an SU belonging
  116.  * to the AS "document".  As an optimization, the surrogate
  117.  * auxiliary state SU is absent if there is no change from the
  118.  * last saved auxiliary state of the document.  Saved auxiliary
  119.  * states are tagged with version numbers.
  120.  * When a link source is closed, the auxiliary state is
  121.  * passed to the availability server, which creates
  122.  * an auxiliary state SU for it.  This will be empty if the
  123.  * auxiliary state did not change between the last save
  124.  * and the time of close.  When a link source is re-opened,
  125.  * the auxiliary state is passed back from the availability
  126.  * server to the link source.  If this auxiliary state is empty,
  127.  * the link source uses its last saved value from the document.
  128.  * If it is not empty, then the LinkSource will initialize
  129.  * its auxiliary state from the most recent version of the version
  130.  * in the document and the version in the AS.
  131.  */
  132. interface IODAvailServer : IODLinkServiceToAvailServer,
  133.                            IODLinkTargetToLinkSource
  134. {
  135.   void InitAvailServer(in ODBoolean isNew,
  136.                        in AvsShell* shell,
  137.                        in ODDraft asDraft,
  138.                        in ODDraft surrogateDraft);
  139.     // InitAvilServer is called by the AS Shell to initialize the AS.
  140.     // It supplies
  141.     // the AS with 2 drafts.  asDraft contains the persistent storage used
  142.     // by the AS: it contains the AS manager tables and the
  143.     // SurrogateWriteableState for each LinkSource registered with this AS.
  144.     // surrogateDraft is a temporary (in-memory) draft containing the
  145.     // opened LinkSourceSurrogates and their referenced contentSUs.
  146.  
  147.   #ifdef __SOMIDL__
  148.     implementation {
  149.       metaclass = SOMMSingleInstance;
  150.  
  151.       override:
  152.         somInit,
  153.         somUninit,
  154.       #ifdef __PRIVATE__
  155.         ForwardGetUpdateID,
  156.         ForwardGetChangeTime,
  157.         ForwardGetContentStorageUnit,
  158.         ForwardLock,
  159.         ForwardUnlock,
  160.         GetSourcePartDescription,
  161.         LinkTargetClosed,
  162.         LinkTargetRemoved,
  163.         LinkTargetReopened,
  164.         AddLinkTarget,
  165.         LockToRead,
  166.         RegisterTrackedLinkTarget,
  167.         RegisterUntrackedLinkTarget,
  168.         ShowSourceContentFor,
  169.         TargetPartDescriptionChanged,
  170.         UnregisterLinkTarget,
  171.         #endif  // __PRIVATE__
  172.         RegisterDoc,
  173.         UnregisterDoc,
  174.         DocOpened,
  175.         DocClosed,
  176.         DocMoved,
  177.         RegisterLink,
  178.         LinkOpened,
  179.         LinkClosed,
  180.         RemoveLink;
  181.  
  182.       releaseorder:
  183.         InitAvailServer;
  184.  
  185.       #ifdef __PRIVATE__
  186. //        AEHashTable   *fDocuments;    // IODDocumentID->
  187.         OpenHashTable   *fDocuments;    // IODDocumentID->
  188.                                       // <pathname,
  189.                                       //  list of linkids,
  190.                                       //  LinkService>
  191. //        AEHashTable   *fLinks;        // ODLinkID->
  192.         OpenHashTable   *fLinks;        // ODLinkID->
  193.                                       // <state: unloaded/indoc/inas/inboth,
  194.                                       //  IODDocumentID,
  195.                                       //  SUID AuxiliaryState,
  196.                                       //  ODBoolean IsLocked
  197.                                       //  IODLinkTargetToLinkSource ASLinkSrc,
  198.                                       //  IODLinkTargetToLinkSource DocLinkSrc>
  199.  
  200.         IODMutex      fMutex;
  201.         IODDocumentID fDocIDCounter;  // current value of counter
  202.         ODLinkID      fLinkIDCounter; // current value of counter
  203.         AvsShell*      fShell;
  204.         ODDraft       fAsDraft;
  205.         ODDraft       fSurrogateDraft;
  206. //      TBD: linked list of loaded LinkIds, ordered by last access time
  207.       #endif  // __PRIVATE__
  208.     };
  209.   #endif //__SOMIDL__
  210. };
  211.  
  212. #endif //_IAVLSVR_
  213.