You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

CPS-251 - Getting issue details... STATUS

Introduction

Assumptions

  • 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 response body will always contain the entire payload.

Query APIs 

Filtering Data

In CPS temporal, the data can be filtered based on three criteria

  • Datetime
    • Data in last X hours
    • Data after a particular DateTime ( epoch time in nanoseconds )
    • Data before a particular DateTime ( epoch time in nanoseconds )
    • Data at a particular time
    • Last X network data
  • DataTypes in CPS Core
    • Dataspace & schema-set

    • Dataspace & anchor
    • Dataspace & multiple anchors - To improve performance, if there is a need to fetch data for multiple anchors.
    • Dataspace
  • Payload
    • Based on a subsection or field in the payload. These criteria do need schema-set to be fixed to search in the same set of anchors

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
  • The query output can have many rows so it is important to limit the fetched data. To limit it and to add a pagination feature, we provided two 
    • index 
    • maxSize: default as 1000 (configurable) with the ability to override.
Proposed APIs
NoAPI endpointDescriptionExample
1.

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

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. 


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


Open Items

  1. Datetime format 

 




  • No labels