Crate baqup_agent

Crate baqup_agent 

Source
Expand description

§baqup-agent

SDK for building baqup backup agents in Rust.

⚠️ This is a placeholder crate. Full implementation coming soon.

§What is baqup?

baqup is a container-native backup orchestration system. Agents are stateless containers that perform backup and restore operations.

This SDK provides everything needed to build a compliant baqup agent:

  • Contract types - ExitCode, AgentState, LogLevel
  • Structured logging - JSON logs with required fields
  • Redis communication - Bus client with filesystem fallback
  • Heartbeat management - Background thread with intent signalling
  • Staging utilities - Atomic writes, checksums, path validation
  • Secret handling - Wrapper preventing accidental exposure

§Example (Preview API)

use baqup_agent::{ExitCode, AgentState, Secret};

// Exit codes are already available
assert_eq!(ExitCode::Success as i32, 0);
assert_eq!(ExitCode::UsageConfigError as i32, 64);

// Secret wrapper (available now)
let password = Secret::new("my-secret-password");
assert_eq!(format!("{}", password), "[REDACTED]");
assert_eq!(password.reveal(), "my-secret-password");

Structs§

Artifact
A single backup artifact
Manifest
Backup manifest from AGENT-CONTRACT-SPEC.md §4
Secret
Secret wrapper that prevents accidental exposure in logs.

Enums§

AgentError
Agent SDK error types
AgentState
Agent lifecycle states from AGENT-CONTRACT-SPEC.md §1
ExitCode
Exit codes from AGENT-CONTRACT-SPEC.md §5
LogLevel
Log levels from AGENT-CONTRACT-SPEC.md §6

Constants§

VERSION
Crate version

Functions§

atomic_write
Atomic write pattern: .staging/ -> parent
compute_checksum
Compute file checksum
load_config
Load configuration from schema
validate_path
Validate path is within boundary (prevent traversal)