blob: 8241a099dd5f5062d82addd67570753a39aaf20d [file]
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.8" xml:lang="en-US">
<compounddef id="token__refresh__scheduler_8h" kind="file" language="C++">
<compoundname>token_refresh_scheduler.h</compoundname>
<includes local="no">chrono</includes>
<includes local="no">condition_variable</includes>
<includes local="no">cstdint</includes>
<includes local="no">functional</includes>
<includes local="no">mutex</includes>
<includes local="no">thread</includes>
<includes local="no">vector</includes>
<includes refid="iceberg__rest__export_8h" local="yes">iceberg/catalog/rest/iceberg_rest_export.h</includes>
<incdepgraph>
<node id="1">
<label>iceberg/catalog/rest/auth/token_refresh_scheduler.h</label>
<link refid="token__refresh__scheduler_8h"/>
<childnode refid="2" relation="include">
</childnode>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="4" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
<childnode refid="6" relation="include">
</childnode>
<childnode refid="7" relation="include">
</childnode>
<childnode refid="8" relation="include">
</childnode>
<childnode refid="9" relation="include">
</childnode>
</node>
<node id="9">
<label>iceberg/catalog/rest/iceberg_rest_export.h</label>
<link refid="iceberg__rest__export_8h"/>
</node>
<node id="2">
<label>chrono</label>
</node>
<node id="3">
<label>condition_variable</label>
</node>
<node id="4">
<label>cstdint</label>
</node>
<node id="5">
<label>functional</label>
</node>
<node id="6">
<label>mutex</label>
</node>
<node id="7">
<label>thread</label>
</node>
<node id="8">
<label>vector</label>
</node>
</incdepgraph>
<innerclass refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" prot="public">iceberg::rest::auth::TokenRefreshScheduler</innerclass>
<innerclass refid="structiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1_1Task" prot="private">iceberg::rest::auth::TokenRefreshScheduler::Task</innerclass>
<innernamespace refid="namespaceiceberg">iceberg</innernamespace>
<innernamespace refid="namespaceiceberg_1_1rest">iceberg::rest</innernamespace>
<innernamespace refid="namespaceiceberg_1_1rest_1_1auth">iceberg::rest::auth</innernamespace>
<briefdescription>
<para>Global scheduler for OAuth2 token refresh tasks. </para>
</briefdescription>
<detaileddescription>
</detaileddescription>
<programlisting>
<codeline lineno="1"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Licensed<sp/>to<sp/>the<sp/>Apache<sp/>Software<sp/>Foundation<sp/>(ASF)<sp/>under<sp/>one</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>or<sp/>more<sp/>contributor<sp/>license<sp/>agreements.<sp/><sp/>See<sp/>the<sp/>NOTICE<sp/>file</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*<sp/>distributed<sp/>with<sp/>this<sp/>work<sp/>for<sp/>additional<sp/>information</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>regarding<sp/>copyright<sp/>ownership.<sp/><sp/>The<sp/>ASF<sp/>licenses<sp/>this<sp/>file</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*<sp/>to<sp/>you<sp/>under<sp/>the<sp/>Apache<sp/>License,<sp/>Version<sp/>2.0<sp/>(the</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/>&quot;License&quot;);<sp/>you<sp/>may<sp/>not<sp/>use<sp/>this<sp/>file<sp/>except<sp/>in<sp/>compliance</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>with<sp/>the<sp/>License.<sp/><sp/>You<sp/>may<sp/>obtain<sp/>a<sp/>copy<sp/>of<sp/>the<sp/>License<sp/>at</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/><sp/><sp/>http://www.apache.org/licenses/LICENSE-2.0</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>Unless<sp/>required<sp/>by<sp/>applicable<sp/>law<sp/>or<sp/>agreed<sp/>to<sp/>in<sp/>writing,</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/>software<sp/>distributed<sp/>under<sp/>the<sp/>License<sp/>is<sp/>distributed<sp/>on<sp/>an</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/>&quot;AS<sp/>IS&quot;<sp/>BASIS,<sp/>WITHOUT<sp/>WARRANTIES<sp/>OR<sp/>CONDITIONS<sp/>OF<sp/>ANY</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>KIND,<sp/>either<sp/>express<sp/>or<sp/>implied.<sp/><sp/>See<sp/>the<sp/>License<sp/>for<sp/>the</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>specific<sp/>language<sp/>governing<sp/>permissions<sp/>and<sp/>limitations</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>under<sp/>the<sp/>License.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#pragma<sp/>once</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;chrono&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;condition_variable&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;cstdint&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;functional&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;mutex&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="27"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;thread&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;vector&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="29"><highlight class="normal"></highlight></codeline>
<codeline lineno="30"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;<ref refid="iceberg__rest__export_8h" kindref="compound">iceberg/catalog/rest/iceberg_rest_export.h</ref>&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight></codeline>
<codeline lineno="34"><highlight class="normal"></highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal"><ref refid="namespaceiceberg_1_1rest_1_1auth" kindref="compound">iceberg::rest::auth</ref><sp/>{</highlight></codeline>
<codeline lineno="36"><highlight class="normal"></highlight></codeline>
<codeline lineno="47" refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" refkind="compound"><highlight class="keyword">class<sp/></highlight><highlight class="normal">ICEBERG_REST_EXPORT<sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref><sp/>{</highlight></codeline>
<codeline lineno="48"><highlight class="normal"><sp/></highlight><highlight class="keyword">public</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="54" refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1a7ee284b76cb67a61803cdfd5552b2c9f" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;<sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1a7ee284b76cb67a61803cdfd5552b2c9f" kindref="member">Instance</ref>();</highlight></codeline>
<codeline lineno="55"><highlight class="normal"></highlight></codeline>
<codeline lineno="61" refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1a1fbe3cca9a30faca076d92dd8fdf5892" refkind="member"><highlight class="normal"><sp/><sp/>uint64_t<sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1a1fbe3cca9a30faca076d92dd8fdf5892" kindref="member">Schedule</ref>(std::chrono::milliseconds<sp/>delay,<sp/>std::function&lt;</highlight><highlight class="keywordtype">void</highlight><highlight class="normal">()&gt;<sp/>callback);</highlight></codeline>
<codeline lineno="62"><highlight class="normal"></highlight></codeline>
<codeline lineno="68" refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1aca19f17b23d0856e91a0f2e3bcda199d" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1aca19f17b23d0856e91a0f2e3bcda199d" kindref="member">Cancel</ref>(uint64_t<sp/>handle);</highlight></codeline>
<codeline lineno="69"><highlight class="normal"></highlight></codeline>
<codeline lineno="78" refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1ad06e6355dba76b033df41616e62cf777" refkind="member"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1ad06e6355dba76b033df41616e62cf777" kindref="member">Shutdown</ref>();</highlight></codeline>
<codeline lineno="79"><highlight class="normal"></highlight></codeline>
<codeline lineno="80"><highlight class="normal"><sp/><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">~TokenRefreshScheduler</ref>();</highlight></codeline>
<codeline lineno="81"><highlight class="normal"></highlight></codeline>
<codeline lineno="82"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Non-copyable,<sp/>non-movable</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="83"><highlight class="normal"><sp/><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;)<sp/>=<sp/></highlight><highlight class="keyword">delete</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="84"><highlight class="normal"><sp/><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;<sp/>operator=(</highlight><highlight class="keyword">const</highlight><highlight class="normal"><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;)<sp/>=<sp/></highlight><highlight class="keyword">delete</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="85"><highlight class="normal"><sp/><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>(<ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;&amp;)<sp/>=<sp/></highlight><highlight class="keyword">delete</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="86"><highlight class="normal"><sp/><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;<sp/>operator=(<ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler" kindref="compound">TokenRefreshScheduler</ref>&amp;&amp;)<sp/>=<sp/></highlight><highlight class="keyword">delete</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="87"><highlight class="normal"></highlight></codeline>
<codeline lineno="92" refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1a6a5eb72b84bb76c944c7a27c530ffdeb" refkind="member"><highlight class="normal"><sp/><sp/><ref refid="classiceberg_1_1rest_1_1auth_1_1TokenRefreshScheduler_1a6a5eb72b84bb76c944c7a27c530ffdeb" kindref="member">TokenRefreshScheduler</ref>();</highlight></codeline>
<codeline lineno="93"><highlight class="normal"></highlight></codeline>
<codeline lineno="94"><highlight class="normal"><sp/></highlight><highlight class="keyword">private</highlight><highlight class="normal">:</highlight></codeline>
<codeline lineno="96"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/>Run();</highlight></codeline>
<codeline lineno="97"><highlight class="normal"></highlight></codeline>
<codeline lineno="98"><highlight class="normal"><sp/><sp/></highlight><highlight class="keyword">struct<sp/></highlight><highlight class="normal">Task<sp/>{</highlight></codeline>
<codeline lineno="99"><highlight class="normal"><sp/><sp/><sp/><sp/>uint64_t<sp/>id;</highlight></codeline>
<codeline lineno="100"><highlight class="normal"><sp/><sp/><sp/><sp/>std::chrono::steady_clock::time_point<sp/>fire_at;</highlight></codeline>
<codeline lineno="101"><highlight class="normal"><sp/><sp/><sp/><sp/>std::function&lt;void()&gt;<sp/>callback;</highlight></codeline>
<codeline lineno="102"><highlight class="normal"><sp/><sp/>};</highlight></codeline>
<codeline lineno="103"><highlight class="normal"></highlight></codeline>
<codeline lineno="104"><highlight class="normal"><sp/><sp/>std::mutex<sp/>mutex_;</highlight></codeline>
<codeline lineno="105"><highlight class="normal"><sp/><sp/>std::condition_variable<sp/>cv_;</highlight></codeline>
<codeline lineno="106"><highlight class="normal"><sp/><sp/>std::vector&lt;Task&gt;<sp/>tasks_;</highlight></codeline>
<codeline lineno="107"><highlight class="normal"><sp/><sp/>uint64_t<sp/>next_id_<sp/>=<sp/>1;<sp/><sp/></highlight><highlight class="comment">//<sp/>0<sp/>is<sp/>reserved<sp/>as<sp/>&quot;invalid<sp/>handle&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="108"><highlight class="normal"><sp/><sp/></highlight><highlight class="keywordtype">bool</highlight><highlight class="normal"><sp/>shutdown_<sp/>=<sp/></highlight><highlight class="keyword">false</highlight><highlight class="normal">;</highlight></codeline>
<codeline lineno="109"><highlight class="normal"><sp/><sp/>std::thread<sp/>worker_;</highlight></codeline>
<codeline lineno="110"><highlight class="normal">};</highlight></codeline>
<codeline lineno="111"><highlight class="normal"></highlight></codeline>
<codeline lineno="112"><highlight class="normal">}<sp/><sp/></highlight><highlight class="comment">//<sp/>namespace<sp/>iceberg::rest::auth</highlight><highlight class="normal"></highlight></codeline>
</programlisting>
<location file="iceberg/catalog/rest/auth/token_refresh_scheduler.h"/>
</compounddef>
</doxygen>