Ask Your Question

Is object versioning maintain multiple copies of different version

asked 2015-01-13 04:29:05 -0500

sagar gravatar image

Dear all,

Is object versioning maintain multiple copies of a file if we upload in different versions ?

Is it same as cvs ?

or How to get CVS kind of functionality in object versioning ?

For example ............

i am going to implement object versioning in my swift machine. My criteria is

i have one file 1.doc

i uploaded to swift today

tomorrow i again modified the same file and uploaded 1.doc to swift

after one week again i modified 1.doc and uploaded to swift

now i uploaded 3 versions of 1.doc into swift

how can i download all 3 versions of 1.doc

Thanks kalasagar

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2015-01-14 01:03:20 -0500

sagar gravatar image

Thanks omar

i already tried help manual and its working for me too.

i followed ur commands too there is no issue

suppose if i uploaded a file with minor modifications for 10 times.

i need a file which uploaded 5th time. again for that i am going to priorwork container and listing the files and downloading the 5th object.

here my concern is how can i get the timestamps without looking into prorwork list ?

second thing is "is it possible to get cvs kind of functionality here "

like tag names in cvs is there any facility to upload or download

my view is if we give tag kind of thing while uploading its simple we can download with that tag

while uploading its returning one etag what it is and how we can use it ?

edit flag offensive delete link more

answered 2015-01-13 20:14:46 -0500

updated 2015-01-13 23:02:02 -0500

Hello Kalasagar,

I wrote this up to hopefully better explain the process of object versioning. I used the Swift client to make it a bit more human readable.

Note: You must first create a destination container before enabling object versioning.

Creating the destination container 'priorwork'

curl -i -H 'x-auth-token: authabc123' https://$storageURL/v1/123456789/priorwork -X PUT

Creating the container i will upload my files to named 'mywork'

curl -i -H 'x-auth-token: authabc123' https://$storageURL/v1/123456789/mywork -X PUT

Enabling Object versioning on the 'mywork' container

curl -i -H 'x-auth-token: authabc123' https://$storageURL/v1/123456789/mywork -X POST -H 'x-versions-location: priorwork'

I'm using swift to show the headers set on the 'mywork' container. '

$ swift stat mywork
       Account: 123456789
     Container: mywork
       Objects: 0
         Bytes: 0
      Read ACL:
     Write ACL:
       Sync To:
      Sync Key:
 Accept-Ranges: bytes
   X-Timestamp: 1421199557.02953
    X-Trans-Id: txd1fca295dc534079ab728-0054b5c8e7
  Content-Type: text/plain; charset=utf-8
X-Versions-Location: priorwork

Create a file and upload it to container 'mywork'

$ date > date.txt
$ swift upload mywork date.txt

'mywork' container shows only one file in this container

$ swift list mywork

my destination version container 'priorwork' is empty

$ swift list priorwork

modify file and upload again for the second time

$ date > date.txt
$ swift upload mywork date.txt

'mywork' container will continue to show only one file regardless of how many times you upload revisions with the same filename.

$ swift list mywork

Now the magic happens, 'priorwork' container my destination version-container now shows the original version with the object name modified.

$ swift list priorwork

(Where length is the 3-character, zero-padded hexadecimal character length of the object, <object_name> is the object name, and <timestamp> is the time when the object was initially created as a current version.)

modify file and upload the third version

$ date > date.txt
$ swift upload mywork date.txt

A listing of my 'priorwork' container shows 2 older versions, and the latest copy in the 'mywork' container

$ swift list priorwork

or using curl

$ curl -i https://$storageURL/v1/12345678/priorwork?prefix=008date.txt/ -H "X-Auth-Token: authabc123"
HTTP/1.1 200 OK
Content-Length: 58
X-Container-Object-Count: 2
Accept-Ranges: bytes
X-Timestamp: 1421199450.65049
X-Container-Bytes-Used: 58
Content-Type: text/plain; charset=utf-8
X-Trans-Id: txf98787688116472a8039f-0054b5cf15
Date: Wed, 14 Jan 2015 02:06:13 GMT


Now you can download the old versions of the file from the 'priorwork' or the latest from the 'mywork' container with a simple GET or 'swift download $008date.txt/1421199843.16070 '

curl -i https://$storageURL/v1/12345678/priorwork/008date.txt/1421199843.16070 -X GET -H "X-Auth-Token: authabc123"
curl -i https://$storageURL/v1/12345678/priorwork/008date.txt/1421199870.80709 -X GET -H "X-Auth-Token: authabc123"
curl -i https://$storageURL/v1/12345678/mywork/008date.txt -X GET -H "X-Auth-Token: authabc123"

Reference Material : (Object Version Docs) , (Openstack CLI Installation instructions)

edit flag offensive delete link more


My concern is the objects in the priorwork are object/timestamp

is it possible to give some tags and is it possible to download very simply without looking at priorwork and timestamp ?

sagar gravatar imagesagar ( 2015-01-14 01:04:55 -0500 )edit

Unfortunately there isn't that type of functionality in Swift at this time. This is a pretty basic feature with very little customization currently.

omar-munoz gravatar imageomar-munoz ( 2015-01-14 21:39:09 -0500 )edit

i want to use Etag or versioning based on some version numbers not based on timestamps. Please help me if anyone know about it

sagar gravatar imagesagar ( 2015-01-19 05:18:27 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-01-13 04:29:05 -0500

Seen: 403 times

Last updated: Jan 14 '15