Imagine Transparency: Difference between revisions

From m204wiki
Jump to navigation Jump to search
Created page with "The <var class="product">Imagine Transparency</var> facility allows <var class="product">Model 204</var> programs to access files stored in the <var class="product">Imagine</var> database as if they were local files. This facility is available in <var class="product">Model 204</var> Version 8.0 and later. While a fair amount of setup is required to define and populate the <var class="product">Imagine</var> files being accessed in Transparency mode, and create <var>Imagi..."
 
Expand: SOUL access model, RELEASE IMAGINE RECORDS, IMAGINE EXTRACT/SYNC/ENDSYNC + DISPLAY IMAGINESYNC, restrictions, See also, category
 
Line 9: Line 9:
</p>
</p>
Once this is done, any reference to <var>SOMEFILE</var> in a<var class="product">Model 204</var> application (including in file groups) would access the data from <var class="product">Imagine</var> via the <var>IMAGINET</var> port. Note that a single <var class="product">Model 204</var> file can corresponding to many <var class="product">Imagine</var> files if record types are used.
Once this is done, any reference to <var>SOMEFILE</var> in a<var class="product">Model 204</var> application (including in file groups) would access the data from <var class="product">Imagine</var> via the <var>IMAGINET</var> port. Note that a single <var class="product">Model 204</var> file can corresponding to many <var class="product">Imagine</var> files if record types are used.
==Accessing Imagine files from SOUL==
No application changes are required to read or update a Transparency file. Ordinary SOUL statements such as <var>FIND</var>, <var>FOR EACH RECORD</var>, <var>FIND AND PRINT COUNT</var>, <var>STORE RECORD</var>, <var>CHANGE</var>, <var>ADD</var>, and <var>DELETE</var> operate on a Transparency file exactly as they do on a native <var class="product">Model 204</var> file. <var class="product">Model 204</var> transparently sends the corresponding requests to the <var class="product">Imagine</var> broker over the <var>IMAGINET</var> port and returns the results to the application.
To reduce broker round trips, <var class="product">Model 204</var> caches the results of Transparency finds and prefetches records from find result sets. Cached finds are automatically deoptimized and revalidated when records they reference are changed, so applications always see a consistent view of the data.
===Releasing held records===
Records retrieved from <var class="product">Imagine</var> are held on a Transparency thread for the duration of the request. The <var>RELEASE IMAGINE RECORDS</var> statement releases those held records and frees the Transparency thread. Specify the <var>CLEARLISTS</var> option to also clear any <var class="term">$lists</var> and <var class="term">StringLists</var> that reference the released records:
<p class="pre">RELEASE IMAGINE RECORDS CLEARLISTS
</p>
==Populating and synchronizing Imagine files==
Before a <var class="product">Model 204</var> file can be switched to Transparency mode, its data must be loaded into <var class="product">Imagine</var>. The <var>[[IMAGINE command]]</var> extracts the data from an existing <var class="product">Model 204</var> file and loads it into <var class="product">Imagine</var>:
<ul>
<li><var>IMAGINE EXTRACT</var> copies the file's records to <var class="product">Imagine</var> as a one-time operation.</li>
<li><var>IMAGINE SYNC</var> copies the records and then keeps <var class="product">Model 204</var> and <var class="product">Imagine</var> in sync, so that subsequent updates are also applied to <var class="product">Imagine</var>. This makes it feasible to switch a file to Transparency mode with a minimal outage.</li>
<li><var>IMAGINE ENDSYNC</var> ends a SYNC or EXTRACT for the file.</li>
</ul>
The <var>[[DISPLAY IMAGINESYNC command]]</var> lists all files that are currently in <var>IMAGINE SYNC</var> mode.
==Restrictions==
The following operations are not supported against an <var class="product">Imagine</var> Transparency file:
<ul>
<li><var>DEFINE FIELD</var> &mdash; field definitions are determined by the underlying <var class="product">Imagine</var> file and cannot be changed from <var class="product">Model 204</var>.</li>
<li><var>FOR EACH RECORD IN ORDER</var> &mdash; ordered retrieval is not supported for Transparency files.</li>
</ul>
==See also==
<ul>
<li><var>[[IMAGINE command]]</var></li>
<li><var>[[DISPLAY IMAGINESYNC command]]</var></li>
<li><var>[[JANUS DEFINE]]</var> (the <var>IMAGINET</var> port type)</li>
<li><var>[[DEFINE DATASET command]]</var> (allocating a file <var>WITH IMAGINE</var>)</li>
<li>[[Release notes for Model 204 version 8.0#Imagine Transparency support|Model 204 version 8.0 release notes]]</li>
</ul>
[[Category:File management]]

Latest revision as of 01:42, 27 August 2026

The Imagine Transparency facility allows Model 204 programs to access files stored in the Imagine database as if they were local files. This facility is available in Model 204 Version 8.0 and later.

While a fair amount of setup is required to define and populate the Imagine files being accessed in Transparency mode, and create Imagine broker processes to provide Model 204 access to the Imagine files, very little setup is required on Model 204.

First, an IMAGINET port must be defined in an Online that would be using Transparency Mode. The number of connections required is the maximum number of threads simultaneously accessing Imagine files in the Online. The total number of threads in the Online is, of course, an upper bound for this number.

Then, each Model 204 file hosted on Imagine needs to be allocated as an Imagine file. For example:

ALLOCATE SOMEFILE WITH IMAGINE

Once this is done, any reference to SOMEFILE in aModel 204 application (including in file groups) would access the data from Imagine via the IMAGINET port. Note that a single Model 204 file can corresponding to many Imagine files if record types are used.

Accessing Imagine files from SOUL

No application changes are required to read or update a Transparency file. Ordinary SOUL statements such as FIND, FOR EACH RECORD, FIND AND PRINT COUNT, STORE RECORD, CHANGE, ADD, and DELETE operate on a Transparency file exactly as they do on a native Model 204 file. Model 204 transparently sends the corresponding requests to the Imagine broker over the IMAGINET port and returns the results to the application.

To reduce broker round trips, Model 204 caches the results of Transparency finds and prefetches records from find result sets. Cached finds are automatically deoptimized and revalidated when records they reference are changed, so applications always see a consistent view of the data.

Releasing held records

Records retrieved from Imagine are held on a Transparency thread for the duration of the request. The RELEASE IMAGINE RECORDS statement releases those held records and frees the Transparency thread. Specify the CLEARLISTS option to also clear any $lists and StringLists that reference the released records:

RELEASE IMAGINE RECORDS CLEARLISTS

Populating and synchronizing Imagine files

Before a Model 204 file can be switched to Transparency mode, its data must be loaded into Imagine. The IMAGINE command extracts the data from an existing Model 204 file and loads it into Imagine:

  • IMAGINE EXTRACT copies the file's records to Imagine as a one-time operation.
  • IMAGINE SYNC copies the records and then keeps Model 204 and Imagine in sync, so that subsequent updates are also applied to Imagine. This makes it feasible to switch a file to Transparency mode with a minimal outage.
  • IMAGINE ENDSYNC ends a SYNC or EXTRACT for the file.

The DISPLAY IMAGINESYNC command lists all files that are currently in IMAGINE SYNC mode.

Restrictions

The following operations are not supported against an Imagine Transparency file:

  • DEFINE FIELD — field definitions are determined by the underlying Imagine file and cannot be changed from Model 204.
  • FOR EACH RECORD IN ORDER — ordered retrieval is not supported for Transparency files.

See also