Martin Pitt's profile - activity

2014-05-15 02:44:05 -0600 received badge  Famous Question (source)
2014-03-18 01:46:25 -0600 commented answer How to create unique object names?

Thanks, I suspected something such. I just wanted to make sure to not miss anything.

2014-03-18 01:46:02 -0600 received badge  Supporter (source)
2014-03-17 18:15:04 -0600 received badge  Notable Question (source)
2014-03-17 00:54:51 -0600 received badge  Popular Question (source)
2014-03-14 12:49:39 -0600 received badge  Student (source)
2014-03-14 00:59:16 -0600 received badge  Organizer (source)
2014-03-14 00:55:45 -0600 asked a question How to create unique object names?

In our (future) setup we have many worker nodes executing tests, which want to store log files and artifacts in swift. We want to keep the entire history, thus want to create a pseudo-directory structure like either

  • /project/version/67/, i. e. ascending numbers, or
  • /project/version/YYYYMMDD-HHMMS.n/, i. e. time stamp based, with an extra suffix if two workers write a log at the same time; that suffix could just be an ascending number or a mktemp-like suffix (which doesn't sort, though).

I did not find any way of either getting a global counter, or atomically creating an object so that other writers won't use the same pseudo-dir-name, or getting a lock for exclusive access.

One could dramatically reduce the probability of collisions by using the format YYYYMMDD-HHMMS.XXXXXX where the Xes are a tmpname() random suffix. But that looks ugly, destroys the sorted order (for traversing from most recent to older logs), and only makes the problem smaller but doesn't fix it.

How does one create unique object names with concurrent writers in swift?

Thanks in advance!