Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

CtreeFlushFileXtd

Flush cache for specific files and groups of files.

Short Name

CTFLUSHX()

Type

Low-Level function

Declaration

LONG CtreeFlushFileXtd(FILNO filno, NINT mode, LONG parm)

Description

In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering

CtreeFlushFileXtd() extends CtreeFlushFile() with mode and parm values to allow applications to flush cache for specific files and groups of files. Calling CtreeFlushFileXtd() with mode and parm set to zero is identical to calling CtreeFlushFile(filno).

The following mode options may be appropriately mixed and matched:

Mode

Description

ctFLUSHX_ASYNC

Launch flush and return immediately

ctFLUSHX_ISAM

Treat filno as an ISAM data file and flush data and associated indexes (only when filno != -1)

ctFLUSHX_TRAN

Only flush TRNLOG and PREIMG files (filno == -1)

ctFLUSHX_NONTRAN

Only flush non-transaction files (filno == -1)

ctFLUSHX_SYSALL

Flush all files opened by system (filno == -1)

ctFLUSHX_USRALL

Flush all files opened by calling user (filno == -1)

ctFLUSHX_BYTES

Limit flush to specified number of bytes (parm holds the limit on the number of bytes to flush)

ctFLUSHX_PERCENT

Limit flush to specified percent of bytes (parm holds a percentage between 1 and 100)

ctFLUSHX_LAST

This option only applies to asynchronous flushes that do not attempt to flush all system files (ctFLUSHX_SYSALL which is the default when filno is passed in as a -1). When used, the asynchronous flush will only flush the file if the caller is the last (i.e., only) client to have the file open. This permits the client to terminate without concern that a file close will take an inordinate amount of time due to the close flushing all the file’s buffers.

ctFLUSHX_NOSAVE

Suppress the file system flush to improve throughput. The c-tree buffer and cache pages will still be written to the file system, but the file system buffers will not be flushed to disk.

Not all combinations of these modes make sense. CtreeFlushFileXtd() eliminates conflicting modes before attempting the flush. For example, supplying a valid filno and then specifying ctFLUSHX_TRAN, ctFLUSHX_NONTRAN, ctFLUSHX_SYSALL, and/or ctFLUSHX_USRALL is inconsistent. In this case the filno is used and the conflicting mode option is ignored.

Return

CtreeFlushFileXtd() returns the handle, a positive LONG value, associated with a successfully launched asynchronous thread (if mode contains ctFLUSHX_ASYNC), NO_ERROR if CtreeFlushFileXtd() completes successfully (no thread launched), or a negative error code in the case of a problem.

Limitations

The only option available with stand-alone applications is ctFLUSHX_ISAM.

See also

CtreeFlushFile

TOCIndex