ovh / svfs

The Swift Virtual File System
Other
374 stars 54 forks source link

Time on files #102

Closed ne0ark closed 7 years ago

ne0ark commented 7 years ago

Context

Is it possible to show last modified or created date/time? In the mounted files, I see today's dates i tried option extra_attr.

xlucas commented 7 years ago

The modification time should be saved if you are using extra_attr. How do you copy these files ?

ne0ark commented 7 years ago

I am not copying. I just have backend script to add cache control to the files. So I just need filename and time created. When object storage is mounted it shows date/time that wrong.

xlucas commented 7 years ago

I don't understand what you are saying. How do you create these files before accessing them ?

ne0ark commented 7 years ago

Files are added via API using PHP-Opencloud. Then I have a bash script that checks the time on these files and adds cache headers to them via curl. The only issue is if there a reboot, time on the files seems to reset to something other then time for create/modify.

xlucas commented 7 years ago

To be useful extra_attr must be used with objects holding a X-Object-Meta-Mtime header. It seems this is not the case in the process you are describing. Right ?

As a fallback, object's Last-Modified header is used to provide a file's modification and creation time.

Can you provide an excerpt of your actions and what you are expecting & observing in detail ?

ne0ark commented 7 years ago

Hello,

I am using: _netdev,extra_attr,uid=0,gid=127,default_perm,relatime,allow_other,mode=0770

 swift stat cloud 72efa08d1f9e1b44599e7d43185c4e50.jpg
       Account: AUTH_xxxxx
     Container: cloud
        Object: 72efa08d1f9e1b44599e7d43185c4e50.jpg
  Content Type: image/jpeg
Content Length: 627358
 Last Modified: Sun, 23 Oct 2016 17:23:54 GMT
          ETag: 5ef68313994aaf68e87d190de943f104
 Accept-Ranges: bytes
    X-Trans-Id: txd7d25b1a9b7c4e609eb18-00580d04aa
   X-Timestamp: 1477243433.45341
 Cache-Control: public, max-age=31536000
stat /mnt/gra1/cloud/72efa08d1f9e1b44599e7d43185c4e50.jpg
  File: '/mnt/gra1/cloud/72efa08d1f9e1b44599e7d43185c4e50.jpg'
  Size: 627358          Blocks: 1224       IO Block: 4096   regular file
Device: 2ah/42d Inode: 14702088533036650568  Links: 1
Access: (0770/-rwxrwx---)  Uid: (    0/    root)   Gid: (  127/dd-agent)
Access: 2016-10-22 09:38:11.910932415 -0400
Modify: 2016-10-23 13:23:54.000000000 -0400
Change: 2016-10-23 13:23:54.000000000 -0400
 Birth: -

It seems like last modified date/time is different.

Thanks

xlucas commented 7 years ago

No it's not.

2016-10-23 13:23:54.000000000 -0400 is a time notation using a local offset.

This is equivalent to 2016-10-23 17:23:54.000000000Z <=> Sun, 23 Oct 2016 17:23:54 GMT