Comments (11)
I will try to work on this today.
from uuid.
Hi, if you want to create a PR, I can help review it! (I have no authority in the uuid project, just offering my assistance)
from uuid.
Hi @posborne, do you still have any time to implement this change? If not, I can take a crack at it.
from uuid.
hi @posborne are you still interested in providing a PR for this? I want this to be part of 0.7 release. Else @radix can work on it.
from uuid.
Any recommendations for how to handle storing the "last updated" time in the context?
Stable rust only exports AtomicUsize
, not things like AtomicU64
and AtomicU32
. And even if those types were stabilized, they would not all be available on all platforms: https://doc.rust-lang.org/src/core/sync/atomic.rs.html#1439
If we want the default UuidV1Context
datastructure to continue to support multi-threaded use, then we must use some internally-mutable type that supports multithreaded access. This means either Atomics or Mutexes...
maybe there's some way we could use Atomics, but there are apparently even platforms where usize == u16. That means we would need a way to store 96 bits of timestamp across up to 6 AtomicUsize values...
Just using Arc<Mutex<Timestamp>>
for the timestamp would work, but this could end up slowing down new_v1
by a lot.
from uuid.
I have a WIP in the linked PR #136, using the Mutex approach for keeping track of the previous time.
Surprisingly to me, this only increases the runtime of v1 generation to about 2x the previous time. But it has another drawback too: the default context now requires std whereas the old one would work without it (mutexes are only available with std). Is this really okay? Should we add another context implementation identical to the old one, so we have something for people who want to generate v1 uuids without std?
I'm also wondering what the drawbacks to the old context. The RFC does say that we should update it when the timestamp might have stayed the same or gone backwards, but it doesn't forbid or even seem to say we SHOULDN'T increment it when the timestamp moves forward.
Of course, the trait is definitely a good idea, I'm just wondering what problems we're going to solve with the new implementation. Does anyone know if there was any rationale for this discussed elsewhere (during the libs blitz perhaps)?
from uuid.
I put up a more conservative PR at #137. It only adds the trait, and doesn't change the way sequences are generated. It's all backwards compatible.
from uuid.
Just a note that we don’t merge that PR until 0.6 is released
from uuid.
@posborne the trait merged in #137 and released in 0.6.0 fullfills the needs of this issue. If anything else is needed, you may create a new issue for it :)
from uuid.
I know this has already been closed but I think offering a trait to "solve" this problem is the wrong approach. The default use of ClockSequence here is just plain wrong and should be corrected to follow spec.
from uuid.
@PrismaPhonic thanks. We are always open to discussing issues and decisions. Moving this to a new issue for better traction.
from uuid.
Related Issues (20)
- Implement FromParam trait for Uuid from the Rocket web framework crate HOT 1
- Add compatibility with rocket HOT 1
- regression(?): Pretty debug printing now strips hyphens
- Compilation error with wasm_bindgen HOT 2
- Parsing error mentions incorrect characters as expected
- `cargo install uuid` should give me a uuid tool HOT 5
- Cleaning up crate features HOT 1
- Add `.as_str()` for Uuid HOT 2
- Simple Encode / Decode HOT 2
- Fix MSRV build
- `Timestamp::from_rfc4122` panics when using timestamp before unix epoch HOT 4
- About UUID v7 implementation HOT 1
- Uuid Serialization & Deserialization Error : expected ident at line 1 column 2 HOT 2
- Optional support for borsh
- Wasm32-unknown-unknown tests not running
- 1.3.4 and 1.3.3 failing in Cloudflare Worker env for different reasons
- Unable to activate feature "v7" HOT 6
- Request: add configuration to enable/disable deserializing different formats HOT 2
- Wrapping behavior of `impl ClockSequence for Context` HOT 4
- Export `error::InvalidUuid` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uuid.