Blame source/uds/indexCheckpoint.h

Packit b55c50
/*
Packit b55c50
 * Copyright (c) 2020 Red Hat, Inc.
Packit b55c50
 *
Packit b55c50
 * This program is free software; you can redistribute it and/or
Packit b55c50
 * modify it under the terms of the GNU General Public License
Packit b55c50
 * as published by the Free Software Foundation; either version 2
Packit b55c50
 * of the License, or (at your option) any later version.
Packit b55c50
 * 
Packit b55c50
 * This program is distributed in the hope that it will be useful,
Packit b55c50
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit b55c50
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit b55c50
 * GNU General Public License for more details.
Packit b55c50
 * 
Packit b55c50
 * You should have received a copy of the GNU General Public License
Packit b55c50
 * along with this program; if not, write to the Free Software
Packit b55c50
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit b55c50
 * 02110-1301, USA. 
Packit b55c50
 *
Packit b55c50
 * $Id: //eng/uds-releases/jasper/src/uds/indexCheckpoint.h#1 $
Packit b55c50
 */
Packit b55c50
Packit b55c50
#ifndef INDEX_CHECKPOINT_H
Packit b55c50
#define INDEX_CHECKPOINT_H
Packit b55c50
Packit b55c50
#include "index.h"
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Construct and initialize the checkpoint sub-structure of an index.
Packit b55c50
 *
Packit b55c50
 * @param index  the index receive the new checkpoint structure.
Packit b55c50
 *
Packit b55c50
 * @return UDS_SUCCESS or an error code
Packit b55c50
 **/
Packit b55c50
int makeIndexCheckpoint(Index *index) __attribute__((warn_unused_result));
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Free the checkpoint sub-structure of an index.
Packit b55c50
 *
Packit b55c50
 * @param checkpoint  the structure to free
Packit b55c50
 **/
Packit b55c50
void freeIndexCheckpoint(IndexCheckpoint *checkpoint);
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Get the current checkpointing frequency of an index.
Packit b55c50
 *
Packit b55c50
 * @param checkpoint  the checkpoint state of the index
Packit b55c50
 *
Packit b55c50
 * @return the number of chapters between checkpoints
Packit b55c50
 **/
Packit b55c50
unsigned int getIndexCheckpointFrequency(IndexCheckpoint *checkpoint)
Packit b55c50
  __attribute__((warn_unused_result));
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Set checkpointing frequency for the index.
Packit b55c50
 *
Packit b55c50
 * @param checkpoint  the checkpoint state of the index
Packit b55c50
 * @param frequency   The new checkpointing frequency
Packit b55c50
 *
Packit b55c50
 * @return the old checkpointing frequency
Packit b55c50
 **/
Packit b55c50
unsigned int setIndexCheckpointFrequency(IndexCheckpoint *checkpoint,
Packit b55c50
                                         unsigned int     frequency);
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Gets the number of checkpoints completed during the lifetime of this index
Packit b55c50
 *
Packit b55c50
 * @param checkpoint  the checkpoint state of the index
Packit b55c50
 *
Packit b55c50
 * @return            the number of checkpoints completed
Packit b55c50
 **/
Packit b55c50
uint64_t getCheckpointCount(IndexCheckpoint *checkpoint)
Packit b55c50
  __attribute__((warn_unused_result));
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * If incremental checkpointing is in progress, finish it.
Packit b55c50
 *
Packit b55c50
 * @param index     The index
Packit b55c50
 *
Packit b55c50
 * @return          UDS_SUCCESS or an error code
Packit b55c50
 *
Packit b55c50
 * @note        This function is called automatically during normal operation;
Packit b55c50
 *              its presence here is for tests that expect checkpointing to
Packit b55c50
 *              have completed at some point in their logic.  It is not an
Packit b55c50
 *              error to call this function if checkpointing is not in
Packit b55c50
 *              progress, it silently returns success.
Packit b55c50
 **/
Packit b55c50
int finishCheckpointing(Index *index) __attribute__((warn_unused_result));
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Process one zone's incremental checkpoint operation. Automatically
Packit b55c50
 * starts, processes, and finishes a checkpoint over multiple invocations
Packit b55c50
 * as successive chapters are closed and written.
Packit b55c50
 *
Packit b55c50
 * Uses its own mutex to serialize the starting and finishing or aborting,
Packit b55c50
 * but allows parallel execution of the incremental progress.
Packit b55c50
 *
Packit b55c50
 * @param index             The index to checkpoint
Packit b55c50
 * @param zone              The current zone number
Packit b55c50
 * @param newVirtualChapter The number of the chapter which the calling
Packit b55c50
 *                          zone has just opened
Packit b55c50
 *
Packit b55c50
 * @return UDS_SUCCESS or an error code.
Packit b55c50
 **/
Packit b55c50
int processCheckpointing(Index        *index,
Packit b55c50
                         unsigned int  zone,
Packit b55c50
                         uint64_t      newVirtualChapter)
Packit b55c50
  __attribute__((warn_unused_result));
Packit b55c50
Packit b55c50
/**
Packit b55c50
 * Process saves done outside any zone by the chapter writer.
Packit b55c50
 *
Packit b55c50
 * Grabs the mutex associated with processCheckpointing().
Packit b55c50
 *
Packit b55c50
 * @param index         The index to process.
Packit b55c50
 *
Packit b55c50
 * @return UDS_SUCCESS or an error code.
Packit b55c50
 **/
Packit b55c50
int processChapterWriterCheckpointSaves(Index *index)
Packit b55c50
  __attribute__((warn_unused_result));
Packit b55c50
Packit b55c50
#endif // INDEX_CHECKPOINT_H