Пример #1
0
struct ZSTLIterator *ZSTLMapEnum(struct ZSTLMap *pm)
{
    ZSTLIterator_t    *iterator;

    pthread_mutex_lock(&(pm->enum_mutex));

    do_lock(&(pm->mutex));

    iterator = get_iterator(pm);
    zstlmap_assert(iterator);

    #ifdef SANDISK_PRINTSTUFF
	fprintf(stderr, "ZSTLMapEnum: pm=%p, iterator=%p, ", pm, iterator);
    #endif

    iterator->enum_entry = pm->lru_head;

    #ifdef SANDISK_PRINTSTUFF
	fprintf(stderr, "pme=%p, enum_entry=%p\n", pm, iterator->enum_entry);
    #endif

    do_unlock(&(pm->mutex));

    return(iterator);
}
Пример #2
0
void list_traverse(const list_t* list, int direction, void (*func)(node_t*))
{
	node_t *node;
	list_iterator_t *it = get_iterator(list, direction);
	while ((node = iterator_next(it)) != NULL) {
		func(node);
	}
	free_iterator(it);	
}
Пример #3
0
/* Linked List Open */
void list_free(List* list)
{
	Iterator* it = get_iterator(list);
	while (1) {
		Iterator* old_it = it;
		if (it == NULL) break;
		free(it->element);
		it = it->next;
		free(old_it);
	}
}
Пример #4
0
void STLMetaClass::copy_over( Address target, GenericList* source ) const {
  int instanceSize = _element_meta_class->get_size_of_instance();
  int i = source->count;
  Address space = source->space;
  Iterator* iterator = get_iterator( target );
  while (i--) {
   iterator->add( (Byte*)space );
   space = ((Byte*)space) + instanceSize;
  }
  delete iterator;
  delete (char*)(source->space);
  //  delete source;
}
Пример #5
0
void tuple_connect::insert(
	const tuple_ptr in,
	const tuple_ptr out)
{
	in_to_out_t::iterator it = get_iterator(in, m_data);
	if ( it == m_data.end())
	{ //input tuple seen for the first time
		it = m_data.insert(in_to_out_t::value_type(in, outs_t()));
	}
	it->second.push_back(out);
	m_published.insert(published_t::value_type(out, false));

}
Пример #6
0
tuple_connect::outs_t tuple_connect::remove(
	const tuple_ptr in)
{
	in_to_out_t::iterator in_it = get_iterator(in, m_data);
	if (in_it == m_data.end())
		return outs_t();

	outs_t& outs = in_it->second;
	outs_t result;
	published_t::iterator pub_it;
	for (outs_t::iterator out_it = outs.begin(); out_it != outs.end(); ++out_it)
	{
		pub_it = get_iterator(*out_it, m_published);
		if (pub_it != m_published.end())
		{
			if (pub_it->second)
				result.push_back(*out_it);
			m_published.erase(pub_it);
		}
	}
	m_data.erase(in_it);
	return result;
}
Пример #7
0
BackupSystem::stream_dict_t BackupSystem::generate_streams(generate_archive_fp generator){
	known_guids_t known_guids;
	stream_dict_t stream_dict;
	for (stream_index_t i = 0; i < this->base_objects.size(); i++){
		auto fso = this->base_objects[i];
		std::vector<std::shared_ptr<BackupStream>> streams;
		for (auto &child : fso->get_iterator()){
			auto stream = (this->*generator)(*child, known_guids);
			if (!stream || !stream->has_data())
				continue;
			child->set_unique_ids(*this);
			stream->set_unique_id(child->get_stream_id());
			streams.push_back(stream);
			this->streams.push_back(stream);
		}
		stream_dict[i] = std::move(streams);
	}
	return stream_dict;
}
Пример #8
0
void BackupSystem::archive_process_files(stream_dict_t &stream_dict, std::set<version_number_t> &version_dependencies, ArchiveWriter &archive){
	std::vector<ArchiveWriter::FileQueueElement> file_queue;

	for (auto &kv : stream_dict){
		auto base_object = this->base_objects[kv.first];
		for (auto &stream : kv.second)
			for (auto &fso : stream->get_file_system_objects())
				fso->set_backup_stream(stream.get());

		for (auto &i : base_object->get_iterator())
			this->get_dependencies(version_dependencies, *i);

		for (auto &backup_stream : kv.second){
			auto fso = backup_stream->get_file_system_objects()[0];
			auto id = backup_stream->get_unique_id();
			file_queue.push_back({ fso, id });
		}
	}

	reorder_file_streams(file_queue);

	archive.add_files(file_queue);
}
Пример #9
0
/**
 * \brief Get an iterator on the placement of a given mark.
 * \param m The mark for which we want the iterator.
 */
bf::snapshot::placement_list::iterator
bf::snapshot::get_iterator( const mark* m )
{
  return get_iterator(m->get_label());
} // snapshot::get_iterator()
Пример #10
0
/**
 * \brief Remove a mark from the snapshot.
 * \param m The identifief of the mark to remove.
 * \pre has_mark(m) == true
 */
void bf::snapshot::remove_mark( mark* m )
{
  CLAW_PRECOND( has_mark(m) );

  m_placement.erase( get_iterator(m) );
} // snapshot::remove_mark()
Пример #11
0
/**
 * \brief Get the placement of a given mark.
 * \param m The mark for which we want the placement.
 * \pre There is such a mark \a m in the snapshot.
 */
bf::mark_placement& bf::snapshot::get_placement( const mark* m )
{
  CLAW_PRECOND( has_mark(m) );

  return *get_iterator(m);
} // snapshot::get_placement()
Пример #12
0
void tuple_connect::mark_as_published(const tuple_ptr out)
{
	published_t::iterator out_it = get_iterator(out, m_published);
	if (out_it != m_published.end())
		out_it->second = true;
}
Пример #13
0
	table& operator[] (unsigned resultID) throw (result_exception&)
		{return *get_iterator(resultID)->second.result_table;}
Пример #14
0
	/* La funzione executed() permette di verificare il termine dell'esecuzione di una query
	 */
	bool executed (unsigned long resultID) const throw (result_exception&)
		{return get_iterator(resultID)->second.completed;}