MediaWiki REL1_37
UIDGenerator.php
Go to the documentation of this file.
1<?php
24
33 public const QUICK_RAND = 0; // b/c
35 public const QUICK_VOLATILE = GlobalIdGenerator::QUICK_VOLATILE;
36
52 public static function newTimestampedUID88( $base = 10 ) {
53 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
54
55 return $gen->newTimestampedUID88( $base );
56 }
57
72 public static function newTimestampedUID128( $base = 10 ) {
73 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
74
75 return $gen->newTimestampedUID128( $base );
76 }
77
85 public static function newUUIDv1() {
86 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
87
88 return $gen->newUUIDv1();
89 }
90
98 public static function newRawUUIDv1() {
99 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
100
101 return $gen->newRawUUIDv1();
102 }
103
111 public static function getTimestampFromUUIDv1( string $uuid, int $format = TS_MW ) {
112 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
113
114 return $gen->getTimestampFromUUIDv1( $uuid, $format );
115 }
116
124 public static function newUUIDv4( $flags = 0 ) {
125 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
126
127 return $gen->newUUIDv4();
128 }
129
137 public static function newRawUUIDv4( $flags = 0 ) {
138 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
139
140 return $gen->newRawUUIDv4();
141 }
142
155 public static function newSequentialPerNodeID( $bucket, $bits = 48, $flags = 0 ) {
156 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
157
158 return $gen->newSequentialPerNodeID( $bucket, $bits, $flags );
159 }
160
172 public static function newSequentialPerNodeIDs( $bucket, $bits, $count, $flags = 0 ) {
173 $gen = MediaWikiServices::getInstance()->getGlobalIdGenerator();
174
175 return $gen->newSequentialPerNodeIDs( $bucket, $bits, $count, $flags );
176 }
177}
MediaWikiServices is the service locator for the application scope of MediaWiki.
Class for getting statistically unique IDs.
static newRawUUIDv1()
Return an RFC4122 compliant v1 UUID.
static newSequentialPerNodeID( $bucket, $bits=48, $flags=0)
Return an ID that is sequential only for this node and bucket.
static newSequentialPerNodeIDs( $bucket, $bits, $count, $flags=0)
Return IDs that are sequential only for this node and bucket.
static newRawUUIDv4( $flags=0)
Return an RFC4122 compliant v4 UUID.
static newUUIDv4( $flags=0)
Return an RFC4122 compliant v4 UUID.
static newUUIDv1()
Return an RFC4122 compliant v1 UUID.
static newTimestampedUID128( $base=10)
Get a statistically unique 128-bit unsigned integer ID string.
static getTimestampFromUUIDv1(string $uuid, int $format=TS_MW)
Get timestamp in a specified format from UUIDv1.
static newTimestampedUID88( $base=10)
Get a statistically unique 88-bit unsigned integer ID string.
Class for getting statistically unique IDs without a central coordinator.