blob: 4786d6181e07ae1fb281cc0aac02f1bedc17b213 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Apache Geode Native C++ Reference: apache::geode::client::CacheWriter Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Apache Geode Native C++ Reference
&#160;<span id="projectnumber">1.13.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00391.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> </div>
<div class="headertitle">
<div class="title">apache::geode::client::CacheWriter Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>An application plug-in that can be installed on the region.
<a href="a00391.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab319be76cbfd4c23fc03b58c23b4dff8"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00391.html#ab319be76cbfd4c23fc03b58c23b4dff8">beforeCreate</a> (const <a class="el" href="a00459.html">EntryEvent</a> &amp;event)</td></tr>
<tr class="memdesc:ab319be76cbfd4c23fc03b58c23b4dff8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called before an entry is created. <a href="#ab319be76cbfd4c23fc03b58c23b4dff8">More...</a><br /></td></tr>
<tr class="separator:ab319be76cbfd4c23fc03b58c23b4dff8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a81ec54ad91d600062a7020d6639dede8"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00391.html#a81ec54ad91d600062a7020d6639dede8">beforeDestroy</a> (const <a class="el" href="a00459.html">EntryEvent</a> &amp;event)</td></tr>
<tr class="memdesc:a81ec54ad91d600062a7020d6639dede8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called before an entry is destroyed. <a href="#a81ec54ad91d600062a7020d6639dede8">More...</a><br /></td></tr>
<tr class="separator:a81ec54ad91d600062a7020d6639dede8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fc3cd668ae9cca65d92b6f9db0848d9"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00391.html#a1fc3cd668ae9cca65d92b6f9db0848d9">beforeRegionClear</a> (const <a class="el" href="a00831.html">RegionEvent</a> &amp;event)</td></tr>
<tr class="memdesc:a1fc3cd668ae9cca65d92b6f9db0848d9"><td class="mdescLeft">&#160;</td><td class="mdescRight">called before this region is cleared <a href="#a1fc3cd668ae9cca65d92b6f9db0848d9">More...</a><br /></td></tr>
<tr class="separator:a1fc3cd668ae9cca65d92b6f9db0848d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aebf73c3f4b8e1b3f1fa3f5f1641aa9ea"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00391.html#aebf73c3f4b8e1b3f1fa3f5f1641aa9ea">beforeRegionDestroy</a> (const <a class="el" href="a00831.html">RegionEvent</a> &amp;event)</td></tr>
<tr class="memdesc:aebf73c3f4b8e1b3f1fa3f5f1641aa9ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">called before this region is destroyed <a href="#aebf73c3f4b8e1b3f1fa3f5f1641aa9ea">More...</a><br /></td></tr>
<tr class="separator:aebf73c3f4b8e1b3f1fa3f5f1641aa9ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e63f635ea85878b0ab6d2906aec73a5"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00391.html#a3e63f635ea85878b0ab6d2906aec73a5">beforeUpdate</a> (const <a class="el" href="a00459.html">EntryEvent</a> &amp;event)</td></tr>
<tr class="memdesc:a3e63f635ea85878b0ab6d2906aec73a5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called before an entry is updated. <a href="#a3e63f635ea85878b0ab6d2906aec73a5">More...</a><br /></td></tr>
<tr class="separator:a3e63f635ea85878b0ab6d2906aec73a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9c11fba4eb45ae2a6c6d54c49bcfcc25"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00391.html#a9c11fba4eb45ae2a6c6d54c49bcfcc25">close</a> (<a class="el" href="a00815.html">Region</a> &amp;rp)</td></tr>
<tr class="memdesc:a9c11fba4eb45ae2a6c6d54c49bcfcc25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the region containing this callback is destroyed, when the cache is closed. <a href="#a9c11fba4eb45ae2a6c6d54c49bcfcc25">More...</a><br /></td></tr>
<tr class="separator:a9c11fba4eb45ae2a6c6d54c49bcfcc25"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An application plug-in that can be installed on the region. </p>
<p>Defines methods that are called BEFORE entry modification. A distributed region will typically have a single cache writer. If the application is designed such that all or most updates to a region occurs on a node, it is desirable to have the cache writer for the region to be installed at that node.</p>
<p><a class="el" href="a00287.html" title="Caches are obtained from the create method on the CacheFactory#create class.">Cache</a> writer invocations are initiated by the node where the entry or region modification occurs. If there is a local cache writer on the node where the change occurs, that is invoked. If there is no local cache writer , the system knows which of the nodes that have the region defined have a cache writer defined.</p>
<p>Note that cache writer callbacks are synchronous callbacks and have the ability to veto the cache update. Since cache writer invocations require communications over the network, (especially if they are not colocated on the nodes where the change occurs) the use of cache writers presents a performance penalty.</p>
<p>A user-defined object defined in the <a class="el" href="a00819.html">RegionAttributes</a> that is called synchronously before a region or entry in the cache is modified.</p>
<p>The typical use for a <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> is to update a database. Application writers should implement these methods to execute application-specific behavior before the cache is modified.</p>
<p>Before the region is updated via a put, create, or destroy operation, Geode will call a <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> that is installed anywhere in any participating cache for that region, preferring a local <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> if there is one. Usually there will be only one <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> in the distributed system. If there are multiple <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code>s available in the distributed system, the Geode implementation always prefers one that is stored locally, or else picks one arbitrarily. In any case, only one <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> will be invoked.</p>
<p>The <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> is capable of aborting the update to the cache by throwing a <code><a class="el" href="a00491.html" title="Thrown when the cache writer aborts the operation.">CacheWriterException</a></code>. This exception or any runtime exception thrown by the <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> will abort the operation, and the exception will be propagated to the initiator of the operation, regardless of whether the initiator is in the same process as the <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00823.html#a643beee8475f18618931328ceab8fc57" title="Sets the cache writer for the next RegionAttributes created.">RegionAttributesFactory::setCacheWriter</a> </dd>
<dd>
<a class="el" href="a00819.html#a35035c6637097a219d52153da5792439" title="Gets the cache writer for the region.">RegionAttributes::getCacheWriter</a> </dd>
<dd>
<a class="el" href="a00275.html#a62c037d2190aaf97727a1e965ce8d441" title="Sets cache writer for region.">AttributesMutator::setCacheWriter</a> </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="ab319be76cbfd4c23fc03b58c23b4dff8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab319be76cbfd4c23fc03b58c23b4dff8">&#9670;&nbsp;</a></span>beforeCreate()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool apache::geode::client::CacheWriter::beforeCreate </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00459.html">EntryEvent</a> &amp;&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called before an entry is created. </p>
<p>Entry creation is initiated by a <code>create</code>, a <code>put</code>, or a <code>get</code>. The <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> can determine whether this value comes from a <code>get</code> or not from <a class="el" href="">EntryEvent::isLoad</a>. The entry being created may already exist in the local cache where this <code><a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a></code> is installed, but it does not yet exist in the cache where the operation was initiated. </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">event</td><td><a class="el" href="a00459.html" title="Represents an entry event affecting an entry, including its identity and the the circumstances of the...">EntryEvent</a> denotes the event object associated with creating the entry</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00815.html#a8929dcdb782d03cfc85fdeb8c2124d40" title="Creates a new entry in this region with the specified key and value, providing a user-defined paramet...">Region::create</a> </dd>
<dd>
<a class="el" href="a00815.html#a6d37f770f04349d9c06799ab2ea4329e" title="Places a new value into an entry in this region with the specified key, providing a user-defined para...">Region::put</a> </dd>
<dd>
<a class="el" href="a00815.html#a4423292be4f114db87bc14bcf026a9f7" title="Returns the value associated with the specified key, passing the callback argument to any cache loade...">Region::get</a> </dd></dl>
</div>
</div>
<a id="a81ec54ad91d600062a7020d6639dede8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a81ec54ad91d600062a7020d6639dede8">&#9670;&nbsp;</a></span>beforeDestroy()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool apache::geode::client::CacheWriter::beforeDestroy </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00459.html">EntryEvent</a> &amp;&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called before an entry is destroyed. </p>
<p>The entry being destroyed may or may not exist in the local cache where the <a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a> is installed. This method is <em>not</em> called as a result of expiration or {<a class="el" href="a00815.html#a7572b61d45c19a28667779c68e44869b">}. event EntryEvent denotes the event object associated with destroying the entry Region::destroy </a></p>
</div>
</div>
<a id="a1fc3cd668ae9cca65d92b6f9db0848d9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1fc3cd668ae9cca65d92b6f9db0848d9">&#9670;&nbsp;</a></span>beforeRegionClear()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool apache::geode::client::CacheWriter::beforeRegionClear </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00831.html">RegionEvent</a> &amp;&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>called before this region is cleared </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">event</td><td><a class="el" href="a00459.html" title="Represents an entry event affecting an entry, including its identity and the the circumstances of the...">EntryEvent</a> denotes the event object associated with clearing the region</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00815.html#a3ef861ca25d90fcbbbf0b08049ba5944" title="Removes all entries from this region and provides a user-defined parameter object to any CacheWriter ...">Region::clear</a> </dd></dl>
</div>
</div>
<a id="aebf73c3f4b8e1b3f1fa3f5f1641aa9ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aebf73c3f4b8e1b3f1fa3f5f1641aa9ea">&#9670;&nbsp;</a></span>beforeRegionDestroy()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool apache::geode::client::CacheWriter::beforeRegionDestroy </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00831.html">RegionEvent</a> &amp;&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>called before this region is destroyed </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">event</td><td><a class="el" href="a00459.html" title="Represents an entry event affecting an entry, including its identity and the the circumstances of the...">EntryEvent</a> denotes the event object associated with destroying the region</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00815.html#a0e00376744c98bc9d2db341a865c69a3" title="Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in ...">Region::destroyRegion</a> </dd></dl>
</div>
</div>
<a id="a3e63f635ea85878b0ab6d2906aec73a5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e63f635ea85878b0ab6d2906aec73a5">&#9670;&nbsp;</a></span>beforeUpdate()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual bool apache::geode::client::CacheWriter::beforeUpdate </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00459.html">EntryEvent</a> &amp;&#160;</td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called before an entry is updated. </p>
<p>The entry update is initiated by a <code>put</code> or a <code>get</code> that causes the loader to update an existing entry. The entry previously existed in the cache where the operation was initiated, although the old value may have been nullptr. The entry being updated may or may not exist in the local cache where the <a class="el" href="a00391.html" title="An application plug-in that can be installed on the region.">CacheWriter</a> is installed.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">event</td><td><a class="el" href="a00459.html" title="Represents an entry event affecting an entry, including its identity and the the circumstances of the...">EntryEvent</a> denotes the event object associated with updating the entry</td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00815.html#a6d37f770f04349d9c06799ab2ea4329e" title="Places a new value into an entry in this region with the specified key, providing a user-defined para...">Region::put</a> </dd>
<dd>
<a class="el" href="a00815.html#a4423292be4f114db87bc14bcf026a9f7" title="Returns the value associated with the specified key, passing the callback argument to any cache loade...">Region::get</a> </dd></dl>
</div>
</div>
<a id="a9c11fba4eb45ae2a6c6d54c49bcfcc25"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9c11fba4eb45ae2a6c6d54c49bcfcc25">&#9670;&nbsp;</a></span>close()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void apache::geode::client::CacheWriter::close </td>
<td>(</td>
<td class="paramtype"><a class="el" href="a00815.html">Region</a> &amp;&#160;</td>
<td class="paramname"><em>rp</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Called when the region containing this callback is destroyed, when the cache is closed. </p>
<p>Implementations should clean up any external resources, such as database connections. Any runtime exceptions this method throws will be logged.</p>
<p>It is possible for this method to be called multiple times on a single callback instance, so implementations must be tolerant of this.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="a00287.html#a709c65fc2cd45f67ce3d6603df9bc7f1" title="Terminates this object cache and releases all the local resources.">Cache::close</a> </dd>
<dd>
<a class="el" href="a00815.html#a0e00376744c98bc9d2db341a865c69a3" title="Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in ...">Region::destroyRegion</a> </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<HR><address style="align: right;"><small>Apache Geode C++ Cache API Documentation</small></address>