# krabka-metadata
[](https://crates.io/crates/krabka-metadata)
[](https://docs.rs/krabka-metadata)
[](https://github.com/krabka-io/krabka-protocol/actions/workflows/ci.yml)
Versioned metadata record types + immutable image for Krabka.
This crate is part of [Krabka](https://github.com/krabka-io/krabka-protocol), a Rust implementation of Kafka-compatible infrastructure and clients.
## Install
```sh
cargo add krabka-metadata
```
For workspace development, use the path dependency from this repository instead.
## Usage example
Apply controller records to build an immutable metadata image:
```rust
use krabka_metadata::{MetadataImage, MetadataRecord, TopicRecord};
use uuid::Uuid;
let mut image = MetadataImage::new(Uuid::new_v4());
let topic_id = Uuid::new_v4();
image.apply(&MetadataRecord::V1Topic(TopicRecord {
name: "orders".into(),
topic_id,
partitions: 3,
replication_factor: 1,
}));
assert_eq!(image.topic("orders").unwrap().topic_id, topic_id);
```
## Documentation
The API documentation is on [docs.rs/krabka-metadata](https://docs.rs/krabka-metadata). The repository README contains project-wide setup, development, and release notes.
## License
Apache-2.0. See the repository `LICENSE` and `NOTICE` files for details.