@@ -2274,7 +2274,7 @@ impl StackMachine {
2274
2274
buf. push ( element) ;
2275
2275
}
2276
2276
2277
- match self . get_current_item ( ) {
2277
+ match self . get_current_directory_item ( ) {
2278
2278
Some ( DirectoryStackItem :: DirectoryOutput (
2279
2279
DirectoryOutput :: DirectoryPartition ( d) ,
2280
2280
) ) => {
@@ -2300,7 +2300,7 @@ impl StackMachine {
2300
2300
// the specified key. Push 1 if it does and 0 if it doesn't.
2301
2301
DirectoryContains => {
2302
2302
let raw_prefix = self . pop_bytes ( ) . await ;
2303
- let b = match self . get_current_item ( ) {
2303
+ let b = match self . get_current_directory_item ( ) {
2304
2304
None => panic ! ( "not found" ) ,
2305
2305
Some ( DirectoryStackItem :: Subspace ( s) ) => s. is_start_of ( & raw_prefix. to_vec ( ) ) ,
2306
2306
Some ( DirectoryStackItem :: DirectoryOutput ( d) ) => match d {
@@ -2355,23 +2355,44 @@ impl StackMachine {
2355
2355
} ;
2356
2356
let key = Subspace :: from_bytes ( & * raw_prefix) . pack ( & self . directory_index ) ;
2357
2357
2358
- let value = match self . directory_stack . get ( self . directory_index ) {
2358
+ match self . directory_stack . get ( self . directory_index ) {
2359
2359
None => panic ! ( "nothing in the stack" ) ,
2360
2360
Some ( DirectoryStackItem :: Null ) => panic ! ( "Directory is NULL" ) ,
2361
2361
Some ( DirectoryStackItem :: Directory ( _) ) => {
2362
2362
panic ! ( "trying to get a subspace, got a Directory" )
2363
2363
}
2364
- Some ( DirectoryStackItem :: DirectoryOutput ( d) ) => d. bytes ( ) ,
2365
- Some ( DirectoryStackItem :: Subspace ( s) ) => s. bytes ( ) ,
2364
+ Some ( DirectoryStackItem :: DirectoryOutput (
2365
+ DirectoryOutput :: DirectorySubspace ( d) ,
2366
+ ) ) => {
2367
+ txn. set ( & key, d. bytes ( ) ) ;
2368
+ println ! (
2369
+ "logging subspace [{}] {:?}={:?}" ,
2370
+ self . directory_index,
2371
+ unpack:: <Vec <Element >>( & key) . unwrap( ) ,
2372
+ d. bytes( ) ,
2373
+ ) ;
2374
+ }
2375
+ Some ( DirectoryStackItem :: DirectoryOutput (
2376
+ DirectoryOutput :: DirectoryPartition ( _) ,
2377
+ ) ) => {
2378
+ self . push_directory_err (
2379
+ & instr. code ,
2380
+ number,
2381
+ DirectoryError :: Other ( String :: from (
2382
+ "cannot get key for the root of a directory partition" ,
2383
+ ) ) ,
2384
+ ) ;
2385
+ }
2386
+ Some ( DirectoryStackItem :: Subspace ( s) ) => {
2387
+ txn. set ( & key, s. bytes ( ) ) ;
2388
+ println ! (
2389
+ "logging subspace [{}] {:?}={:?}" ,
2390
+ self . directory_index,
2391
+ unpack:: <Vec <Element >>( & key) . unwrap( ) ,
2392
+ s. bytes( ) ,
2393
+ ) ;
2394
+ }
2366
2395
} ;
2367
-
2368
- txn. set ( & key, & value) ;
2369
- println ! (
2370
- "logging subspace [{}] {:?}={:?}" ,
2371
- self . directory_index,
2372
- unpack:: <Vec <Element >>( & key) . unwrap( ) ,
2373
- & value
2374
- ) ;
2375
2396
}
2376
2397
2377
2398
// Use the current directory for this operation.
@@ -2543,7 +2564,7 @@ impl StackMachine {
2543
2564
}
2544
2565
}
2545
2566
2546
- fn get_current_item ( & self ) -> Option < & DirectoryStackItem > {
2567
+ fn get_current_directory_item ( & mut self ) -> Option < & DirectoryStackItem > {
2547
2568
self . directory_stack . get ( self . directory_index )
2548
2569
}
2549
2570
0 commit comments