<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The EvStat class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="evsignal.set.html">EvSignal::set</a></div> <div class="next" style="text-align: right; float: right;"><a href="evstat.attr.html">EvStat::attr</a></div> <div class="up"><a href="book.ev.html">Ev</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.evstat" class="reference"> <h1 class="title">The EvStat class</h1> <div class="partintro"><p class="verinfo">(PECL ev >= 0.2.0)</p> <div class="section" id="evstat.intro"> <h2 class="title">Introduction</h2> <p class="para"> <strong class="classname">EvStat</strong> monitors a file system path for attribute changes. It calls <em class="emphasis">stat()</em> on that path in regular intervals(or when the OS signals it changed) and sees if it changed compared to the last time, invoking the callback if it did. </p> <p class="para"> The path does not need to exist: changing from "path exists" to "path does not exist" is a status change like any other. The condition "path does not exist" is signified by the <strong><code>'nlink'</code></strong> item being 0(returned by <span class="methodname"><a href="evstat.attr.html" class="methodname">EvStat::attr()</a></span> method). </p> <p class="para"> The path must not end in a slash or contain special components such as <strong><code>'.'</code></strong> or <strong><code>..</code></strong> . The path should be absolute: if it is relative and the working directory changes, then the behaviour is undefined. </p> <p class="para"> Since there is no portable change notification interface available, the portable implementation simply calls <em class="emphasis">stat()</em> regularly on the path to see if it changed somehow. For this case a recommended polling interval can be specified. If one specifies a polling interval of <strong><code>0.0 </code></strong> (highly recommended) then a suitable, unspecified default value will be used(which could be expected to be around 5 seconds, although this might change dynamically). <em class="emphasis">libev</em> will also impose a minimum interval which is currently around <strong><code>0.1</code></strong> , but that’s usually overkill. </p> <p class="para"> This watcher type is not meant for massive numbers of <strong class="classname">EvStat</strong> watchers, as even with OS-supported change notifications, this can be resource-intensive. </p> </div> <div class="section" id="evstat.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"> </div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">EvStat</strong> </span> <span class="ooclass"> <span class="modifier">extends</span> <a href="class.evwatcher.html" class="classname">EvWatcher</a> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evstat.html#evstat.props.path">$<var class="varname">path</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evstat.html#evstat.props.interval">$<var class="varname">interval</var></a></var> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited properties */</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.is-active">$<var class="varname">is_active</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.data">$<var class="varname">data</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.is-pending">$<var class="varname">is_pending</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.priority">$<var class="varname">priority</var></a></var> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="evstat.attr.html" class="methodname">attr</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="evstat.construct.html" class="methodname">__construct</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$path</code> </span> , <span class="methodparam"> <span class="type">double</span> <code class="parameter">$interval</code> </span> , <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code> </span> [, <span class="methodparam"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> [, <span class="methodparam"> <span class="type">int</span> <code class="parameter">$priority</code> <span class="initializer"> = 0</span> </span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">void</span> <span class="methodname"><a href="evstat.createstopped.html" class="methodname">createStopped</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$path</code> </span> , <span class="methodparam"> <span class="type">double</span> <code class="parameter">$interval</code> </span> , <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code> </span> [, <span class="methodparam"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code> <span class="initializer"> = <strong><code>NULL</code></strong></span> </span> [, <span class="methodparam"> <span class="type">int</span> <code class="parameter">$priority</code> <span class="initializer"> = 0</span> </span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evstat.prev.html" class="methodname">prev</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evstat.set.html" class="methodname">set</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$path</code> </span> , <span class="methodparam"> <span class="type">double</span> <code class="parameter">$interval</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="evstat.stat.html" class="methodname">stat</a></span> ( <span class="methodparam">void</span> )</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="evwatcher.clear.html" class="methodname">EvWatcher::clear</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><a href="evwatcher.construct.html" class="methodname">EvWatcher::__construct</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.feed.html" class="methodname">EvWatcher::feed</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$revents</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">EvLoop</span> <span class="methodname"><a href="evwatcher.getloop.html" class="methodname">EvWatcher::getLoop</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.invoke.html" class="methodname">EvWatcher::invoke</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$revents</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="evwatcher.keepalive.html" class="methodname">EvWatcher::keepalive</a></span> ([ <span class="methodparam"> <span class="type">bool</span> <code class="parameter">$value</code> </span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.setcallback.html" class="methodname">EvWatcher::setCallback</a></span> ( <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.start.html" class="methodname">EvWatcher::start</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.stop.html" class="methodname">EvWatcher::stop</a></span> ( <span class="methodparam">void</span> )</div> }</div> </div> <div class="section" id="evstat.props"> <h2 class="title">Properties</h2> <dl> <dt id="evstat.props.interval"> <span class="term"> <var class="varname"><var class="varname">interval</var></var> </span> <dd> <p class="para"> <em class="emphasis">Readonly</em> . Hint on how quickly a change is expected to be detected and should normally be specified as <strong><code>0.0</code></strong> to let <em class="emphasis">libev</em> choose a suitable value. </p> </dd> </dt> <dt id="evstat.props.path"> <span class="term"> <var class="varname"><var class="varname">path</var></var> </span> <dd> <p class="para"> <em class="emphasis">Readonly</em> . The path to wait for status changes on. </p> </dd> </dt> </dl> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="evstat.attr.html">EvStat::attr</a> — Returns the values most recently detected by Ev</li><li><a href="evstat.construct.html">EvStat::__construct</a> — Constructs EvStat watcher object</li><li><a href="evstat.createstopped.html">EvStat::createStopped</a> — Create a stopped EvStat watcher object</li><li><a href="evstat.prev.html">EvStat::prev</a> — Returns the previous set of values returned by EvStat::attr</li><li><a href="evstat.set.html">EvStat::set</a> — Configures the watcher</li><li><a href="evstat.stat.html">EvStat::stat</a> — Initiates the stat call</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="evsignal.set.html">EvSignal::set</a></div> <div class="next" style="text-align: right; float: right;"><a href="evstat.attr.html">EvStat::attr</a></div> <div class="up"><a href="book.ev.html">Ev</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>