hudi-core 0.5.0

The native Rust implementation for Apache Hudi
/*
 * 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.
 */

#![allow(dead_code, unused_macros, unused_imports)]

//! Stage-timing profiling primitives for the file-group reader (perf harness).
//!
//! A single canonical write path for the per-stage wall-time counters, so the
//! `let s = Instant::now(); …; self.x [+]= s.elapsed()…` shape isn't copy-pasted
//! at every timing site. Inlining (rather than an RAII/`Drop` guard) is
//! deliberate: a guard holding `&mut self.field` for the scope would double-borrow
//! `self` against bodies that also need `&mut self` (e.g.
//! `process_queued_blocks_for_instant`); a macro releases the body's borrow before
//! the field write.

/// Record wall-us of `$body` once into the u64 place `$dst`.
///
/// Microseconds, not milliseconds: a metadata-table read completes in about 1.3ms
/// in release, where every millisecond-granular stage rounds to zero and the
/// counters say nothing about where the time went.
///
/// Where the body is a single fallible expression, keep `?` OUTSIDE the macro so
/// the elapsed time is still attributed on the error path.
macro_rules! profile_once {
    ($dst:expr, $body:expr) => {{
        let __start = std::time::Instant::now();
        #[allow(clippy::let_unit_value)]
        let __out = $body;
        $dst = __start.elapsed().as_micros() as u64;
        __out
    }};
}

/// Add wall-us of `$body` to the u64 place `$dst`.
///
/// The accumulating form, for a stage entered once per block or per window rather
/// than once per read. `profile_once!` assigns, so using it in a loop would report
/// only the last iteration.
macro_rules! profile_add {
    ($dst:expr, $body:expr) => {{
        let __start = std::time::Instant::now();
        #[allow(clippy::let_unit_value)]
        let __out = $body;
        $dst += __start.elapsed().as_micros() as u64;
        __out
    }};
}

pub(crate) use profile_add;
pub(crate) use profile_once;