Files
greptimedb/src/index/external_provider.rs.html
2026-03-12 03:02:27 +00:00

38 lines
6.1 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Source of the Rust file `src/index/src/external_provider.rs`."><title>external_provider.rs - source</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-e56847b5.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="index" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (fa3155a64 2025-09-30)" data-channel="nightly" data-search-js="search-e256b49e.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../../static.files/src-script-813739b1.js"></script><script defer src="../../src-files.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="src-sidebar-title"><h2>Files</h2></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><section id="main-content" class="content"><div class="main-heading"><h1><div class="sub-heading">index/</div>external_provider.rs</h1><rustdoc-toolbar></rustdoc-toolbar></div><div class="example-wrap digits-2"><pre class="rust"><code><a href=#1 id=1 data-nosnippet>1</a><span class="comment">// Copyright 2023 Greptime Team
<a href=#2 id=2 data-nosnippet>2</a>//
<a href=#3 id=3 data-nosnippet>3</a>// Licensed under the Apache License, Version 2.0 (the "License");
<a href=#4 id=4 data-nosnippet>4</a>// you may not use this file except in compliance with the License.
<a href=#5 id=5 data-nosnippet>5</a>// You may obtain a copy of the License at
<a href=#6 id=6 data-nosnippet>6</a>//
<a href=#7 id=7 data-nosnippet>7</a>// http://www.apache.org/licenses/LICENSE-2.0
<a href=#8 id=8 data-nosnippet>8</a>//
<a href=#9 id=9 data-nosnippet>9</a>// Unless required by applicable law or agreed to in writing, software
<a href=#10 id=10 data-nosnippet>10</a>// distributed under the License is distributed on an "AS IS" BASIS,
<a href=#11 id=11 data-nosnippet>11</a>// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<a href=#12 id=12 data-nosnippet>12</a>// See the License for the specific language governing permissions and
<a href=#13 id=13 data-nosnippet>13</a>// limitations under the License.
<a href=#14 id=14 data-nosnippet>14</a>
<a href=#15 id=15 data-nosnippet>15</a></span><span class="kw">use </span>async_trait::async_trait;
<a href=#16 id=16 data-nosnippet>16</a><span class="kw">use </span>futures::{AsyncRead, AsyncWrite};
<a href=#17 id=17 data-nosnippet>17</a>
<a href=#18 id=18 data-nosnippet>18</a><span class="kw">use </span><span class="kw">crate</span>::error::Error;
<a href=#19 id=19 data-nosnippet>19</a>
<a href=#20 id=20 data-nosnippet>20</a><span class="kw">pub type </span>Writer = Box&lt;<span class="kw">dyn </span>AsyncWrite + Unpin + Send&gt;;
<a href=#21 id=21 data-nosnippet>21</a><span class="kw">pub type </span>Reader = Box&lt;<span class="kw">dyn </span>AsyncRead + Unpin + Send&gt;;
<a href=#22 id=22 data-nosnippet>22</a>
<a href=#23 id=23 data-nosnippet>23</a><span class="doccomment">/// Trait for managing intermediate files to control memory usage for a particular index.
<a href=#24 id=24 data-nosnippet>24</a></span><span class="attr">#[mockall::automock]
<a href=#25 id=25 data-nosnippet>25</a>#[async_trait]
<a href=#26 id=26 data-nosnippet>26</a></span><span class="kw">pub trait </span>ExternalTempFileProvider: Send + Sync {
<a href=#27 id=27 data-nosnippet>27</a> <span class="doccomment">/// Creates and opens a new intermediate file associated with a specific `file_group` for writing.
<a href=#28 id=28 data-nosnippet>28</a> /// The implementation should ensure that the file does not already exist.
<a href=#29 id=29 data-nosnippet>29</a> ///
<a href=#30 id=30 data-nosnippet>30</a> /// - `file_group`: a unique identifier for the group of files
<a href=#31 id=31 data-nosnippet>31</a> /// - `file_id`: a unique identifier for the new file
<a href=#32 id=32 data-nosnippet>32</a> </span><span class="kw">async fn </span>create(<span class="kw-2">&amp;</span><span class="self">self</span>, file_group: <span class="kw-2">&amp;</span>str, file_id: <span class="kw-2">&amp;</span>str) -&gt; <span class="prelude-ty">Result</span>&lt;Writer, Error&gt;;
<a href=#33 id=33 data-nosnippet>33</a>
<a href=#34 id=34 data-nosnippet>34</a> <span class="doccomment">/// Retrieves all intermediate files and their associated file identifiers for a specific `file_group`.
<a href=#35 id=35 data-nosnippet>35</a> ///
<a href=#36 id=36 data-nosnippet>36</a> /// `file_group` is a unique identifier for the group of files.
<a href=#37 id=37 data-nosnippet>37</a> </span><span class="kw">async fn </span>read_all(<span class="kw-2">&amp;</span><span class="self">self</span>, file_group: <span class="kw-2">&amp;</span>str) -&gt; <span class="prelude-ty">Result</span>&lt;Vec&lt;(String, Reader)&gt;, Error&gt;;
<a href=#38 id=38 data-nosnippet>38</a>}</code></pre></div></section></main></body></html>