forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all of our utility code to a new package, which can be used by both zettacache and zettaobject. The utility package has code that is not directly related to the ZFS logic, e.g. extensions on the standard library or other external crates.
- Loading branch information
Showing
32 changed files
with
128 additions
and
69 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "util" | ||
version = "0.1.0" | ||
authors = ["Delphix"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[dependencies] | ||
async-trait = "0.1.51" | ||
backtrace = "0.3" | ||
config = "0.11" | ||
lazy_static = "1.4.0" | ||
log = "0.4" | ||
more-asserts = "0.2.1" | ||
rand = "0.8.3" | ||
roaring = "0.7.0" | ||
serde = { version = "1.0.125", features = ["derive"] } | ||
tokio = { version = "1.4", features = ["full"] } |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use std::convert::TryInto; | ||
|
||
/// Conversions that are safe assuming that we are on LP64 (usize == u64) | ||
pub trait From64<A> { | ||
fn from64(a: A) -> Self; | ||
} | ||
|
||
impl From64<u64> for usize { | ||
fn from64(a: u64) -> usize { | ||
a.try_into().unwrap() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#![warn(clippy::cast_lossless)] | ||
#![warn(clippy::cast_possible_truncation)] | ||
#![warn(clippy::cast_possible_wrap)] | ||
#![warn(clippy::cast_sign_loss)] | ||
|
||
mod bitmap_range_iterator; | ||
mod die; | ||
mod from64; | ||
mod lock_set; | ||
mod mutex_ext; | ||
mod range_tree; | ||
mod tunable; | ||
mod vec_ext; | ||
|
||
pub use bitmap_range_iterator::BitmapRangeIterator; | ||
pub use die::maybe_die_with; | ||
pub use from64::From64; | ||
pub use lock_set::LockSet; | ||
pub use lock_set::LockedItem; | ||
pub use mutex_ext::MutexExt; | ||
pub use range_tree::RangeTree; | ||
pub use tunable::get_tunable; | ||
pub use tunable::read_tunable_config; | ||
pub use vec_ext::TerseVec; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use serde::Deserialize; | ||
use serde::Serialize; | ||
use std::fmt::Debug; | ||
use std::fmt::Formatter; | ||
use std::fmt::Result; | ||
|
||
/// exists just to reduce Debug output on fields we don't really care about | ||
#[derive(Serialize, Deserialize)] | ||
pub struct TerseVec<T>(pub Vec<T>); | ||
impl<T> Debug for TerseVec<T> { | ||
fn fmt(&self, fmt: &mut Formatter) -> Result { | ||
fmt.write_fmt(format_args!("[...{} elements...]", self.0.len())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.