def Copy(self,
           old_urn,
           new_urn,
           age=NEWEST_TIME,
           limit=None,
           update_timestamps=False):
    """Make a copy of one AFF4 object to a different URN."""
    new_urn = rdfvalue.RDFURN(new_urn)

    if update_timestamps and age != NEWEST_TIME:
      raise ValueError(
          "Can't update timestamps unless reading the latest version.")

    values = {}
    for predicate, value, ts in data_store.DB.ResolvePrefix(
        old_urn,
        AFF4_PREFIXES,
        timestamp=self.ParseAgeSpecification(age),
        limit=limit):
      if update_timestamps:
        values.setdefault(predicate, []).append((value, None))
      else:
        values.setdefault(predicate, []).append((value, ts))

    if values:
      with data_store.DB.GetMutationPool() as pool:
        pool.MultiSet(new_urn, values, replace=False)
        self._UpdateChildIndex(new_urn, pool)
def Copy ( self , old_urn , new_urn , age = NEWEST_TIME , limit = None , update_timestamps = False ) : new_urn = rdfvalue . RDFURN ( new_urn ) if update_timestamps and age != NEWEST_TIME : raise ValueError ( "Can't update timestamps unless reading the latest version." ) values = { } for predicate , value , ts in data_store . DB . ResolvePrefix ( old_urn , AFF4_PREFIXES , timestamp = self . ParseAgeSpecification ( age ) , limit = limit ) : if update_timestamps : values . setdefault ( predicate , [ ] ) . append ( ( value , None ) ) else : values . setdefault ( predicate , [ ] ) . append ( ( value , ts ) ) if values : with data_store . DB . GetMutationPool ( ) as pool : pool . MultiSet ( new_urn , values , replace = False ) self . _UpdateChildIndex ( new_urn , pool )
Make a copy of one AFF4 object to a different URN.