FatFractal customer forums



Author Topic: Delta Updates?  (Read 2599 times)

jonnycools

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Delta Updates?
« on: March 22, 2014, 12:46:28 PM »
how does updating an object work?

There are three options for a key

Its there
Its NULL
Its not there

So if my extension attempts to update just one key, could I strip out all the other keys and whats not in the PUT request won't get written as NULL

For example I have this Comment Object

CREATE OBJECTTYPE Comment (FFUser REFERENCE /FFUSER, message STRING, other NUMERIC)

Say I have an extension

Code: [Select]

exports.somefunction = function()
{

var comment = ff.getObjectAUri("...");

var save = new Object();

save.guid = comment.guid;

save.other = comment.other + 1;

ff.updateObj(save);

}


Here I'm specifically leaving out the message. The reason is I have certain fields on the object that are maintained by the server. I have concerns over race conditions. Say the client updates this object with an old version of other or the server updates the object with an old version of message.

I would understand the key with null says i removed it.

The key with a value means update

Would the absence of a key just do nothing. - So for clients on the do not serialize, these properties won't get overridden with old data.

Would this work with the REST API if a key just wasn't in the JSON?

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Delta Updates?
« Reply #1 on: March 22, 2014, 02:47:49 PM »
For the client side: Currently no as we are using the HTTP PUT method for updates which semantically means do a complete replacement of whatever's currently there. We would need to support the PATCH method - see https://tools.ietf.org/html/rfc5789

The server-side functionality to support what you're asking is also not there

Would need to introduce a new family of methods to handle this

jonnycools

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Delta Updates?
« Reply #2 on: March 22, 2014, 02:57:35 PM »
Supporting client side is nightmarish. All i'm looking for is possibly server side and via REST API.


gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Delta Updates?
« Reply #3 on: March 22, 2014, 03:57:58 PM »
via REST API === client side in this context :)

Will add to the wish list

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Delta Updates?
« Reply #4 on: March 22, 2014, 06:45:39 PM »
FYI I did a bit of a spike earlier this evening and this looks like it will be pretty easy to add

jonnycools

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Delta Updates?
« Reply #5 on: March 22, 2014, 07:48:29 PM »
I've seen other services till this all into the PUT command. They only change what's there.
Could you also do array based operations for Grabbags. So I provide an array of ffurls and the add it remove operation. Maybe this can be done on update and create?

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Delta Updates?
« Reply #6 on: March 22, 2014, 07:54:01 PM »
Array-based operations for grab-bags is in the release going out tonight, albeit (for now) only as part of create and update

With regards to PUT doing partial updates - other services may well be doing that. However RFC5789 states
Quote
The PUT method is already defined to overwrite a resource with a complete new body, and cannot be reused to do partial changes.
and I like to try to honour the HTTP spec as best I can.

jonnycools

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Delta Updates?
« Reply #7 on: March 22, 2014, 07:57:20 PM »
That's perfect. This is all I want. Well I was just saying. As long as I have it I really don't care how it's done. When you're done, would I be possible to see what the structure of the json should look like. No rush there.

Thank again
« Last Edit: March 22, 2014, 08:21:04 PM by jonnycools »

jonnycools

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Delta Updates?
« Reply #8 on: March 22, 2014, 07:59:32 PM »
For the REST API

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: Delta Updates?
« Reply #9 on: March 22, 2014, 08:04:25 PM »
Sure thing - thanks!

 

Copyright © FatFractal customer forums