//
// Copyright (c) 2020-2026, Manticore Software LTD (https://manticoresearch.com)
// All rights reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License. You should have
// received a copy of the GPL license along with this program; if you
// did not, you can find it at http://www.gnu.org/
//

#ifndef _secondarylib_
#define _secondarylib_

#include "secondary/builder.h"
#include "secondary/secondary.h"

#include <functional>

// FWD
struct CSphString;

bool			InitSecondary ( CSphString & sError );
void			ShutdownSecondary();
const char *	GetSecondaryVersionStr();
bool			IsSecondaryLibLoaded();

SI::Index_i *	CreateSecondaryIndex ( const char * szFile, bool bMmap, CSphString & sError );
bool			CheckSecondaryIndexStorage ( const CSphString & sFile, uint32_t uNumRows, SI::ErrorReporter_fn && fnError, SI::ProgressReporter_fn && fnProgress );
std::unique_ptr<SI::Builder_i> CreateSecondaryIndexBuilder ( const common::Schema_t & tSchema, int64_t iMemoryLimit, const CSphString & sFile, int iBufferSize, CSphString & sError );

enum class SIDefault_e
{
	DISABLED,
	ENABLED,
	FORCE
};

void				SetSecondaryIndexDefault ( SIDefault_e eState );
SIDefault_e			GetSecondaryIndexDefault();

void				SetSIBlockCacheSize ( uint64_t uSize );
uint64_t			GetSIBlockCacheSize();

#endif // _secondarylib_
