Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make timerange more prominent in docs #9

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 7 additions & 36 deletions api/TimeAddressableMediaStore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ paths:
description: Filter on flows that overlap the given time range.
schema:
default: _
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
- name: format
in: query
description: Filter on flow format.
Expand Down Expand Up @@ -251,7 +251,7 @@ paths:
description: Limit the returned available segment time range to this time range.
schema:
default: _
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
responses:
"200":
description: ""
Expand Down Expand Up @@ -546,7 +546,7 @@ paths:
X-Paging-Timerange:
description: Identifies the time range for the returned data set.
schema:
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
X-Paging-Count:
description: The number of items in the returned data set.
schema:
Expand Down Expand Up @@ -627,7 +627,7 @@ paths:
description: Only delete flow segments that are completely covered by the given time range.
schema:
default: _
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
- name: object_id
in: query
description: Filter on object identifier.
Expand Down Expand Up @@ -695,15 +695,15 @@ paths:
X-Paging-Next-Timerange:
description: The 'timerange' to use in the Post data to get the next page. If 'X-Paging-Next-Timerange' is not present then it is the last page.
schema:
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
X-Paging-Limit:
description: Identifies the current limit being used for paging. This may not match the requested value if the requested value was too high for the implementation.
schema:
type: integer
X-Paging-Timerange:
description: Identifies the time range for the returned data set.
schema:
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
X-Paging-Count:
description: The number of items in the returned data set.
schema:
Expand Down Expand Up @@ -789,35 +789,6 @@ components:
title: UUID
pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
type: string
timestamp_type:
title: Timestamp
description: |
A signed nanosecond resolution timestamp represented as <sign><seconds>:<nanoseconds>. The intended
interpretation of the value is assumed to be defined elsewhere.

E.g.
* "1:40000000" is the timestamp of the 27th video frame for 25 Hz video with origin at "0:0".
* "1694429247:40000000" is the TAI timestamp for a video frame at 2023-09-11T10:46:50.04Z UTC.

Details of the format can be found in the Timestamp class provided in the Python
[mediatimestamp](https://github.com/bbc/rd-apmm-python-lib-mediatimestamp) library.
type: string
pattern: '^-?\d+:\d+$'
timerange_type:
title: TimeRange
description: |
A time range of timestamps. It is represented using a pair ot timestamps with inclusivity and exclusivity markers.

E.g.
* "[0:0_10:0)" represents 10 seconds of media starting at timestamp "0:0" and ending before "10:0".
* "(5:0_" represents a time range starting after "5:0" and to eternity.
* "[1694429247:0_1694429248:0)" is a 1 second TAI time range starting at 2023-09-11T10:46:50.0Z UTC.
* A "[" or "]" indicates that bound is inclusive, and a "(" or ")" indicates that bound is exclusive.

Details of the format can be found in the TimeRange class provided in the Python
[mediatimestamp](https://github.com/bbc/rd-apmm-python-lib-mediatimestamp) library.
type: string
pattern: '^(\[|\()?(-?\d+:\d+)?(_(-?\d+:\d+)?)?(\]|\))?$'
flowformat:
title: Flow Format
description: identifies the flow format using a URN string.
Expand Down Expand Up @@ -854,7 +825,7 @@ components:
in: query
description: Return only the results in the time range specified.
schema:
$ref: '#/components/schemas/timerange_type'
$ref: 'schemas/timerange.json'
trait_timerange_paged_limit:
name: limit
in: query
Expand Down
10 changes: 4 additions & 6 deletions api/schemas/deletion-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
},
"timerange_to_delete": {
"description": "The time range of FlowSegments to be deleted in this request.",
"type": "string",
"pattern": "[\\[\\(]\\d*:\\d*_\\d*:\\d*[\\]\\)]"
"description": "The time range of FlowSegments to be deleted in this request, as described by the [TimeRange](../schemas/timerange#top) type",
"$ref": "timerange.json"
},
"timerange_remaining": {
"description": "The time range of FlowSegments not yet deleted by this request.",
"type": "string",
"pattern": "[\\[\\(]\\d*:\\d*_\\d*:\\d*[\\]\\)]"
"description": "The time range of FlowSegments not yet deleted by this request, as described by the [TimeRange](../schemas/timerange#top) type",
"$ref": "timerange.json"
},
"delete_flow": {
"description": "Whether the Flow should be deleted once the timerange has been",
Expand Down
5 changes: 2 additions & 3 deletions api/schemas/flow-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@
"type": "integer"
},
"timerange": {
"description": "The time range of samples available in the flow.",
"type": "string",
"pattern": "^(\\[|\\()?(-?\\d+:\\d+)?(_(-?\\d+:\\d+)?)?(\\]|\\))?$"
"description": "The time range of samples available in the flow, as described by the [TimeRange](../schemas/timerange#top) type",
"$ref": "timerange.json"
}
}
}
25 changes: 10 additions & 15 deletions api/schemas/flow-segment.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,24 @@
"type": "string"
},
"ts_offset": {
"description": "The timestamp offset between the timestamps stored in the media file and the corresponding timestamp in the segment, ie. ts_offset = segment ts - media object ts. Assumed to be 0:0 if not set.",
"type": "string",
"pattern": "^-?\\d+:\\d+$"
"description": "The timestamp offset between the timestamps stored in the media file and the corresponding timestamp in the segment, ie. ts_offset = segment ts - media object ts. Assumed to be 0:0 if not set. Format as described by the [Timestamp](../schemas/timestamp#top) type, but cannot be negative",
"$ref": "timestamp.json"
},
"range": {
"description": "The timerange from the first media unit in the segment to the last (exclusive end if exclusive_last_ts is true).",
"type": "string",
"pattern": "^(\\[)?-?\\d+:\\d+(_-?\\d+:\\d+)?(\\]|\\))?$"
"description": "The timerange from the first media unit in the segment to the last (exclusive end if exclusive_last_ts is true), as described by the [TimeRange](../schemas/timerange#top) type",
"$ref": "timerange.json"
},
"first_ts" : {
"description": "The timestamp of the first media unit in the segment (which may not be the first unit in the object).",
"type": "string",
"pattern": "^-?\\d+:\\d+$"
"description": "The timestamp of the first media unit in the segment (which may not be the first unit in the object). Format as described by the [Timestamp](../schemas/timestamp#top) type",
"$ref": "timestamp.json"
},
"last_duration": {
"description": "The duration of the last media unit in the segment (which may differ from that of the object). Defaults to 1/rate if a fixed media rate is set.",
"type": "string",
"pattern": "^\\d+:\\d+$"
"description": "The duration of the last media unit in the segment (which may differ from that of the object). Defaults to 1/rate if a fixed media rate is set. Format as described by the [Timestamp](../schemas/timestamp#top) type, but cannot be negative",
"$ref": "timestamp.json"
},
"last_ts" : {
"description": "The timestamp of the start of the last media unit in the segment, or end of the last media unit in the segment if exclusive_last_ts is true.",
"type": "string",
"pattern": "^-?\\d+:\\d+$"
"description": "The timestamp of the start of the last media unit in the segment, or end of the last media unit in the segment if exclusive_last_ts is true. Format as described by the [Timestamp](../schemas/timestamp#top) type",
"$ref": "timestamp.json"
},
"exclusive_last_ts" : {
"description": "A true value indicates that the last_ts timestamp is the exclusive end of the last media unit in the segment.",
Expand Down
2 changes: 1 addition & 1 deletion api/schemas/flow-storage.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"segments": {
"type": "object",
"description": "Mapping of timeranges (validated by regex) to segment storage locations.",
"description": "Mapping of timeranges (validated by regex) to segment storage locations. Format as described by the [TimeRange](../schemas/timerange#top) type",
"patternProperties": {
"^[\\[\\(]?([0-9]+:[0-9]+)?_([0-9]+:[0-9]+)?[\\]\\)]?$": {
"type": "object",
Expand Down
6 changes: 6 additions & 0 deletions api/schemas/timerange.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"title": "TimeRange",
"description": "A time range of timestamps. It is represented using a pair ot timestamps with inclusivity and exclusivity markers.\n\nE.g.\n* \"[0:0_10:0)\" represents 10 seconds of media starting at timestamp \"0:0\" and ending before \"10:0\".\n* \"(5:0_\" represents a time range starting after \"5:0\" and to eternity.\n* \"[1694429247:0_1694429248:0)\" is a 1 second TAI time range starting at 2023-09-11T10:46:50.0Z UTC.\n* A \"[\" or \"]\" indicates that bound is inclusive, and a \"(\" or \")\" indicates that bound is exclusive.\n\nDetails of the format can be found in the TimeRange class provided in the Python\n[mediatimestamp](https://github.com/bbc/rd-apmm-python-lib-mediatimestamp) library.\n",
"type": "string",
"pattern": "^(\\[|\\()?(-?\\d+:\\d+)?(_(-?\\d+:\\d+)?)?(\\]|\\))?$"
}
6 changes: 6 additions & 0 deletions api/schemas/timestamp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"title": "Timestamp",
"description": "A signed nanosecond resolution timestamp represented as <sign><seconds>:<nanoseconds>. The intended\ninterpretation of the value is assumed to be defined elsewhere.\n\nE.g.\n* \"1:40000000\" is the timestamp of the 27th video frame for 25 Hz video with origin at \"0:0\".\n* \"1694429247:40000000\" is the TAI timestamp for a video frame at 2023-09-11T10:46:50.04Z UTC.\n\nDetails of the format can be found in the Timestamp class provided in the Python\n[mediatimestamp](https://github.com/bbc/rd-apmm-python-lib-mediatimestamp) library.\n",
"type": "string",
"pattern": "^-?\\d+:\\d+$"
}
Loading