LiteyukiBot/assets/storage.html-BD-UMrDG.js

24 lines
18 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,o as a,c as n,e as t}from"./app-Bs1PeMf0.js";const r={},s=t(`<h3 id="def-run-subscriber-receive-funcs-channel-str-data-any-none" tabindex="-1"><a class="header-anchor" href="#def-run-subscriber-receive-funcs-channel-str-data-any-none"><span><em><strong>def</strong></em> <code>run_subscriber_receive_funcs(channel_: str, data: Any) -&gt; None</code></span></a></h3><p>运行订阅者接收函数</p><p>Args:</p><pre><code>channel_: 频道
data: 数据
</code></pre><h3 id="def-on-get-data-tuple-str-dict-str-any-none" tabindex="-1"><a class="header-anchor" href="#def-on-get-data-tuple-str-dict-str-any-none"><span><em><strong>def</strong></em> <code>on_get(data: tuple[str, dict[str, Any]]) -&gt; None</code></span></a></h3><h3 id="def-on-set-data-tuple-str-dict-str-any-none" tabindex="-1"><a class="header-anchor" href="#def-on-set-data-tuple-str-dict-str-any-none"><span><em><strong>def</strong></em> <code>on_set(data: tuple[str, dict[str, Any]]) -&gt; None</code></span></a></h3><h3 id="def-on-delete-data-tuple-str-dict-str-any-none" tabindex="-1"><a class="header-anchor" href="#def-on-delete-data-tuple-str-dict-str-any-none"><span><em><strong>def</strong></em> <code>on_delete(data: tuple[str, dict[str, Any]]) -&gt; None</code></span></a></h3><h3 id="def-on-get-all-data-tuple-str-dict-str-any-none" tabindex="-1"><a class="header-anchor" href="#def-on-get-all-data-tuple-str-dict-str-any-none"><span><em><strong>def</strong></em> <code>on_get_all(data: tuple[str, dict[str, Any]]) -&gt; None</code></span></a></h3><h3 id="def-on-publish-data-tuple-str-any-none" tabindex="-1"><a class="header-anchor" href="#def-on-publish-data-tuple-str-any-none"><span><em><strong>def</strong></em> <code>on_publish(data: tuple[str, Any]) -&gt; None</code></span></a></h3><h3 id="def-decorator-func-on-receive-func-on-receive-func" tabindex="-1"><a class="header-anchor" href="#def-decorator-func-on-receive-func-on-receive-func"><span><em><strong>def</strong></em> <code>decorator(func: ON_RECEIVE_FUNC) -&gt; ON_RECEIVE_FUNC</code></span></a></h3><h3 id="async-def-wrapper-data-any-none" tabindex="-1"><a class="header-anchor" href="#async-def-wrapper-data-any-none"><span><em><strong>async def</strong></em> <code>wrapper(data: Any) -&gt; None</code></span></a></h3><h3 id="class-subscriber" tabindex="-1"><a class="header-anchor" href="#class-subscriber"><span><em><strong>class</strong></em> <code>Subscriber</code></span></a></h3><h3 id="def-init-self-none" tabindex="-1"><a class="header-anchor" href="#def-init-self-none"><span> <em><strong>def</strong></em> <code>__init__(self) -&gt; None</code></span></a></h3><p></p><h3 id="def-receive-self-any" tabindex="-1"><a class="header-anchor" href="#def-receive-self-any"><span> <em><strong>def</strong></em> <code>receive(self) -&gt; Any</code></span></a></h3><p></p><h3 id="def-unsubscribe-self-none" tabindex="-1"><a class="header-anchor" href="#def-unsubscribe-self-none"><span> <em><strong>def</strong></em> <code>unsubscribe(self) -&gt; None</code></span></a></h3><p></p><h3 id="class-keyvaluestore" tabindex="-1"><a class="header-anchor" href="#class-keyvaluestore"><span><em><strong>class</strong></em> <code>KeyValueStore</code></span></a></h3><h3 id="def-init-self-none-1" tabindex="-1"><a class="header-anchor" href="#def-init-self-none-1"><span> <em><strong>def</strong></em> <code>__init__(self) -&gt; None</code></span></a></h3><p></p><h3 id="def-set-self-key-str-value-any-none" tabindex="-1"><a class="header-anchor" href="#def-set-self-key-str-value-any-none"><span> <em><strong>def</strong></em> <code>set(self, key: str, value: Any) -&gt; None</code></span></a></h3><p> 设置键值对</p><p>Args:</p><pre><code>key: 键
value: 值
</code></pre><h3 id="def-get-self-key-str-default-optional-any-optional-any" tabindex="-1"><a class="header-anchor" href="#def-get-self-key-str-default-optional-any-optional-any"><span> <em><strong>def</strong></em> <code>get(self, key: str, default: Optional[Any]) -&gt; Optional[Any]</code></span></a></h3><p> 获取键值对</p><p>Args:</p><pre><code>key: 键
default: 默认值
</code></pre><p>Returns:</p><pre><code>Any: 值
</code></pre><h3 id="def-delete-self-key-str-ignore-key-error-bool-none" tabindex="-1"><a class="header-anchor" href="#def-delete-self-key-str-ignore-key-error-bool-none"><span> <em><strong>def</strong></em> <code>delete(self, key: str, ignore_key_error: bool) -&gt; None</code></span></a></h3><p> 删除键值对</p><p>Args:</p><pre><code>key: 键
ignore_key_error: 是否忽略键不存在的错误
</code></pre><p>Returns:</p><h3 id="def-get-all-self-dict-str-any" tabindex="-1"><a class="header-anchor" href="#def-get-all-self-dict-str-any"><span> <em><strong>def</strong></em> <code>get_all(self) -&gt; dict[str, Any]</code></span></a></h3><p> 获取所有键值对</p><p>Returns:</p><pre><code>dict[str, Any]: 键值对
</code></pre><h3 id="def-publish-self-channel-str-data-any-none" tabindex="-1"><a class="header-anchor" href="#def-publish-self-channel-str-data-any-none"><span> <em><strong>def</strong></em> <code>publish(self, channel_: str, data: Any) -&gt; None</code></span></a></h3><p> 发布消息</p><p>Args:</p><pre><code>channel_: 频道
data: 数据
</code></pre><p>Returns:</p><h3 id="def-on-subscriber-receive-self-channel-str-callable-on-receive-func-on-receive-func" tabindex="-1"><a class="header-anchor" href="#def-on-subscriber-receive-self-channel-str-callable-on-receive-func-on-receive-func"><span> <em><strong>def</strong></em> <code>on_subscriber_receive(self, channel_: str) -&gt; Callable[[ON_RECEIVE_FUNC], ON_RECEIVE_FUNC]</code></span></a></h3><p> 订阅者接收消息时的回调</p><p>Args:</p><pre><code>channel_: 频道
</code></pre><p>Returns:</p><pre><code>装饰器
</code></pre><h3 id="staticmethod" tabindex="-1"><a class="header-anchor" href="#staticmethod"><span> <em><strong>@staticmethod</strong></em></span></a></h3><h3 id="def-run-subscriber-receive-funcs-channel-str-data-any-none-1" tabindex="-1"><a class="header-anchor" href="#def-run-subscriber-receive-funcs-channel-str-data-any-none-1"><span> <em><strong>def</strong></em> <code>run_subscriber_receive_funcs(channel_: str, data: Any) -&gt; None</code></span></a></h3><p> 运行订阅者接收函数</p><p>Args:</p><pre><code>channel_: 频道
data: 数据
</code></pre><h3 id="class-globalkeyvaluestore" tabindex="-1"><a class="header-anchor" href="#class-globalkeyvaluestore"><span><em><strong>class</strong></em> <code>GlobalKeyValueStore</code></span></a></h3><h3 id="classmethod" tabindex="-1"><a class="header-anchor" href="#classmethod"><span> <em><strong>@classmethod</strong></em></span></a></h3><h3 id="def-get-instance-cls-any-none" tabindex="-1"><a class="header-anchor" href="#def-get-instance-cls-any-none"><span> <em><strong>def</strong></em> <code>get_instance(cls: Any) -&gt; None</code></span></a></h3><p></p><h3 id="attr-instance-none" tabindex="-1"><a class="header-anchor" href="#attr-instance-none"><span> <em><strong>attr</strong></em> <code>_instance: None</code></span></a></h3><h3 id="attr-lock-threading-lock" tabindex="-1"><a class="header-anchor" href="#attr-lock-threading-lock"><span> <em><strong>attr</strong></em> <code>_lock: threading.Lock()</code></span></a></h3><h3 id="var-key-data-1-key" tabindex="-1"><a class="header-anchor" href="#var-key-data-1-key"><span><em><strong>var</strong></em> <code>key = data[1][&#39;key&#39;]</code></span></a></h3><h3 id="var-default-data-1-default" tabindex="-1"><a class="header-anchor" href="#var-default-data-1-default"><span><em><strong>var</strong></em> <code>default = data[1][&#39;default&#39;]</code></span></a></h3><h3 id="var-recv-chan-data-1-recv-chan" tabindex="-1"><a class="header-anchor" href="#var-recv-chan-data-1-recv-chan"><span><em><strong>var</strong></em> <code>recv_chan = data[1][&#39;recv_chan&#39;]</code></span></a></h3><h3 id="var-key-data-1-key-1" tabindex="-1"><a class="header-anchor" href="#var-key-data-1-key-1"><span><em><strong>var</strong></em> <code>key = data[1][&#39;key&#39;]</code></span></a></h3><h3 id="var-value-data-1-value" tabindex="-1"><a class="header-anchor" href="#var-value-data-1-value"><span><em><strong>var</strong></em> <code>value = data[1][&#39;value&#39;]</code></span></a></h3><h3 id="var-key-data-1-key-2" tabindex="-1"><a class="header-anchor" href="#var-key-data-1-key-2"><span><em><strong>var</strong></em> <code>key = data[1][&#39;key&#39;]</code></span></a></h3><h3 id="var-recv-chan-data-1-recv-chan-1" tabindex="-1"><a class="header-anchor" href="#var-recv-chan-data-1-recv-chan-1"><span><em><strong>var</strong></em> <code>recv_chan = data[1][&#39;recv_chan&#39;]</code></span></a></h3><h3 id="var-lock-get-lock-key" tabindex="-1"><a class="header-anchor" href="#var-lock-get-lock-key"><span><em><strong>var</strong></em> <code>lock = _get_lock(key)</code></span></a></h3><h3 id="var-lock-get-lock-key-1" tabindex="-1"><a class="header-anchor" href="#var-lock-get-lock-key-1"><span><em><strong>var</strong></em> <code>lock = _get_lock(key)</code></span></a></h3><h3 id="var-recv-chan-channel-optional-any-recv-chan" tabindex="-1"><a class="header-anchor" href="#var-recv-chan-channel-optional-any-recv-chan"><span><em><strong>var</strong></em> <code>recv_chan = Channel[Optional[Any]](&#39;recv_chan&#39;)</code></span></a></h3><h3 id="var-lock-get-lock-key-2" tabindex="-1"><a class="header-anchor" href="#var-lock-get-lock-key-2"><span><em><strong>var</strong></em> <code>lock = _get_lock(key)</code></span></a></h3><h3 id="var-recv-chan-channel-dict-str-any-recv-chan" tabindex="-1"><a class="header-anchor" href="#var-recv-chan-channel-dict-str-any-recv-chan"><span><em><strong>var</strong></em> <code>recv_chan = Channel[dict[str, Any]](&#39;recv_chan&#39;)</code></span></a></h3><h3 id="var-data-self-active-chan-receive" tabindex="-1"><a class="header-anchor" href="#var-data-self-active-chan-receive"><span><em><strong>var</strong></em> <code>data = self.active_chan.receive()</code></span></a></h3><h3 id="var-data-self-publish-channel-receive" tabindex="-1"><a class="header-anchor" href="#var-data-self-publish-channel-receive"><span><em><strong>var</strong></em> <code>data = self.publish_channel.receive()</code></span></a></h3>`,76),l=[s];function c(d,o){return a(),n("div",null,l)}const h=e(r,[["render",c],["__file","storage.html.vue"]]),f=JSON.parse(`{"path":"/en/dev/api/comm/storage.html","title":"liteyuki.comm.storage","lang":"en-US","frontmatter":{"title":"liteyuki.comm.storage","order":1,"icon":"laptop-code","category":"API","description":"def run_subscriber_receive_funcs(channel_: str, data: Any) -> None 运行订阅者接收函数 Args: def on_get(data: tuple[str, dict[str, Any]]) -> None def on_set(data: tuple[str, dict[str, Any...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/api/comm/storage.html"}],["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/en/dev/api/comm/storage.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot"}],["meta",{"property":"og:title","content":"liteyuki.comm.storage"}],["meta",{"property":"og:description","content":"def run_subscriber_receive_funcs(channel_: str, data: Any) -> None 运行订阅者接收函数 Args: def on_get(data: tuple[str, dict[str, Any]]) -> None def on_set(data: tuple[str, dict[str, Any..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"liteyuki.comm.storage\\",\\"image\\":[\\"\\"],\\"dateModified\\":null,\\"author\\":[]}"]]},"headers":[{"level":3,"title":"def run_subscriber_receive_funcs(channel_: str, data: Any) -> None","slug":"def-run-subscriber-receive-funcs-channel-str-data-any-none","link":"#def-run-subscriber-receive-funcs-channel-str-data-any-none","children":[]},{"level":3,"title":"def on_get(data: tuple[str, dict[str, Any]]) -> None","slug":"def-on-get-data-tuple-str-dict-str-any-none","link":"#def-on-get-data-tuple-str-dict-str-any-none","children":[]},{"level":3,"title":"def on_set(data: tuple[str, dict[str, Any]]) -> None","slug":"def-on-set-data-tuple-str-dict-str-any-none","link":"#def-on-set-data-tuple-str-dict-str-any-none","children":[]},{"level":3,"title":"def on_delete(data: tuple[str, dict[str, Any]]) -> None","slug":"def-on-delete-data-tuple-str-dict-str-any-none","link":"#def-on-delete-data-tuple-str-dict-str-any-none","children":[]},{"level":3,"title":"def on_get_all(data: tuple[str, dict[str, Any]]) -> None","slug":"def-on-get-all-data-tuple-str-dict-str-any-none","link":"#def-on-get-all-data-tuple-str-dict-str-any-none","children":[]},{"level":3,"title":"def on_publish(data: tuple[str, Any]) -> None","slug":"def-on-publish-data-tuple-str-any-none","link":"#def-on-publish-data-tuple-str-any-none","children":[]},{"level":3,"title":"def decorator(func: ON_RECEIVE_FUNC) -> ON_RECEIVE_FUNC","slug":"def-decorator-func-on-receive-func-on-receive-func","link":"#def-decorator-func-on-receive-func-on-receive-func","children":[]},{"level":3,"title":"async def wrapper(data: Any) -> None","slug":"async-def-wrapper-data-any-none","link":"#async-def-wrapper-data-any-none","children":[]},{"level":3,"title":"class Subscriber","slug":"class-subscriber","link":"#class-subscriber","children":[]},{"level":3,"title":"def __init__(self) -> None","slug":"def-init-self-none","link":"#def-init-self-none","children":[]},{"level":3,"title":"def receive(self) -> Any","slug":"def-receive-self-any","link":"#def-receive-self-any","children":[]},{"level":3,"title":"def unsubscribe(self) -> None","slug":"def-unsubscribe-self-none","link":"#def-unsubscribe-self-none","children":[]},{"level":3,"title":"class KeyValueStore","slug":"class-keyvaluestore","link":"#class-keyvaluestore","children":[]},{"level":3,"title":"def __init__(self) -> None","slug":"def-init-self-none-1","link":"#def-init-self-none-1","children":[]},{"level":3,"title":"def set(self, key: str, value: Any) -> None","slug":"def-set-self-key-str-value-any-none","link":"#def-set-self-key-str-value-any-none","children":[]},{"level":3,"title":"def get(self, key: str, default: Optional[Any]) -> Optional[Any]","slug":"def-get-self-key-str-default-optional-any-optional-any","link":"#def-get-self-key-str-default-optional-any-optional-any","children":[]},{"level":3,"title":"def delete(self, key: str, ignore_key_error: bool) -> None","slug":"def-delete-self-key-str-ignore-key-error-bool-none","link":"#def-delete-self-key-str-ignore-key-error-bool-none","children":[]},{"level":3,"title":"def get_all(self) -> dict[str, Any]","slug":"def-get-all-self-dict-str-any","link":"#def-get-all-self-dict-str-any","children":[]},{"level":3,"title":"def publish(self, channel_: str, data: Any) -> None","slug":"def-publish-self-channel-str-data-any-none","link":"#def-publish-self-channel-str-data-any-none","children":[]},{"level":3,"title":"def on_subscriber_receive(self, channel_: str) -> Callable[[ON_RECEIVE_FUNC], ON_RECEIVE_FUNC]","slug":"def-on-subscriber-receive-self-channel-str-callable-on-receive-func-on-receive-func","link":"#def-on-subscriber-receive-self-channel-str-callable-on-receive-func-on-receive-func","children":[]},{"level":3,"title":"@staticmethod","slug":"staticmethod","link":"#staticmethod","children":[]},{"level":3,"title":"def run_subscriber_receive_funcs(channel_: str, data: Any) -> None","slug":"def-run-subscriber-receive-funcs-channel-str-data-any-none-1","link":"#def-run-subscriber-receive-funcs-channel-str-data-any-none-1","children":[]},{"level":3,"title":"class GlobalKeyValueStore","slug":"class-globalkeyvaluestore","link":"#class-globalkeyvaluestore","children":[]},{"level":3,"title":"@classmethod","slug":"classmethod","link":"#classmethod","children":[]},{"level":3,"title":"def get_instance(cls: Any) -> None","slug":"def-get-instance-cls-any-none","link":"#def-get-instance-cls-any-none","children":[]},{"level":3,"title":"attr _instance: None","slug":"attr-instance-none","link":"#attr-instance-none","children":[]},{"level":3,"title":"attr _lock: threading.Lock()","slug":"attr-lock-threading-lock","link":"#attr-lock-threading-lock","children":[]},{"level":3,"title":"var key = data[1]['key']","slug":"var-key-data-1-key","link":"#var-key-data-1-key","children":[]},{"level":3,"title":"var default = data[1]['default']","slug":"var-default-data-1-default","link":"#var-default-data-1-default","children":[]},{"level":3,"title":"var recv_chan = data[1]['recv_chan']","slug":"var-recv-chan-data-1-recv-chan","link":"#var-recv-chan-data-1-recv-chan","children":[]},{"level":3,"title":"var key = data[1]['key']","slug":"var-key-data-1-key-1","link":"#var-key-data-1-key-1","children":[]},{"level":3,"title":"var value = data[1]['value']","slug":"var-value-data-1-value","link":"#var-value-data-1-value","children":[]},{"level":3,"title":"var key = data[1]['key']","slug":"var-key-data-1-key-2","link":"#var-key-data-1-key-2","children":[]},{"level":3,"title":"var recv_chan = data[1]['recv_chan']","slug":"var-recv-chan-data-1-recv-chan-1","link":"#var-recv-chan-data-1-recv-chan-1","children":[]},{"level":3,"title":"var lock = _get_lock(key)","slug":"var-lock-get-lock-key","link":"#var-lock-get-lock-key","children":[]},{"level":3,"title":"var lock = _get_lock(key)","slug":"var-lock-get-lock-key-1","link":"#var-lock-get-lock-key-1","children":[]},{"level":3,"title":"var recv_chan = Channel[Optional[Any]]('recv_chan')","slug":"var-recv-chan-channel-optional-any-recv-chan","link":"#var-recv-chan-channel-optional-any-recv-chan","children":[]},{"level":3,"title":"var lock = _get_lock(key)","slug":"var-lock-get-lock-key-2","link":"#var-lock-get-lock-key-2","children":[]},{"level":3,"title":"var recv_chan = Channel[dict[str, Any]]('recv_chan')","slug":"var-recv-chan-channel-dict-str-any-recv-chan","link":"#var-recv-chan-channel-dict-str-any-recv-chan","children":[]},{"level":3,"title":"var data = self.active_chan.receive()","slug":"var-data-self-active-chan-receive","link":"#var-data-self-active-chan-receive","children":[]},{"level":3,"title":"var data = self.publish_channel.receive()","slug":"var-data-self-publish-channel-receive","link":"#var-data-self-publish-channel-receive","children":[]}],"git":{"createdTime":null,"updatedTime":null,"contributors":[]},"readingTime":{"minutes":1.26,"words":377},"filePathRelative":"en/dev/api/comm/storage.md","autoDesc":true}`);export{h as comp,f as data};