Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Temporal database stores full information in the payload ( CPS-192: Design data store for Temporal Service). 
  • It is possible that data stored for the different timestamps is the same, especially if the payload is used to filter data.
  • Data in the response body will always contain the entire payload data.

Query APIs 

Filtering Data

...

Adding payload filtering with DateTime criteria can make the query APIs complicated. Hence, we will implement the basic APIs first and will add complex ones when required.

Others Parameters
NoNameTypeDefaultPurposeExample
1indexint

The query output can have many rows so it is important to limit the fetched data. To limit

...

the number of records and to

...

  • index 
  • maxSize: default as 1000 (configurable) with the ability to override.

provide pagination, these two parameters can be used. 

"index" parameter represents the page number, starts with 0, and maxSize is the page size.


2maxSizeint1000
3point-in-timeDateTimeCurrentDateTimePagination does not work well if new data gets added which fulfils the search criteria. The user must provide this value to avoid this issue.
Proposed APIs - Approach 1 - GET 

...

NoAPI endpointDescriptionExample
1.

GET /dataspaces/{dataspace-name}​/anchors/{anchor-name}​?after=<epoch-time>&maxSize=1000&?payload={"abcd" : "abcd"}

Return all the data entries for an anchor after the specified epoch in nanoseconds
2.​GET /dataspaces/{dataspace-name}/schema-sets/{schema-set}?after=<epochtime>Return all the data entries based on provided schema-set after the specified epoch in nanoseconds.




Response Body
It contains three field 
nametype
nextRecordsLinkstringadded only if there are remaining records to be fetched for the query.
previousRecordsLinkstringadded only if it is not the first set of records.
recordslist

contains one record for each timestamp that meets filtering criteria. It contains header information along with data. 


Code Block
{
  "nextRecordsLink": "cps-temporal/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}?after=<epoch-time>&maxSize=1000&before=<epoch-time>&index=2&point-in-time=DATE",
  "previousRecordsLink": "cps-temporal/api/v1/dataspaces/{dataspace-name}/anchors/{anchor-name}?after=<epoch-time>&maxSize=1000&before=<epoch-time>&index=0&point-in-time=DATE",
  "records": [
    {
      "timestamp": "1234567788889",
      "dataspace": "my-dataspace",
      "schemaSet": "my-schema-set",
      "anchor": "my-anchor",
      "data": {
        "status" : "UP"
      }
    }
  ]
}

...