picm_synchronizecache

This function synchronizes the point and digital cache files as well as updates the PI Server version stored in the cache.

C format

int32 picm_synchronizecache(

pibool bRestart );

Returns

0

No more points

1

More points

-20020

No cache file for current host

-20028

System error

Arguments

bRestart (passed)

Restart synchronization from beginning

Usage Notes

The caller of this function must have previously called picm_opencache to open the cache file and piut_setservernode to set the PI Server if a call to piut_setservernode had been made since the initial call to picm_opencache.

This function is used to synchronize the cache files with any changes that have been made on the Point Database for the PI Server. Each call to this function updates one point or digital state in the cache files. The process is as follows. First, a server associated with specific pointsource(s) found in the SCacheConfig::m_aPointSources will have all tags with the pointsource(s) synchronized to match the PI Server. Points not already found in cache will be added to the cache. Secondly, all points in the cache not associated with specific pointsource(s) found in the SCacheConfig::m_aPointSources used in the initial call to picm_opencache will be synchronized at a rate of one point per call to this function. Finally, any digital state sets associated with the current point list in the cache will be synchronized. Digital state set string values will not be synchronized if the SCacheConfig::m_bNoDigitalStateStrings is set to true during the call to picm_opencache. The function will return 0 (NO_MORE_POINTS) to the caller once synchronization is complete. Updates to the cache will be made available by regularly calling picm_serverupdates.

The call to picm_opencache will define how the cache is to be synchronized. The following cache synchronization options describe how updates are made.

SYNCH_NONE - No cache synchronization will be performed. A call to picm_synchronizecache will return NO_MORE_POINTS (0). No updates are made available for pipt_updates or picm_serverupdates. However, the user can still receive current changes if a call to pipt_signupforupdates is made while connected to the PI Server. In this case, any point change made on the PI Server can be retrieved with a call to pipt_updates. The retrival of the update will result in the cache being updated to reflect the change made on the PI Server. Changes made prior to the call to pipt_signupforupdates will not be available.

SYNCH_USE_PIPT_UPDATES - Cache synchronization performed with updates available via pipt_updates. This is the recommended option. This option will require the cache to be synchronized on startup if the returned cache state is CACHE_COMPLETE or CACHE_INCOMPLETE, as well as after a communicaitons failure with the PI Server.

SYNCH_USE_PICM_UPDATES - Cache synchronization performed with updates available via picm_serverupdates. This option requires the entire cache be synchronized periodically to obtain updates; which could be time consuming. If the application will be calling pipt_signupforupdates and pipt_updates, then use the SYNCH_USE_PIPT_UPDATES option.

SYNCH_CACHE_ONLY - Cache synchronization performed. No updates are made available for pipt_updates or picm_serverupdates. However, the user can still receive current changes if a call to pipt_signupforupdates is made while connected to the PI Server. In this case, changes made on the PI Server after the call to picm_sychronizecache can be retrieved with a call to pipt_updates. The retrival of the update will result in the cache being updated to reflect the change made on the PI Server. Changes made prior to the call to pipt_signupforupdates and after a call to picm_synchronizecache will not be available.

Enabling Operational Intelligence