guid python

43
How to implement GUID With Python [email protected]

Upload: dae-myung-kang

Post on 05-Dec-2014

162 views

Category:

Documents


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Guid python

How to implement GUID With Python

[email protected]

Page 2: Guid python

GUID?

Page 3: Guid python

Unique ID

Page 4: Guid python

When you need Unique ID?

Page 5: Guid python

User ID?

Page 6: Guid python

User ID? Service ID?

Page 7: Guid python

User ID? Service ID?

Event ID?

Page 8: Guid python

Example

Page 9: Guid python

A Long Long Time Ago

Page 10: Guid python

Mac Address?

Page 11: Guid python

Device ID?

Page 12: Guid python

So, we need Unique ID!!!

Page 13: Guid python

UUID

Page 14: Guid python

Universally Unique ID

Page 15: Guid python

Universally Unique ID

RFC 4122

Page 16: Guid python

550e8400-e20b-41d4-a716-446655440000

Page 17: Guid python

16 Octet (128bit)

Page 18: Guid python

SHA-1(MAC+Time)

Page 19: Guid python

BUT …

Page 20: Guid python

BUT … BUT …

Page 21: Guid python

BUT … BUT … BUT …

Page 22: Guid python

UUID is not good For Some Services

Page 23: Guid python

Why?

Page 24: Guid python

Too Big

Page 25: Guid python

Can’t order by Time

Page 26: Guid python

How to get these attributes!!

Page 27: Guid python

Research Just Google it.

Page 28: Guid python

MongoDB

Page 29: Guid python

Instagram

Page 30: Guid python

Twitter SnowFlake

Page 31: Guid python

MongoDB

12 Bytes BSON Object

Page 32: Guid python

MongoDB

Page 33: Guid python

Instagram

64 bits

Page 34: Guid python

Instagram

Page 35: Guid python

Instagram

Logical Shard Physical Shard

Page 36: Guid python

Slowflake

64 bits

Page 37: Guid python

Snowflake

Page 38: Guid python

Snowflake

Zookeeper

Page 39: Guid python

Python-Guoid

import guoid guid = guoid.SnowFlake(datacenter_id, worker_id) guid.next()

Page 40: Guid python

Python-Guoid

https://github.com/charsyam/python-guoid

Page 41: Guid python

Python-Guoid

Not service Just Library

Page 42: Guid python

Python-Guoid

How to get Datacenter_id

Worker_id

Page 43: Guid python

Thank you!