[PR #1770] [MERGED] add TypedRecord and TypedRecordRef #2593

Closed
opened 2026-03-16 10:43:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1770
Author: @bluejekyll
Created: 8/28/2022
Status: Merged
Merged: 3/24/2023
Merged by: @bluejekyll

Base: mainHead: new-typed-record


📝 Commits (10+)

  • ea27cd0 Make Record carry type for internal RecordData
  • 1b7be11 Add more type annotations to RData implementations
  • 05f12eb fixup cleanliness for typed record
  • f946dc7 Add RecordData impl for A
  • a59c659 impl RecordData for AAAA
  • 5de53a8 Simplify encode and decode of fixed length types
  • 0c51bb3 convert A and AAAA to use RecordData traits
  • 475e519 convert CAA RecordData traits
  • 8408604 convert CSYNC RecordData traits
  • 9edf20f implement RecordData for most RData types

📊 Changes

93 files changed (+4205 additions, -2749 deletions)

View changed files

📝 bin/tests/named_tests.rs (+3 -2)
📝 bin/tests/server_harness/mod.rs (+21 -32)
📝 copyright.txt (+1 -1)
📝 crates/client/src/client/async_client.rs (+36 -29)
📝 crates/client/src/lib.rs (+6 -4)
📝 crates/client/src/rr/mod.rs (+7 -15)
📝 crates/proto/src/https/https_client_stream.rs (+6 -5)
📝 crates/proto/src/op/edns.rs (+19 -23)
📝 crates/proto/src/op/message.rs (+5 -5)
crates/proto/src/rr/dnssec/rdata/cdnskey.rs (+76 -0)
crates/proto/src/rr/dnssec/rdata/cds.rs (+76 -0)
📝 crates/proto/src/rr/dnssec/rdata/dnskey.rs (+97 -74)
📝 crates/proto/src/rr/dnssec/rdata/ds.rs (+62 -41)
📝 crates/proto/src/rr/dnssec/rdata/key.rs (+84 -63)
📝 crates/proto/src/rr/dnssec/rdata/mod.rs (+78 -48)
📝 crates/proto/src/rr/dnssec/rdata/nsec.rs (+63 -43)
📝 crates/proto/src/rr/dnssec/rdata/nsec3.rs (+116 -93)
📝 crates/proto/src/rr/dnssec/rdata/nsec3param.rs (+67 -45)
crates/proto/src/rr/dnssec/rdata/rrsig.rs (+140 -0)
📝 crates/proto/src/rr/dnssec/rdata/sig.rs (+102 -82)

...and 73 more files

📄 Description

@djc, here are the types I was suggesting. It's possible that TypedRecordRef is not necessary if we deprecate Record and replace all use cases with TypedRecord. A different option instead of deprecating would be to do a type alias of type Record = TypedRecord<RData>. I'm not sure which would be better for downstream dependencies.

If you like this, I can add everything necessary to make all RecordData be compatible with this, currently only SOA implements RecordData.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1770 **Author:** [@bluejekyll](https://github.com/bluejekyll) **Created:** 8/28/2022 **Status:** ✅ Merged **Merged:** 3/24/2023 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `new-typed-record` --- ### 📝 Commits (10+) - [`ea27cd0`](https://github.com/hickory-dns/hickory-dns/commit/ea27cd0db1c51149f7a16f3b7587cf6ff7a8cc11) Make Record carry type for internal RecordData - [`1b7be11`](https://github.com/hickory-dns/hickory-dns/commit/1b7be116a3583fd418a977748916407673c3106c) Add more type annotations to RData implementations - [`05f12eb`](https://github.com/hickory-dns/hickory-dns/commit/05f12ebd5c493444fbfab4bf25775bd1c12acce4) fixup cleanliness for typed record - [`f946dc7`](https://github.com/hickory-dns/hickory-dns/commit/f946dc73a14298a503aded5fc4998135776d0633) Add RecordData impl for A - [`a59c659`](https://github.com/hickory-dns/hickory-dns/commit/a59c659da633b64c62330a14af081a2366a175f0) impl RecordData for AAAA - [`5de53a8`](https://github.com/hickory-dns/hickory-dns/commit/5de53a83b7a42ef54f5fdbb5124fd1a7b948b776) Simplify encode and decode of fixed length types - [`0c51bb3`](https://github.com/hickory-dns/hickory-dns/commit/0c51bb3fda37c2812e327f04c01de4adca2979e9) convert A and AAAA to use RecordData traits - [`475e519`](https://github.com/hickory-dns/hickory-dns/commit/475e5190bc0450d478431ffd0d6a2484fa808868) convert CAA RecordData traits - [`8408604`](https://github.com/hickory-dns/hickory-dns/commit/8408604d66bc03baf15bae541e2bb0c238f7ed50) convert CSYNC RecordData traits - [`9edf20f`](https://github.com/hickory-dns/hickory-dns/commit/9edf20f424e984444cf3e66e2b401b11ad0b572f) implement RecordData for most RData types ### 📊 Changes **93 files changed** (+4205 additions, -2749 deletions) <details> <summary>View changed files</summary> 📝 `bin/tests/named_tests.rs` (+3 -2) 📝 `bin/tests/server_harness/mod.rs` (+21 -32) 📝 `copyright.txt` (+1 -1) 📝 `crates/client/src/client/async_client.rs` (+36 -29) 📝 `crates/client/src/lib.rs` (+6 -4) 📝 `crates/client/src/rr/mod.rs` (+7 -15) 📝 `crates/proto/src/https/https_client_stream.rs` (+6 -5) 📝 `crates/proto/src/op/edns.rs` (+19 -23) 📝 `crates/proto/src/op/message.rs` (+5 -5) ➕ `crates/proto/src/rr/dnssec/rdata/cdnskey.rs` (+76 -0) ➕ `crates/proto/src/rr/dnssec/rdata/cds.rs` (+76 -0) 📝 `crates/proto/src/rr/dnssec/rdata/dnskey.rs` (+97 -74) 📝 `crates/proto/src/rr/dnssec/rdata/ds.rs` (+62 -41) 📝 `crates/proto/src/rr/dnssec/rdata/key.rs` (+84 -63) 📝 `crates/proto/src/rr/dnssec/rdata/mod.rs` (+78 -48) 📝 `crates/proto/src/rr/dnssec/rdata/nsec.rs` (+63 -43) 📝 `crates/proto/src/rr/dnssec/rdata/nsec3.rs` (+116 -93) 📝 `crates/proto/src/rr/dnssec/rdata/nsec3param.rs` (+67 -45) ➕ `crates/proto/src/rr/dnssec/rdata/rrsig.rs` (+140 -0) 📝 `crates/proto/src/rr/dnssec/rdata/sig.rs` (+102 -82) _...and 73 more files_ </details> ### 📄 Description @djc, here are the types I was suggesting. It's possible that TypedRecordRef is not necessary if we deprecate `Record` and replace all use cases with `TypedRecord`. A different option instead of deprecating would be to do a type alias of `type Record = TypedRecord<RData>`. I'm not sure which would be better for downstream dependencies. If you like this, I can add everything necessary to make all `RecordData` be compatible with this, currently only `SOA` implements `RecordData`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 10:43:34 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2593
No description provided.