Re: [PATCH v3 17/34] fsmonitor--daemon: define token-ids
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 1, 2021, 22:58 UTC
- Message-ID
- <87mtr5bpuw.fsf@evledraar.gmail.com>
- In-Reply-To
- <37fdce5ec3afaa9aae5001c648fced0675dae0c4.1625150864.git.gitgitgadget@gmail.com>
On Thu, Jul 01 2021, Jeff Hostetler via GitGitGadget wrote:
Show 16 quoted lines
> + if (!test_env_value) {
> + struct timeval tv;
> + struct tm tm;
> + time_t secs;
> +
> + gettimeofday(&tv, NULL);
> + secs = tv.tv_sec;
> + gmtime_r(&secs, &tm);
> +
> + strbuf_addf(&token->token_id,
> + "%"PRIu64".%d.%4d%02d%02dT%02d%02d%02d.%06ldZ",
> + flush_count++,
> + getpid(),
> + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
> + tm.tm_hour, tm.tm_min, tm.tm_sec,
> + (long)tv.tv_usec);Just bikeshedding, but can we have tokens that mostly sort numeric-wise by time order? So time at the start, not the flush_count/getpid.
Maybe I'm missing something, but couldn't we just re-use the trace2 SID + a more trivial trailer? It would have the nice property that you could find the trace2 SID whenever you looked at such a token (could e.g. split them by "/" too), and add the tv_usec, flush_count+whatever else is needed to make it unique after the "/", no?