devillove084 commented on code in PR #37:
URL: https://github.com/apache/paimon-rust/pull/37#discussion_r1703144139


##########
crates/paimon/src/fileindex/file_index_format.rs:
##########
@@ -0,0 +1,486 @@
+// 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.
+
+use std::{collections::HashMap, io::SeekFrom};
+
+use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWrite, AsyncWriteExt, 
BufReader, BufWriter};
+
+pub const MAGIC: u64 = 1493475289347502;
+pub const EMPTY_INDEX_FLAG: i32 = -1;
+
+/// File index file format. Put all columns and offsets in the header.
+///
+/// ```
+///   _____________________________________    _____________________
+/// |     magic    |version|head length  |
+/// |-------------------------------------|
+/// |            column number            |
+/// |-------------------------------------|
+/// |   column 1        | index number   |
+/// |-------------------------------------|
+/// |  index name 1 |start pos |length  |
+/// |-------------------------------------|
+/// |  index name 2 |start pos |length  |
+/// |-------------------------------------|
+/// |  index name 3 |start pos |length  |
+/// |-------------------------------------|            HEAD
+/// |   column 2        | index number   |
+/// |-------------------------------------|
+/// |  index name 1 |start pos |length  |
+/// |-------------------------------------|
+/// |  index name 2 |start pos |length  |
+/// |-------------------------------------|
+/// |  index name 3 |start pos |length  |
+/// |-------------------------------------|
+/// |                 ...                 |
+/// |-------------------------------------|
+/// |                 ...                 |
+/// |-------------------------------------|
+/// |  redundant length |redundant bytes  |
+/// |-------------------------------------|    ---------------------
+/// |                BODY                 |
+/// |                BODY                 |
+/// |                BODY                 |             BODY
+/// |                BODY                 |
+/// |_____________________________________|    _____________________
+/// ```
+///
+/// - `magic`: 8 bytes long
+/// - `version`: 4 bytes int
+/// - `head length`: 4 bytes int
+/// - `column number`: 4 bytes int
+/// - `column x`: var bytes utf (length + bytes)
+/// - `index number`: 4 bytes int (how many column items below)
+/// - `index name x`: var bytes utf
+/// - `start pos`: 4 bytes int
+/// - `length`: 4 bytes int
+/// - `redundant length`: 4 bytes int (for compatibility with later versions, 
in this version, content is zero)
+/// - `redundant bytes`: var bytes (for compatibility with later version, in 
this version, is empty)
+/// - `BODY`: column index bytes + column index bytes + column index bytes + 
.......
+
+#[derive(Debug)]
+pub struct FileIndexFormat;

Review Comment:
   Maybe what is needed here is called FileIndexFormatReader and 
FileIndexFormatWriter.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@paimon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to