All Downloads are FREE. Search and download functionalities are using the official Maven repository.

step.core.collections.Collection Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
/*******************************************************************************
 * Copyright (C) 2020, exense GmbH
 *  
 * This file is part of STEP
 *  
 * STEP is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *  
 * STEP is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *  
 * You should have received a copy of the GNU Affero General Public License
 * along with STEP.  If not, see .
 ******************************************************************************/
package step.core.collections;

import java.util.List;
import java.util.Map;
import java.util.stream.Stream;

public interface Collection {

	/**
	 * Counts the number of entities matching the provided filter
	 * 
	 * @param filter
	 * @param limit the maximum number of documents to count. Nullable.
	 * @return the number of entities matching the provided filter
	 */
	long count(Filter filter, Integer limit);
	
	/**
	 * Provide an estimation of the total number of entities of the collection
	 * 
	 * @return
	 */
	long estimatedCount();
	
	/**
	 * @param filter
	 * @param order
	 * @param skip
	 * @param limit
	 * @param maxTime
	 * @return
	 */
	Stream find(Filter filter, SearchOrder order, Integer skip, Integer limit, int maxTime);

	Stream findReduced(Filter filter, SearchOrder order, Integer skip, Integer limit, int maxTime, List reduceFields);
	
	/**
	 * @param columnName the name of the column (field)
	 * @param filter: the query filter
	 * @return the distinct values of the column 
	 */
	List distinct(String columnName, Filter filter);

	void remove(Filter filter);
	
	T save(T entity);
	
	void save(Iterable entities);

	void createOrUpdateIndex(String field);

	void createOrUpdateIndex(String field, int order);

	void createOrUpdateCompoundIndex(String... fields);

	void createOrUpdateCompoundIndex(Map fields);
	
	void rename(String newName);
	
	void drop();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy