Skip to content

Commit 466e04f

Browse files
committed
metadata: rename from @ndn/rdr
1 parent 7e380ff commit 466e04f

11 files changed

Lines changed: 71 additions & 25 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"test": "vitest",
1414
"typedoc": "bash mk/typedoc.sh"
1515
},
16-
"packageManager": "pnpm@11.11.0+sha512.4463f65fd80ed80d69bc1d4bf163ee94f605c7380fc318bb5b2ebe15f8cd12d49c51a4d59e951b401e764d3b6ca751cbf51bc50ed7001a6bcb4935e684c34882",
16+
"packageManager": "pnpm@11.17.0+sha512.cca3cea332ad254bb84145f966d19f4879615210346fc92c79a047f23a0d7b3cca3c3792f0076ba1f1831d277efbcf0a9119b31a9a60eca7fb3d6231f331ef72",
1717
"devDependencies": {
1818
"@types/node": "26.1.1",
1919
"@typescript/native": "npm:typescript@^7.0.2",

pkg/metadata/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# @ndn/metadata
2+
3+
This package is part of [NDNts](https://yoursunny.com/p/NDNts/), Named Data Networking libraries for the modern web.
4+
5+
This package implements the [Metadata Retrieval Protocol](https://redmine.named-data.net/projects/ndn-tlv/wiki/Metadata) (formerly RDR).

pkg/metadata/package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "@ndn/metadata",
3+
"version": "0.0.20260427",
4+
"description": "NDNts: Metadata Retrieval Protocol",
5+
"keywords": [
6+
"NDN",
7+
"Named Data Networking"
8+
],
9+
"author": "Junxiao Shi <npm@mail1.yoursunny.com>",
10+
"license": "ISC",
11+
"files": [
12+
"lib"
13+
],
14+
"type": "module",
15+
"main": "src/mod.ts",
16+
"module": "lib/mod_browser.js",
17+
"sideEffects": false,
18+
"homepage": "https://yoursunny.com/p/NDNts/",
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/yoursunny/NDNts.git",
22+
"directory": "pkg/metadata"
23+
},
24+
"publishConfig": {
25+
"main": "lib/mod_node.js",
26+
"types": "lib/mod.d.ts"
27+
},
28+
"dependencies": {
29+
"@ndn/endpoint": "workspace:*",
30+
"@ndn/naming-convention2": "workspace:*",
31+
"@ndn/packet": "workspace:*",
32+
"@ndn/tlv": "workspace:*",
33+
"tslib": "^2.8.1"
34+
},
35+
"devDependencies": {
36+
"@ndn/fw": "workspace:^",
37+
"@ndn/keychain": "workspace:*",
38+
"@ndn/util": "workspace:*"
39+
}
40+
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ export function makeDiscoveryInterest(prefix: NameLike): Interest {
1818
}
1919

2020
/**
21-
* Retrieve metadata packet of base type.
21+
* Retrieve metadata content of base type.
2222
* @param prefix - Metadata packet prefix.
2323
* @param cOpts - Consumer options.
2424
* - Commonly specified: `.retx` and `.verifier`.
25-
* - `.describe` defaults to "RDR-c" + prefix.
26-
* @returns Metadata packet.
25+
* - `.describe` defaults to "metadata-c" + prefix.
26+
* @returns Metadata content.
2727
*/
2828
export async function retrieveMetadata(prefix: NameLike, cOpts?: ConsumerOptions): Promise<Metadata>;
2929

3030
/**
31-
* Retrieve metadata packet of subclass type.
31+
* Retrieve metadata content of subclass type.
3232
* @typeParam C - Metadata subclass type.
3333
* @param prefix - Metadata packet prefix.
3434
* @param ctor - Metadata subclass constructor.
3535
* @param cOpts - Consumer options.
3636
* - Commonly specified: `.retx` and `.verifier`.
37-
* - `.describe` defaults to "RDR-c" + prefix.
38-
* @returns Metadata packet of type C.
37+
* - `.describe` defaults to "metadata-c" + prefix.
38+
* @returns Metadata content of type C.
3939
*/
4040
export async function retrieveMetadata<C extends Metadata.Constructor>(
4141
prefix: NameLike, ctor: C, cOpts?: ConsumerOptions
@@ -51,7 +51,7 @@ export async function retrieveMetadata(prefix: NameLike, arg2: any, cOpts?: Cons
5151

5252
const interest = makeDiscoveryInterest(prefix);
5353
const data = await consume(interest, {
54-
describe: `RDR-c(${prefix})`,
54+
describe: `metadata-c(${prefix})`,
5555
...cOpts,
5656
});
5757
return Decoder.decode(data.content, ctor);

pkg/metadata/src/mod.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from "./metadata";
2+
export * from "./consumer";
3+
export * from "./producer";
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ function makeName({ name }: Metadata, prefix?: NameLike): Name {
1010
return prefix.append(MetadataKeyword, Version.create(Date.now()), Segment.create(0));
1111
}
1212

13-
/** Make metadata packet. */
13+
/**
14+
* Make metadata packet.
15+
* @param m - Content of metadata packet.
16+
*/
1417
export async function makeMetadataPacket(m: Metadata, {
1518
prefix,
1619
freshnessPeriod = 1,
@@ -53,7 +56,11 @@ export function isDiscoveryInterest({ name, canBePrefix, mustBeFresh }: Interest
5356
return !!name.get(-1)?.equals(MetadataKeyword) && canBePrefix && mustBeFresh;
5457
}
5558

56-
/** Serve metadata packet in a producer. */
59+
/**
60+
* Serve metadata packet in a producer.
61+
* @param m - Content of metadata packet, or a function that returns the content.
62+
* @returns Producer instance.
63+
*/
5764
export function serveMetadata(m: Metadata | (() => Metadata), opts: serveMetadata.Options = {}): Producer {
5865
const {
5966
prefix: prefixInput,
@@ -74,7 +81,7 @@ export function serveMetadata(m: Metadata | (() => Metadata), opts: serveMetadat
7481
return undefined;
7582
},
7683
{
77-
describe: `RDR-s(${prefix})`,
84+
describe: `metadata-s(${prefix})`,
7885
...pOpts,
7986
},
8087
);
@@ -85,7 +92,7 @@ export namespace serveMetadata {
8592
* Producer options.
8693
*
8794
* @remarks
88-
* - `.describe` defaults to "RDR-s" + prefix.
95+
* - `.describe` defaults to "metadata-s" + prefix.
8996
* - `.announcement` defaults to {@link makeMetadataPacket.Options.prefix}.
9097
* - {@link makeMetadataPacket.Options.signer} defaults to `.dataSigner`.
9198
*/

pkg/rdr/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22

33
This package is part of [NDNts](https://yoursunny.com/p/NDNts/), Named Data Networking libraries for the modern web.
44

5-
This package implements metadata publishing and retrieval using [Realtime Data Retrieval (RDR) protocol](https://redmine.named-data.net/projects/ndn-tlv/wiki/RDR).
5+
*Realtime Data Retrieval (RDR) protocol* is renamed to [Metadata Retrieval Protocol](https://redmine.named-data.net/projects/ndn-tlv/wiki/Metadata).
6+
This package is deprecated in favor of `@ndn/metadata`.

pkg/rdr/package.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,7 @@
2626
"types": "lib/mod.d.ts"
2727
},
2828
"dependencies": {
29-
"@ndn/endpoint": "workspace:*",
30-
"@ndn/naming-convention2": "workspace:*",
31-
"@ndn/packet": "workspace:*",
32-
"@ndn/tlv": "workspace:*",
29+
"@ndn/metadata": "workspace:*",
3330
"tslib": "^2.8.1"
34-
},
35-
"devDependencies": {
36-
"@ndn/fw": "workspace:^",
37-
"@ndn/keychain": "workspace:*",
38-
"@ndn/util": "workspace:*"
3931
}
4032
}

0 commit comments

Comments
 (0)