new Link(name, data)
The Link class extends Data and represents a Link instance where the Data
content is an encoded delegation set. The format is defined in "link.pdf"
attached to Redmine issue http://redmine.named-data.net/issues/2587 .
Create a new Link with the optional values. There are 3 forms of the constructor:
Link(name);
Link(data);
Link();
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | The name for constructing the base Data. |
data |
Data | The Data object to copy values from. If the content can be decoded using the default wire encoding, then update the list of delegations. |
Methods
addDelegation(preference, name, wireFormat) → {Link}
Add a new delegation to the list of delegations, sorted by preference number
then by name. Re-encode this object's content using the optional wireFormat.
Parameters:
Name | Type | Description |
---|---|---|
preference |
number | The preference number. |
name |
Name | The delegation name. This makes a copy of the name. If there is already a delegation with the same name, this updates its preference. |
wireFormat |
WireFormat | (optional) A WireFormat object used to encode the DelegationSet. If omitted, use WireFormat.getDefaultWireFormat(). |
Returns:
This Link so that you can chain calls to update values.
- Type
- Link
encodeContent(wireFormat)
A private method to encode the delegations_ and set this object's content.
Also set the meta info content type to LINK.
Parameters:
Name | Type | Description |
---|---|---|
wireFormat |
WireFormat | A WireFormat object used to encode the DelegationSet. |
getDelegations() → {DelegationSet}
Get the list of delegation for read only.
Returns:
The list of delegation, which you should treat as
read-only. To modify it, call Link.addDelegation, etc.
- Type
- DelegationSet
removeDelegation(name, wireFormat) → {boolean}
Remove every delegation with the given name. Re-encode this object's content
using the optional wireFormat.
Parameters:
Name | Type | Description |
---|---|---|
name |
Name | Then name to match the name of the delegation(s) to be removed. |
wireFormat |
WireFormat | (optional) A WireFormat object used to encode the DelegationSet. If omitted, use WireFormat.getDefaultWireFormat(). |
Returns:
True if a delegation was removed, otherwise false.
- Type
- boolean
wireDecode(input, wireFormat)
Override to call the base class wireDecode then populate the list of
delegations from the content.
Parameters:
Name | Type | Description |
---|---|---|
input |
Blob | Buffer | The buffer with the bytes to decode. |
wireFormat |
WireFormat | (optional) A WireFormat object used to decode this object. If omitted, use WireFormat.getDefaultWireFormat(). |