-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Express selector matching of sub-ranges of bytes or strings (#184)
Primarily useful over ADL composite nodes, the traversal of a node may select only a partial range of the node contents, allowing for selector specification traversals that partially return the nodes backing a unixfs file.
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Selector Fixtures (ADL) | ||
======================= | ||
|
||
This file contains a set of selectors that can be used to test the ADL capabilities of selectors (InterpretAs and Slice). | ||
|
||
|
||
### What's the fixture format? | ||
|
||
Same as described in [selector-fixtures-1](../selector-fixtures-1/#whats-the-fixture-format). | ||
|
||
--- | ||
|
||
|
||
Fixtures | ||
-------- | ||
|
||
### A slice of a unixfs file. | ||
|
||
#### data | ||
The combination of these five data objects is replicated in `selector-fixtures-adl.car`. | ||
|
||
[testmark]:# (adl-interpreted/root) | ||
```json | ||
{ | ||
"Data":{ | ||
"/":{"bytes":"CAIYgIBAIICAECCAgBAggIAQIICAEA"} | ||
}, | ||
"Links":[ | ||
{"Hash":{"/":"baguqeera2pkvbqv2slrvh3dswozj6ozoob53idll3rkh3zh5tqsdqjvpzu7q"},"Name":"","Tsize":14}, | ||
{"Hash":{"/":"baguqeerasc2dhjjhbg6h3rt7rqbgpzlwzng5to3zwxcxtmdajfqt6tdyxscq"},"Name":"","Tsize":14}, | ||
{"Hash":{"/":"baguqeera7d7gvq7y7rugmmzh3u2552ckh6hyqno3tptbceutb5s3c4vixsua"},"Name":"","Tsize":14}, | ||
{"Hash":{"/":"baguqeeraxvm7dmqutnagoxxhq2iyghr5qidbjovdi7iqdptw527gifajqlgq"},"Name":"","Tsize":14} | ||
] | ||
} | ||
``` | ||
|
||
the leaves are dag-json encodings of "file chunk a\r\n" through "file chunk d\r\n". | ||
|
||
[testmark]:# (adl-interpreted/baguqeera2pkvbqv2slrvh3dswozj6ozoob53idll3rkh3zh5tqsdqjvpzu7q) | ||
```json | ||
{ | ||
"/":{"bytes":"ZmlsZSBjaHVuayBhCgo"} | ||
} | ||
``` | ||
[testmark]:# (adl-interpreted/baguqeerasc2dhjjhbg6h3rt7rqbgpzlwzng5to3zwxcxtmdajfqt6tdyxscq) | ||
```json | ||
{ | ||
"/":{"bytes":"ZmlsZSBjaHVuayBiCgo"} | ||
} | ||
``` | ||
[testmark]:# (adl-interpreted/baguqeera7d7gvq7y7rugmmzh3u2552ckh6hyqno3tptbceutb5s3c4vixsua) | ||
```json | ||
{ | ||
"/":{"bytes":"ZmlsZSBjaHVuayBjCgo"} | ||
} | ||
``` | ||
[testmark]:# (adl-interpreted/baguqeeraxvm7dmqutnagoxxhq2iyghr5qidbjovdi7iqdptw527gifajqlgq) | ||
```json | ||
{ | ||
"/":{"bytes":"ZmlsZSBjaHVuayBkCgo"} | ||
} | ||
``` | ||
#### selector | ||
|
||
[testmark]:# (adl-interpreted/selector) | ||
```json | ||
{ | ||
"~": { | ||
"as": "unixfs", | ||
">": { | ||
".": { | ||
"subset": { | ||
"[": 14, | ||
"]": 42 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
#### expected visit events | ||
|
||
the visit will be to the synthetic node containing the contents: "file chunk b\r\nfile chunk c\r\n" | ||
|
||
[testmark]:# (adl-interpreted/expect-visit) | ||
```text | ||
{"path": "", "node": {"bytes": {"/":{"bytes":"ZmlsZSBjaHVuayBiCgpmaWxlIGNodW5rIGMKCg"}}}, "matched": true} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters