public long cloud_info ( H2O cloud ) { long x = _cache ; // See if cached for this Cloud. This should be the 99% fast case. if ( cloud ( x ) == cloud . _idx ) return x ; // Cache missed! Probaby it just needs (atomic) updating. // But we might be holding the stale cloud... // Figure out home Node in this Cloud char home = ( char ) D ( 0 ) ; // Figure out what replica # I am, if any int desired = desired ( x ) ; int replica = - 1 ; for ( int i = 0 ; i < desired ; i ++ ) { int idx = D ( i ) ; if ( idx >= 0 && cloud . _memary [ idx ] == H2O . SELF ) { replica = i ; break ; } } long cache = build_cache ( cloud . _idx , home , replica , desired ) ; set_cache ( cache ) ; // Attempt to upgrade cache, but ignore failure return cache ; // Return the magic word for this Cloud }
Return the info word for this Cloud . Use the cache if possible