@@ -165,11 +165,24 @@ impl<'a> CreateOptions<'a> {
165
165
///
166
166
/// It prints in ten decimal digits with possible leading padding 0.
167
167
#[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
168
- pub struct CreateSequence ( pub i32 ) ;
168
+ pub struct CreateSequence ( i64 ) ;
169
169
170
170
impl std:: fmt:: Display for CreateSequence {
171
171
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
172
- write ! ( f, "{:010}" , self . 0 )
172
+ // Discussion for 64-bit ephemeral sequence number:
173
+ // * https://lists.apache.org/thread/4o3rl49rdj5y0134df922zgc8clyt86s
174
+ // * https://issues.apache.org/jira/browse/ZOOKEEPER-4706
175
+ if self . 0 <= i32:: MAX . into ( ) {
176
+ write ! ( f, "{:010}" , self . 0 )
177
+ } else {
178
+ write ! ( f, "{:019}" , self . 0 )
179
+ }
180
+ }
181
+ }
182
+
183
+ impl CreateSequence {
184
+ pub fn into_i64 ( self ) -> i64 {
185
+ self . 0
173
186
}
174
187
}
175
188
@@ -338,7 +351,7 @@ impl Client {
338
351
339
352
fn parse_sequence ( client_path : & str , prefix : & str ) -> Result < CreateSequence > {
340
353
if let Some ( sequence_path) = client_path. strip_prefix ( prefix) {
341
- match sequence_path. parse :: < i32 > ( ) {
354
+ match sequence_path. parse :: < i64 > ( ) {
342
355
Err ( _) => Err ( Error :: UnexpectedError ( format ! ( "sequential node get no i32 path {}" , client_path) ) ) ,
343
356
Ok ( i) => Ok ( CreateSequence ( i) ) ,
344
357
}
0 commit comments