#316 Proposed Create Rec Op

Shawn Jacobson Tue 8 Sep 2015

Breaking out forum topic 314 into separate posts for each proposed Op.

Create

The create op is used to post new recs to the Haystack Server. It is the client's responsibility to maintain the remote references. Therefore, the client should post new recs of different types in different requests. In other words, the client should post new site recs prior to posting new equip recs that belong to those sites, and post new equip recs prior to posting new point recs that belong to those equips. This will allow the client to maintain and transform remote references. The client should maintain those remote references by adding the remote server id as an hsid property.

Request: a grid of records containing all recs to be added to the server. The client may pass its own internal id as an hsid so the server contains a reference to the remote record, but this should not be required.

Response: order consistent grid containing all recs that were added to the server with an "id" column being added to represent the server specific id of each rec. An "err" column should also be added so any rows that encountered an error during creation can report such error. It is assumed that rows with a defined "err" entity would not return an "id" entity.

Example:

Here is an example which posts some new recs to the server:

// request - site
ver:"2.0"
hsid,dis,site
@1234,"Site 1234",M

// response - site
ver:"2.0"
id,dis,hsid,site
@4321,"Site 1234",@1234,M

// request - equip
ver:"2.0"
hsid,dis,equip,siteRef,vav
@2345,"Equip 2345",M,@4321,M

// response - equip
ver:"2.0"
id,dis,equip,hsid,siteRef,vav
@5432,"Equip 2345",M,@2345,@4321,M

// request - point
ver:"2.0"
hsid,dis,equipRef,his,kind,point,siteRef
@3456,"Point 3456",@5432,M,"Number",M,@4321

// response - point
ver:"2.0"
id,dis,equipRef,his,hsid,kind,point,siteRef
@6543,"Point 3456",@5432,M,@3456,"Number",M,@4321

Questions:

  1. Is hsid the proper tag to use? If so, it should be added to the tag definitions so it is reserved.
  2. Is err the proper column to return for errors? If so, it should be added to the tag definitions so it is reserved for response grids.
  3. Should the server be allowed to add a rec and return an "err", therefore return both an "id" and an "err" on the record added? My opinion is no.
  4. Should all operations complete or fail atomically?

Login or Signup to reply.