<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">It depends on what you mean by "update", so let me describe the two things it could mean.</p>

<p dir="auto">Suppose you upload cat.jpg to your cluster:</p>

<p dir="auto"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg -T cat1.jpg -XPUT</code></p>

<p dir="auto">Now you've got bestcat.jpg in your cluster.</p>

<p dir="auto">But, oh no! You forgot to add your metadata to the picture. Let's do that:</p>

<p dir="auto"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg -XPOST -H "x-object-meta-name: mr snugglz" -H "x-object-meta-breed: tabby"</code></p>

<p dir="auto">In this case, the Swift cluster has updated the metadata, but the data itself hasn't changed or moved.[1] This operation is fast and lightweight. Note, however, that when you POST to an object, you must give the whole set of x-object-meta-* keys and values. The metadata sent to an object on POST replaces the current set.</p>

<p dir="auto">Oh no! We mis-spelled the cat's name! Let's fix it:</p>

<p dir="auto"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg -XPOST -H "x-object-meta-name: mr snuggles" -H "x-object-meta-breed: tabby"</code></p>

<p dir="auto">Tragedy strikes again! Mr Snuggles ran into the road and was hit by a car. Tragic, yes, but you have overcome this trial and adopted a new cat from the local rescue shelter. The new cat, Ms Sunshine, is better in every possible way. We certainly can't still have a "bestcat.jpg" object that is an old pic of Mr Sunggles!</p>

<p dir="auto"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">curl -i -H "x-auth-token: foobar" https://awesome.swift.cluster.foobar/v1/AUTH_me/cats/bestcat.jpg -T cat2.jpg -H "x-object-meta-name: ms sunshine" -H "x-object-meta-birthday: July 12, 2017" -XPUT</code></p>

<p dir="auto">Now Swift as written the data of cat2.jpg and replaced the previous content that was there, along with the new metadata we set in the PUT request.</p>

<p dir="auto">Swift is a durable storage system which means that it stores multiple copies of the data in different places. If one of those locations was offline when you did the overwrite and then came back online (e.g. a server restarting), Swift will reconcile the data asynchronously in the background. From the perspective of you the API user (or any client), bestcat.jpg has the most up to data contents and the most recent metadata.</p>

<p dir="auto">[1] Assuming Swift 2.13.0 with default settings or Swift 2.7.0 or later with object_post_as_copy set to False.</p>

<p dir="auto">Hope that helps</p>

<p dir="auto">--John</p>

<p dir="auto">On 19 Jul 2017, at 9:15, Sameer Kulkarni wrote:</p>

<p dir="auto"></p></div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Hi All,<br>
<br>
How does update operation work in Swift?<br>
<br>
Like, does it deletes the older object and creates new entry or It finds<br>
out which part of object is modified and just copies or pushes the modified<br>
object?<br>
<br>
<br>
Thank you<br>
_______________________________________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" style="color:#777">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
Post to     : openstack@lists.openstack.org<br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" style="color:#777">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a></p>
</blockquote></div>
<div style="white-space:normal">
</div>
</div>
</body>
</html>