Diffusion C API  6.5.12
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
delta.h File Reference

Functions for generating deltas describing the changes to data, and applying deltas to data. More...

Macros

#define DIFF_DEFAULT_MAX_STORAGE
 When generating a delta, a chunk of memory is set aside for working storage. More...
 
#define DIFF_DEFAULT_BAILOUT_FACTOR
 In order to prevent complex delta generation from using up too much CPU (especially with larger messages), a bailout factor is referenced to abort the process early. More...
 

Functions

BUF_Tdiff_apply_binary (BUF_T *old_value, BUF_T *diff)
 Apply a delta to a value, producing a new value. More...
 
BUF_Tdiff_generate_binary (BUF_T *old_value, BUF_T *new_value)
 Generate a delta between two binary values. More...
 
BUF_Tdiff_generate_binary_ex (BUF_T *old_value, BUF_T *new_value, int max_storage, int bailout_factor)
 Generate a delta between two binary values, with additional control over variables that influence the process. More...
 
BUF_Tupdate_cache_get_value (SESSION_T *session, const char *topic_path)
 Returns the cached value for a given topic path. More...
 
void update_cache_remove_values (SESSION_T *session, const char *topic_selector)
 Removes values from the cache. More...
 
void update_cache_clear_values (SESSION_T *session)
 Clears the update value cache. More...
 

Detailed Description

Functions for generating deltas describing the changes to data, and applying deltas to data.

Copyright © 2016 Push Technology Ltd., All Rights Reserved.

Use is subject to license terms.

NOTICE: All information contained herein is, and remains the property of Push Technology. The intellectual and technical concepts contained herein are proprietary to Push Technology and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.

Macro Definition Documentation

#define DIFF_DEFAULT_BAILOUT_FACTOR

In order to prevent complex delta generation from using up too much CPU (especially with larger messages), a bailout factor is referenced to abort the process early.

If not explicitly specified, this is the value used. If the process does bail out, then a delta may still be generated but may not be of optimal length.

#define DIFF_DEFAULT_MAX_STORAGE

When generating a delta, a chunk of memory is set aside for working storage.

This is the default value if not explicity specified.

Function Documentation

BUF_T* diff_apply_binary ( BUF_T old_value,
BUF_T diff 
)

Apply a delta to a value, producing a new value.

buf_free should be called on the pointer when no longer needed.

Parameters
old_valueThe original value
diffThe delta (diff) to apply to the original value.
Return values
BUF_T *A pointer to a BUF_T containing the result of applying the delta to the original value.
BUF_T* diff_generate_binary ( BUF_T old_value,
BUF_T new_value 
)

Generate a delta between two binary values.

buf_free should be called on the pointer when no longer needed.

Parameters
old_valueThe source value
new_valueThe target value
Return values
BUF_T *A pointer to a BUF_T containing a delta describing how to transform the source value into the target value. If there are no differences or an error occurs, then NULL is returned.
BUF_T* diff_generate_binary_ex ( BUF_T old_value,
BUF_T new_value,
int  max_storage,
int  bailout_factor 
)

Generate a delta between two binary values, with additional control over variables that influence the process.

   `buf_free` should be called on the pointer when no longer needed.
Parameters
old_valueThe source value
new_valueThe target value
max_storageThe maximum amount of internal storage to use.
bailout_factorInfluences when to abort delta generation; smaller values will abort sooner. This is useful with larger messages where the process may use a significant amount of CPU time.
Return values
BUF_T *A pointer to a BUF_T containing a delta describing how to transform the source value into the target value. If there are no differences or an error occurs, then NULL is returned.
void update_cache_clear_values ( SESSION_T session)

Clears the update value cache.

update_value() caches the last value sent to the server so that subsequent updates can calculate deltas to send for efficiency. This allows the cache to be cleared.

If a cached value is removed, the next update for a topic will transmit the whole value to the server rather than a delta.

Parameters
sessionThe session which is performing the updates.
BUF_T* update_cache_get_value ( SESSION_T session,
const char *  topic_path 
)

Returns the cached value for a given topic path.

Cached values are only maintained for topics that are updated using update_value(). When an updater sends an update, the latest value is cached so that more efficient delta updates can be performed subsequently.

Parameters
sessionThe session which is performing the updates.
topic_pathSpecifies the topic to obtain the current value for.
Return values
BUF_T *A pointer to the latest value, or NULL if there is no value for the given path. This might be because no value has been sent, or the value has been removed from the cache. Note that this does not return a copy of the data, but a pointer to the data in the cache; it should not be directly freed (or modified) by the user.
void update_cache_remove_values ( SESSION_T session,
const char *  topic_selector 
)

Removes values from the cache.

Cached values are only maintained for topics that are updated using update_value(). When an updater sends an update, the latest value is cached so that more efficient delta updates can be performed subsequently.

If a cached value is removed, the next update for a topic will transmit the whole value to the server rather than a delta.

Parameters
sessionThe session which is performing the updates.
topic_selectorAll values that match the selector will be removed.