def _GetEntityLocation(self, key): """Get keys to self.__entities_by_group from the given key. Copied from datastore_file_stub. Args: key: entity_pb.Reference Returns: Tuple (by_entity_group key, entity key) """ entity_group = datastore_stub_util._GetEntityGroup(key) eg_k = datastore_types.ReferenceToKeyValue(entity_group) k = datastore_types.ReferenceToKeyValue(key) return (eg_k, k)
def _GetEntityLocation(self, key): """Get keys to self.__entities_by_* from the given key. Example usage: app_kind, eg_k, k = self._GetEntityLocation(key) self.__entities_by_kind[app_kind][k] self.__entities_by_entity_group[eg_k][k] Args: key: entity_pb.Reference Returns: Tuple (by_kind key, by_entity_group key, entity key) """ app_ns = datastore_types.EncodeAppIdNamespace(key.app(), key.name_space()) kind = _FinalElement(key).type() entity_group = datastore_stub_util._GetEntityGroup(key) eg_k = datastore_types.ReferenceToKeyValue(entity_group) k = datastore_types.ReferenceToKeyValue(key) return ((app_ns, kind), eg_k, k)
def _GetEntityLocation(self, key): """Get keys to self.__entities_by_* from the given key. Example usage: app_kind, eg_k, k = self._GetEntityLocation(key) self.__entities_by_kind[app_kind][k] self.__entities_by_entity_group[eg_k][k] Args: key: entity_pb.Reference Returns: Tuple (by_kind key, by_entity_group key, entity key) """ app_ns = datastore_types.EncodeAppIdNamespace(key.app(), key.name_space()) kind = key.path().element_list()[-1].type() entity_group = datastore_stub_util._GetEntityGroup(key) eg_k = datastore_types.ReferenceToKeyValue(entity_group) k = datastore_types.ReferenceToKeyValue(key) return ((app_ns, kind), eg_k, k)