#NEWLINE# def _UpdateChildIndex( self , urn , token , mutation_pool = None ) : #NEWLINE# #INDENT# 'Update the child indexes.\n\n    This function maintains the index for direct child relations. When we set\n    an AFF4 path, we always add an attribute like\n    index:dir/%(childname)s to its parent. This is written\n    asynchronously to its parent.\n\n    In order to query for all direct children of an AFF4 object, we then simple\n    get the attributes which match the regex index:dir/.+ which are the\n    direct children.\n\n    Args:\n      urn: The AFF4 object for which we update the index.\n      token: The token to use.\n      mutation_pool: An optional MutationPool object to write to. If not given,\n                     the data_store is used directly.\n    ' #NEWLINE# try : #NEWLINE# #INDENT# while ( urn . Path ( ) != '/' ) : #NEWLINE# #INDENT# basename = urn . Basename ( ) #NEWLINE# dirname = rdfvalue . RDFURN ( urn . Dirname ( ) ) #NEWLINE# try : #NEWLINE# #INDENT# self . intermediate_cache . Get ( urn ) #NEWLINE# return #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# attributes = { #NEWLINE# #INDENT# ( 'index:dir/%s' % utils . SmartStr ( basename ) ) : [ EMPTY_DATA ] , #NEWLINE# #UNINDENT# } #NEWLINE# if ( dirname != '/' ) : #NEWLINE# #INDENT# attributes [ AFF4Object . SchemaCls . LAST ] = [ rdfvalue . RDFDatetime ( ) . Now ( ) . SerializeToDataStore ( ) ] #NEWLINE# #UNINDENT# if mutation_pool : #NEWLINE# #INDENT# mutation_pool . MultiSet ( dirname , attributes , replace = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# data_store . DB . MultiSet ( dirname , attributes , token = token , replace = True , sync = False ) #NEWLINE# #UNINDENT# self . intermediate_cache . Put ( urn , 1 ) #NEWLINE# urn = dirname #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except access_control . UnauthorizedAccess : #NEWLINE# #INDENT# pass