# baqup-agent
SDK for building baqup backup agents in Rust.
> ⚠️ **This is a placeholder crate.** Full implementation coming soon.
## What is baqup?
[baqup](https://github.com/baqupio/baqup) is a container-native backup orchestration system. Agents are stateless containers that perform backup and restore operations on behalf of the controller.
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
## Installation
```toml
[dependencies]
baqup-agent = "0.0.1"
```
## Usage (Preview API)
```rust
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);
// Agent states
assert_eq!(AgentState::Running.to_string(), "running");
// Secret wrapper (available now)
let password = Secret::new("my-secret-password");
println!("{}", password); // [REDACTED]
println!("{}", password.reveal()); // my-secret-password
```
## Contract Compliance
This SDK implements the [baqup Agent Contract Specification](https://github.com/baqupio/baqup/blob/main/AGENT-CONTRACT-SPEC.md):
| §1 Lifecycle | State machine, signal handling |
| §2 Config | Environment variable loading |
| §3 Communication | Redis protocol, fallback |
| §4 Output | Atomic completion, manifests |
| §5 Errors | Exit code taxonomy |
| §6 Observability | Structured logging |
| §7 Security | Path validation, secrets |
## Features
- `default` - Synchronous API only
- `async` - Async support with Tokio and Redis
```toml
[dependencies]
baqup-agent = { version = "0.0.1", features = ["async"] }
```
## Related Crates
| `baqup-schema` | Schema validation |
| `baqup-agent` | Agent SDK (this crate) |
## Links
- [GitHub](https://github.com/baqupio/baqup)
- [Agent Contract Spec](https://github.com/baqupio/baqup/blob/main/AGENT-CONTRACT-SPEC.md)
- [docs.rs](https://docs.rs/baqup-agent)
## License
Fair Source License - see [LICENSE](./LICENSE) for details.