Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f435f70
feat(kvp): add store trait and Hyper-V KVP storage crate
peytonr18 Mar 9, 2026
5226e32
add Azure autodetect limits selection for HyperVKvpStore
peytonr18 Mar 9, 2026
c1440c9
Improving libazurekvp.md clarity
peytonr18 Mar 9, 2026
d63dd42
feat(kvp): harden Hyper-V record decode and refactor stale truncate t…
peytonr18 Mar 10, 2026
62a52fe
Refactor libazureinit-kvp: KvpStore trait, KvpError, HyperV/Azure spl…
peytonr18 Mar 11, 2026
498d136
Flatten implementation such that there is one trait and one implement…
peytonr18 Mar 19, 2026
b93a5d3
Merge branch 'main' into probertson/kvp-store-trait
peytonr18 Mar 19, 2026
e681b59
Refactor libazureinit-kvp: simplify KvpStore trait, add upsert semant…
peytonr18 Mar 26, 2026
ae03af6
Refactor libazureinit-kvp: replace flock-based locking with fcntl OFD…
peytonr18 Mar 27, 2026
8445370
feat(kvp): split insert and append semantics for pool store
peytonr18 Apr 1, 2026
93c290b
Improve KVP pool duplicate handling and API docs
peytonr18 Apr 9, 2026
cfc44ac
Updating KvpPoolStore to reflect new API design
peytonr18 Apr 16, 2026
4809bc5
Refactor libazureinit-kvp: split into error/store modules, improve co…
peytonr18 Apr 16, 2026
9d18e30
test(kvp): achieve 100% line and function coverage
peytonr18 Apr 16, 2026
2a73f01
Refactor KvpPoolStore: decouple free functions and alphabetize methods
peytonr18 Apr 16, 2026
38f7e39
Refactor KvpPoolStore: unify validation, relax read/delete key checks
peytonr18 Apr 17, 2026
c5531ac
Refactor KvpPoolStore: collapse KvpStore trait, surface unlock errors
peytonr18 Apr 23, 2026
d925931
Address PR feedback: dual flock+fcntl locking, explicit unlock, cleanup
peytonr18 Apr 28, 2026
1871cdd
libazureinit-kvp: add atomic populate() and consolidate tests with rs…
peytonr18 Apr 28, 2026
1761abb
Merge branch 'main' into probertson/kvp-store-trait
peytonr18 Apr 28, 2026
18a13b0
Updating utf size comments and remove_current comments for clarity
peytonr18 Apr 28, 2026
f9404b1
Refine KVP store locking and validation behavior
peytonr18 May 11, 2026
5f64e86
Adding tests to reach 100% code coverage
peytonr18 May 19, 2026
34f5f93
Merge branch 'main' into probertson/kvp-store-trait
peytonr18 May 19, 2026
386f496
test(kvp): consolidate tests via rstest and improve write-path coverage
peytonr18 May 21, 2026
3b3668e
fix(kvp): reject empty/null keys on read and delete
peytonr18 May 21, 2026
7518bfa
test(kvp-store): reach 100% region/line coverage via SysOps/Handle mocks
May 21, 2026
b6582a3
Merge branch 'main' into probertson/kvp-store-trait
cjp256 May 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ path = "tests/functional_tests.rs"
[workspace]
members = [
"libazureinit",
"libazureinit-kvp",
]

[features]
Expand Down
126 changes: 0 additions & 126 deletions doc/libazurekvp.md

This file was deleted.

21 changes: 21 additions & 0 deletions libazureinit-kvp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "libazureinit-kvp"
version = "0.1.0"
edition = "2021"
rust-version = "1.88"
repository = "https://github.com/Azure/azure-init/"
homepage = "https://github.com/Azure/azure-init/"
license = "MIT"
description = "Hyper-V KVP (Key-Value Pair) storage library for azure-init."

[dependencies]
libc = "0.2"
tracing = "0.1.40"

[dev-dependencies]
rstest = { version = "0.23", default-features = false }
tempfile = "3"

[lib]
name = "libazureinit_kvp"
path = "src/lib.rs"
65 changes: 65 additions & 0 deletions libazureinit-kvp/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use std::fmt;
use std::io;

/// Errors returned by [`KvpPoolStore`](crate::KvpPoolStore) operations.
#[derive(Debug)]
pub enum KvpError {
/// The key was empty.
EmptyKey,
/// An underlying I/O error.
Io(io::Error),
/// The key contains a null byte, which is incompatible with the
/// on-disk format (null-padded fixed-width fields).
KeyContainsNull,
/// The key exceeds the store's maximum key size.
KeyTooLarge { max: usize, actual: usize },
/// The store already has the maximum allowed number of unique keys.
MaxUniqueKeysExceeded { max: usize },
Comment thread
peytonr18 marked this conversation as resolved.
/// The value exceeds the store's maximum value size.
ValueTooLarge { max: usize, actual: usize },
/// The value contains a null byte, which is incompatible with the
/// null-padded KVP wire format.
ValueContainsNull,
}

impl fmt::Display for KvpError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::EmptyKey => write!(f, "KVP key must not be empty"),
Self::Io(e) => write!(f, "{e}"),
Self::KeyContainsNull => {
write!(f, "KVP key must not contain null bytes")
}
Self::KeyTooLarge { max, actual } => {
write!(f, "KVP key length ({actual}) exceeds maximum ({max})")
}
Self::MaxUniqueKeysExceeded { max } => {
write!(f, "KVP unique key count exceeded maximum ({max})")
}
Self::ValueTooLarge { max, actual } => {
write!(f, "KVP value length ({actual}) exceeds maximum ({max})")
}
Self::ValueContainsNull => {
write!(f, "KVP value must not contain null bytes")
}
}
}
}

impl std::error::Error for KvpError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Self::Io(e) => Some(e),
_ => None,
}
}
}

impl From<io::Error> for KvpError {
fn from(err: io::Error) -> Self {
Self::Io(err)
}
}
14 changes: 14 additions & 0 deletions libazureinit-kvp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

//! `libazureinit-kvp` provides a unified KVP pool file store for
//! Hyper-V/Azure guests.
//!
//! - [`KvpPoolStore`]: KVP pool file store with
//! [`PoolMode`]-based policy.

mod error;
mod store;

pub use error::KvpError;
pub use store::{KvpPool, KvpPoolStore, PoolMode};
Loading