Blame source/uds/indexCheckpoint.h

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/indexCheckpoint.h#1 $
Packit Service 310c69
 */
Packit Service 310c69
Packit Service 310c69
#ifndef INDEX_CHECKPOINT_H
Packit Service 310c69
#define INDEX_CHECKPOINT_H
Packit Service 310c69
Packit Service 310c69
#include "index.h"
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Construct and initialize the checkpoint sub-structure of an index.
Packit Service 310c69
 *
Packit Service 310c69
 * @param index  the index receive the new checkpoint structure.
Packit Service 310c69
 *
Packit Service 310c69
 * @return UDS_SUCCESS or an error code
Packit Service 310c69
 **/
Packit Service 310c69
int makeIndexCheckpoint(Index *index) __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Free the checkpoint sub-structure of an index.
Packit Service 310c69
 *
Packit Service 310c69
 * @param checkpoint  the structure to free
Packit Service 310c69
 **/
Packit Service 310c69
void freeIndexCheckpoint(IndexCheckpoint *checkpoint);
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Get the current checkpointing frequency of an index.
Packit Service 310c69
 *
Packit Service 310c69
 * @param checkpoint  the checkpoint state of the index
Packit Service 310c69
 *
Packit Service 310c69
 * @return the number of chapters between checkpoints
Packit Service 310c69
 **/
Packit Service 310c69
unsigned int getIndexCheckpointFrequency(IndexCheckpoint *checkpoint)
Packit Service 310c69
  __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Set checkpointing frequency for the index.
Packit Service 310c69
 *
Packit Service 310c69
 * @param checkpoint  the checkpoint state of the index
Packit Service 310c69
 * @param frequency   The new checkpointing frequency
Packit Service 310c69
 *
Packit Service 310c69
 * @return the old checkpointing frequency
Packit Service 310c69
 **/
Packit Service 310c69
unsigned int setIndexCheckpointFrequency(IndexCheckpoint *checkpoint,
Packit Service 310c69
                                         unsigned int     frequency);
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Gets the number of checkpoints completed during the lifetime of this index
Packit Service 310c69
 *
Packit Service 310c69
 * @param checkpoint  the checkpoint state of the index
Packit Service 310c69
 *
Packit Service 310c69
 * @return            the number of checkpoints completed
Packit Service 310c69
 **/
Packit Service 310c69
uint64_t getCheckpointCount(IndexCheckpoint *checkpoint)
Packit Service 310c69
  __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * If incremental checkpointing is in progress, finish it.
Packit Service 310c69
 *
Packit Service 310c69
 * @param index     The index
Packit Service 310c69
 *
Packit Service 310c69
 * @return          UDS_SUCCESS or an error code
Packit Service 310c69
 *
Packit Service 310c69
 * @note        This function is called automatically during normal operation;
Packit Service 310c69
 *              its presence here is for tests that expect checkpointing to
Packit Service 310c69
 *              have completed at some point in their logic.  It is not an
Packit Service 310c69
 *              error to call this function if checkpointing is not in
Packit Service 310c69
 *              progress, it silently returns success.
Packit Service 310c69
 **/
Packit Service 310c69
int finishCheckpointing(Index *index) __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Process one zone's incremental checkpoint operation. Automatically
Packit Service 310c69
 * starts, processes, and finishes a checkpoint over multiple invocations
Packit Service 310c69
 * as successive chapters are closed and written.
Packit Service 310c69
 *
Packit Service 310c69
 * Uses its own mutex to serialize the starting and finishing or aborting,
Packit Service 310c69
 * but allows parallel execution of the incremental progress.
Packit Service 310c69
 *
Packit Service 310c69
 * @param index             The index to checkpoint
Packit Service 310c69
 * @param zone              The current zone number
Packit Service 310c69
 * @param newVirtualChapter The number of the chapter which the calling
Packit Service 310c69
 *                          zone has just opened
Packit Service 310c69
 *
Packit Service 310c69
 * @return UDS_SUCCESS or an error code.
Packit Service 310c69
 **/
Packit Service 310c69
int processCheckpointing(Index        *index,
Packit Service 310c69
                         unsigned int  zone,
Packit Service 310c69
                         uint64_t      newVirtualChapter)
Packit Service 310c69
  __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
/**
Packit Service 310c69
 * Process saves done outside any zone by the chapter writer.
Packit Service 310c69
 *
Packit Service 310c69
 * Grabs the mutex associated with processCheckpointing().
Packit Service 310c69
 *
Packit Service 310c69
 * @param index         The index to process.
Packit Service 310c69
 *
Packit Service 310c69
 * @return UDS_SUCCESS or an error code.
Packit Service 310c69
 **/
Packit Service 310c69
int processChapterWriterCheckpointSaves(Index *index)
Packit Service 310c69
  __attribute__((warn_unused_result));
Packit Service 310c69
Packit Service 310c69
#endif // INDEX_CHECKPOINT_H