CouchDB中的UUID [英] UUIDs in CouchDB

查看:97
本文介绍了CouchDB中的UUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道CouchDB中默认表示的UUID格式。虽然RFC 4122描述了 550e8400-e29b-11d4-a716-446655440000 之类的UUID,但CouchDB连续使用 3069197232055d39bc5bc39348a36417 之类的字符。我已经在他们的Wiki和他们的文档中搜索了一段时间,但这实际上是什么,但是没有任何结果。

I am wondering about the format UUIDs are by default represented in CouchDB. While the RFC 4122 describes UUIDs like 550e8400-e29b-11d4-a716-446655440000, CouchDB uses continuously chars like 3069197232055d39bc5bc39348a36417. I've searched some time in both their wiki and their documentation what this actually is, however without any result.

您知道这是否是不符合RFC的省略所有-格式,或者这是128位的完全不同的表示形式。

Do you know whether this is either a non RFC-conform format omitting all - or is this a completely different representation of the 128 bits.

背景是我使用的Java UUID的格式如RFC中所述。我看到了CouchDB样式可能更便于构建内部树的优点,但是我想确保使用一致的实现。

The background is that I'm using Java UUIDs which are formatted as noted in the RFC. I see the advantage that the CouchDB-style is probably more handy for building internal trees, but I want to be sure to use a consistent implementation.

推荐答案

从技术上讲,我们不像您注意到的那样将rfc标准用于uuid。版本四的uuid保留了大约四个位来指定uuid的版本。我们也不用在其他实现中常见的连字符对它们进行格式化。

Technically we don't use the rfc standard for uuids as you've noticed. Version four uuids reserve something like four bits to specify the version of uuid. We also don't format them with the hyphens that are generally seen in other implementations.

CouchDB uuid是16个随机字节,格式为十六进制。粗略地说,这是v4的uuid,但不符合rfc。

CouchDB uuids are 16 random bytes formatted as hex. Roughly speaking that's a v4 uuid but not rfc compliant.

无论具体内容如何,​​实际上并没有太大的问题。除非您尝试进行某种带外分析,否则通常不应该尝试解释uuid。 CouchDB永远不会解释uuid,我们仅依赖于其中涉及的随机性。

Regardless of the specifics, there's really not much of an issue in practice. You generally shouldn't try to interpret a uuid unless you're trying to do some sort out-of-band analysis. CouchDB will never interpret uuids, we only rely on the properties of randomness involved therein.

最重要的是不要担心,只将它们视为字符串即可。

Bottom line would be to not worry about it and just treat them as strings after generation.

这篇关于CouchDB中的UUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆