|
Packit Service |
310c69 |
/*
|
|
Packit Service |
310c69 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
310c69 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
310c69 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
310c69 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
310c69 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
310c69 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
310c69 |
* GNU General Public License for more details.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
310c69 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
310c69 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
310c69 |
* 02110-1301, USA.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* $Id: //eng/uds-releases/jasper/src/uds/config.h#2 $
|
|
Packit Service |
310c69 |
*/
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#ifndef CONFIG_H
|
|
Packit Service |
310c69 |
#define CONFIG_H
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#include "bufferedReader.h"
|
|
Packit Service |
310c69 |
#include "bufferedWriter.h"
|
|
Packit Service |
310c69 |
#include "geometry.h"
|
|
Packit Service |
310c69 |
#include "uds.h"
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
enum {
|
|
Packit Service |
310c69 |
DEFAULT_MASTER_INDEX_MEAN_DELTA = 4096,
|
|
Packit Service |
310c69 |
DEFAULT_CACHE_CHAPTERS = 7,
|
|
Packit Service |
310c69 |
DEFAULT_SPARSE_SAMPLE_RATE = 0
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Data that are used for configuring a new index.
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
struct udsConfiguration {
|
|
Packit Service |
310c69 |
/** Smaller (16), Small (64) or large (256) indices */
|
|
Packit Service |
310c69 |
unsigned int recordPagesPerChapter;
|
|
Packit Service |
310c69 |
/** Total number of chapters per volume */
|
|
Packit Service |
310c69 |
unsigned int chaptersPerVolume;
|
|
Packit Service |
310c69 |
/** Number of sparse chapters per volume */
|
|
Packit Service |
310c69 |
unsigned int sparseChaptersPerVolume;
|
|
Packit Service |
310c69 |
/** Size of the page cache, in chapters */
|
|
Packit Service |
310c69 |
unsigned int cacheChapters;
|
|
Packit Service |
310c69 |
/** Frequency with which to checkpoint */
|
|
Packit Service |
310c69 |
// XXX the checkpointFrequency is not used - it is now a runtime parameter
|
|
Packit Service |
310c69 |
unsigned int checkpointFrequency;
|
|
Packit Service |
310c69 |
/** The master index mean delta to use */
|
|
Packit Service |
310c69 |
unsigned int masterIndexMeanDelta;
|
|
Packit Service |
310c69 |
/** Size of a page, used for both record pages and index pages */
|
|
Packit Service |
310c69 |
unsigned int bytesPerPage;
|
|
Packit Service |
310c69 |
/** Sampling rate for sparse indexing */
|
|
Packit Service |
310c69 |
unsigned int sparseSampleRate;
|
|
Packit Service |
310c69 |
/** Index Owner's nonce */
|
|
Packit Service |
310c69 |
UdsNonce nonce;
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Data that are used for a 6.01 index.
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
struct udsConfiguration6_01 {
|
|
Packit Service |
310c69 |
/** Smaller (16), Small (64) or large (256) indices */
|
|
Packit Service |
310c69 |
unsigned int recordPagesPerChapter;
|
|
Packit Service |
310c69 |
/** Total number of chapters per volume */
|
|
Packit Service |
310c69 |
unsigned int chaptersPerVolume;
|
|
Packit Service |
310c69 |
/** Number of sparse chapters per volume */
|
|
Packit Service |
310c69 |
unsigned int sparseChaptersPerVolume;
|
|
Packit Service |
310c69 |
/** Size of the page cache, in chapters */
|
|
Packit Service |
310c69 |
unsigned int cacheChapters;
|
|
Packit Service |
310c69 |
/** Frequency with which to checkpoint */
|
|
Packit Service |
310c69 |
unsigned int checkpointFrequency;
|
|
Packit Service |
310c69 |
/** The master index mean delta to use */
|
|
Packit Service |
310c69 |
unsigned int masterIndexMeanDelta;
|
|
Packit Service |
310c69 |
/** Size of a page, used for both record pages and index pages */
|
|
Packit Service |
310c69 |
unsigned int bytesPerPage;
|
|
Packit Service |
310c69 |
/** Sampling rate for sparse indexing */
|
|
Packit Service |
310c69 |
unsigned int sparseSampleRate;
|
|
Packit Service |
310c69 |
};
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
typedef struct indexLocation {
|
|
Packit Service |
310c69 |
char *host;
|
|
Packit Service |
310c69 |
char *port;
|
|
Packit Service |
310c69 |
char *directory;
|
|
Packit Service |
310c69 |
} IndexLocation;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* A set of configuration parameters for the indexer.
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
typedef struct configuration Configuration;
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Construct a new indexer configuration.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param conf UdsConfiguration to use
|
|
Packit Service |
310c69 |
* @param configPtr The new index configuration
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return UDS_SUCCESS or an error code
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
int makeConfiguration(UdsConfiguration conf,
|
|
Packit Service |
310c69 |
Configuration **configPtr)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Clean up the configuration struct.
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void freeConfiguration(Configuration *config);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Read the index configuration from stable storage.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param reader A buffered reader.
|
|
Packit Service |
310c69 |
* @param config The index configuration to overwrite.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return UDS_SUCCESS or an error code.
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
int readConfigContents(BufferedReader *reader,
|
|
Packit Service |
310c69 |
UdsConfiguration config)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Write the index configuration information to stable storage.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param writer A buffered writer.
|
|
Packit Service |
310c69 |
* @param config The index configuration.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return UDS_SUCCESS or an error code.
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
int writeConfigContents(BufferedWriter *writer,
|
|
Packit Service |
310c69 |
UdsConfiguration config)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Free the memory used by an IndexLocation.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param loc index location to free
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void freeIndexLocation(IndexLocation *loc);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Compare two configurations for equality.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param a The first configuration to compare
|
|
Packit Service |
310c69 |
* @param b The second configuration to compare
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @return true iff they are equal
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
bool areUdsConfigurationsEqual(UdsConfiguration a, UdsConfiguration b)
|
|
Packit Service |
310c69 |
__attribute__((warn_unused_result));
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
/**
|
|
Packit Service |
310c69 |
* Log a user configuration.
|
|
Packit Service |
310c69 |
*
|
|
Packit Service |
310c69 |
* @param conf The configuration
|
|
Packit Service |
310c69 |
**/
|
|
Packit Service |
310c69 |
void logUdsConfiguration(UdsConfiguration conf);
|
|
Packit Service |
310c69 |
|
|
Packit Service |
310c69 |
#endif /* CONFIG_H */
|