Constants

All constants are accessible through the callback.CBFSCache.Constants class.

Cache Operation

CACHE_OP_IDLE 0 The cache is idle.

CACHE_OP_CLEANUP 2 Cache cleanup is being performed.

CACHE_OP_COMPACT 3 The cache's storage file is being compacted.

CACHE_OP_READ 4 The cache is reading some file's data.

CACHE_OP_WRITE 5 The cache is writing some file's data.

Flush Action

FLUSH_DELAYED 0 Flush as usual, taking into account any specified delay.

The FlushAfterCloseDelay property specifies the delay. Passing this value to Close or CloseFileEx will cause the method to return immediately; flushing is performed in background.

FLUSH_NONE 1 Do not flush anything.

FLUSH_IMMEDIATE 2 Flush immediately.

Passing this value to Close or CloseFileEx will cause the method to return only after all flushing operations are complete.

Enumeration Mode

ENUM_MODE_ALL 0 Enumerate all files.

ENUM_MODE_CHANGED 1 Enumerate files with changed blocks.

ENUM_MODE_UNCHANGED 2 Enumerate files with no changed blocks.

ENUM_MODE_LOCAL 3 Enumerate local files.

Refer to the Local Files topic for more information.

ENUM_MODE_ORPHAN 4 Enumerate orphan files.

Refer to the Orphan Files topic for more information.

File Flushing Mode

FLUSH_MODE_SYNC 0 Flush file data synchronously, blocking until finished.

FLUSH_MODE_ASYNC 1 Flush file data in the background; do not wait until the flush operation completes.

FLUSH_MODE_TEST 2 Check to see if there's file data that needs to be flushed, but don't actually flush anything.

Flushing Result

FLUSH_RESULT_NOTHING 0 The file has no data that needs flushing.

FLUSH_RESULT_DIRTY 1 The file has data that needs flushing, but no flush operation is running yet.

FLUSH_RESULT_RUNNING 2 The file's data is in the process of being flushed.

FLUSH_RESULT_SUCCESS 3 The file's data has been flushed successfully.

Prefetch Constants

PREFETCH_NOTHING 0 Do not prefetch any file data.

PREFETCH_ALL -1 Prefetch all file data.

Progress Operations

CACHE_PO_CLEANUP 1 Cache cleanup

Purge Action

PURGE_DELAYED 0 Purge as usual, taking into account any specified delay.

The PurgeAfterCloseDelay property specifies the delay. Passing this value to Close or CloseFileEx will cause the method to return immediately; purging is performed in background.

PURGE_NONE 1 Do not purge anything.

PURGE_IMMEDIATE 2 Purge immediately.

Passing this value to Close or CloseFileEx will cause the method to return only after all purging operations are complete.

Cache Purge Policy

PURGE_POLICY_NONE 0 No automatic purging.

Use the Cleanup method to perform cache cleanup.

PURGE_POLICY_CLOSE 1 Purge files as they are closed (after a delay).

The PurgeAfterCloseDelay property specifies the delay interval.

PURGE_POLICY_CACHE_CLOSE 2 Purge files when the cache is closed.

PURGE_POLICY_TIME 3 Purge files when they haven't been accessed for a certain number of hours.

The PurgeAfterTime property specifies how many hours a file must remain unaccessed for it to be purged.

Cache Flush Policy

FLUSH_POLICY_NONE 0 No automatic flushing.

FLUSH_POLICY_SIZE 1 Flush a file when the amount of changed data exceeds a certain limit.

The FlushAfterSize property specifies the size limit.

FLUSH_POLICY_TIME 2 Flush a file when it hasn't been written to for a certain amount of time.

The FlushAfterTime property specifies the time limit.

FLUSH_POLICY_SIZE_OR_TIME 3 Flush a file when the amount of changed data exceeds a certain limit OR when it hasn't been written to for a certain amount of time.

The FlushAfterSize and FlushAfterTime properties specify the size and time limits, respectively.

FLUSH_POLICY_SIZE_AND_TIME 4 Flush a file when the amount of changed data exceeds a certain limit AND when it hasn't been written to for a certain amount of time.

The FlushAfterSize and FlushAfterTime properties specify the size and time limits, respectively.

ReadData/WriteData Event Flags

RWEVENT_IN_PROGRESS 0x00000001 A file's data is being transferred into or out of the cache.

RWEVENT_CANCELED 0x00000002 A data transfer has been cancelled for some reasons.

RWEVENT_WHOLE_FILE 0x00000004 The entire file is being transferred.

RWEVENT_CONTINUOUS_STARTED 0x00000010 A continuous transfer has started.

RWEVENT_CONTINUOUS_RESTARTED 0x00000020 A continuous transfer has restarted from the beginning.

RWEVENT_CONTINUOUS_FINISHED 0x00000040 A continuous transfer is finishing (i.e., the current block is the final one).

RWEVENT_RANDOM_STARTED 0x00000100 A random-access transfer has started.

RWEVENT_RANDOM_FINISHED 0x00000200 A random-access transfer is finishing (i.e., the current block is the final one).

RWEVENT_BEFORE_END 0x00001000 The current transfer will finish before the end of the file.

RWEVENT_TIL_END 0x00002000 The current transfer will last until the end of the file.

Reading and Writing Capability Flags

RWCAP_CONTINUOUS_FROM_ZERO 0x00000001 No random access allowed; read/write operations must start at the beginning of a file.

RWCAP_CONTINUOUS_FROM_END 0x00000002 Append only; write operations must start at the end of a file.

To overwrite a file, it must first be truncated, and then written to. (Truncation behavior is defined by the corresponding flags.)

RWCAP_BLOCK_MULTIPLE 0x00000004 Reading/writing is possible at positions that are multiple of the corresponding block size.

The read and write block sizes are specified by the ReadBlockSize and WriteBlockSize properties.

RWCAP_RANDOM 0x00000008 Reading/writing is possible at any position.

Note that other flags can still alter the positions at which reading/writing are possible.

RWCAP_POSITION_ONLY_WITHIN_FILE 0x00000010 File position must remain in the range: 0 <= FilePos < FileSize

RWCAP_POSITION_NOT_BEYOND_EOF_ON_WRITE 0x00000020 File position remain in the range: 0 <= FilePos <= FileSize

When writing, appending to the end of the file is supported, but writing at positions past the end of the file is not.

RWCAP_SIZE_WHOLE_FILE 0x00000100 Only whole-file reads/writes are possible; partial reads/writes are not supported.

Notes:

  • The ReadBlockSize and WriteBlockSize properties should still be set to reasonable values when using this flag.
  • Use one of the other RWCAP_SIZE_* flags instead of this one if the external storage supports reading subsets of the file.
RWCAP_SIZE_FIXED_BLOCK_WITH_TAIL 0x00000200 Reads/writes must be done in blocks of a fixed size, except for the last block, which may be of any size.

RWCAP_SIZE_FIXED_BLOCK_NO_TAIL 0x00000400 Reads/writes must be done in blocks of a fixed size, including the last block.

Note: Real file sizes, if needed, must be stored elsewhere when using the cache with an external storage medium that has this characteristic.

RWCAP_SIZE_ANY 0x00000800 Reads/writes may be done in blocks of any size.

RWCAP_WRITE_TRUNCATES_FILE 0x00001000 When writes occur, the last data written becomes the new end of the file. Any overwritten data, and any data previously present after the written range, is lost.

RWCAP_WRITE_KEEPS_FILESIZE 0x00002000 Normal writing behavior; i.e., writes do not alter a file's size (except possibly to expand it).

RWCAP_NO_WRITE_BEYOND_EOF 0x00004000 Writes may not extend past the end of a file's current size (i.e., cannot cause a file to grow).

Applications may still adjust the file size beforehand.

Resizing Capability Flags

RSZCAP_GROW_TO_ANY 0x00000001 Files can grow to any size.

RSZCAP_SHRINK_TO_ANY 0x00000002 Files can shrink to any size.

RSZCAP_GROW_TO_BLOCK_MULTIPLE 0x00000004 Files can grow to sizes that are a multiple of the block size.

RSZCAP_SHRINK_TO_BLOCK_MULTIPLE 0x00000008 Files can shrink to sizes that are a multiple of the block size.

RSZCAP_TRUNCATE_ON_OPEN 0x00000010 The external storage (or application itself) supports truncating a file when it is opened for writing.

RSZCAP_TRUNCATE_AT_ZERO 0x00000020 The external storage (or application itself) supports truncating a file to zero at any time (not just when it's being opened).

ReadData/WriteData Event Result Codes

RWRESULT_SUCCESS 0x00000000 Success.

Return if all data was successfully transferred.

RWRESULT_PARTIAL 0x00000080 Partial success.

Return if some, but not all, data was successfully transferred. I.e., when BytesRead < BytesToRead (for ReadData), or BytesWritten < BytesToWrite (for WriteData).

RWRESULT_RANGE_BEYOND_EOF 0x00000081 Requested range is beyond the end of the file (EOF).

For the ReadData event, returning this code indicates to the cache that there is no need to request data beyond (Position + BytesRead), and that the tail should be zeroed instead.

RWRESULT_FILE_MODIFIED_EXTERNALLY 0x00000082 The specified file's size was modified externally.

RWRESULT_FILE_MODIFIED_LOCALLY 0x00000083 The requested file's size was modified locally.

RWRESULT_FAILURE 0x0000008D The operation failed for some transient reason.

Returning this code indicates that, while the current request failed, it is safe to continue sending requests for both the specified file and others. (Other operations may continue.)

RWRESULT_FILE_FAILURE 0x0000008E The operation failed for some external-file-related reason.

Returning this code indicates that some failure related to the external file itself has occurred, and it is expected that any further requests made against that file will also fail. The component will not send any more requests for the specified file until the file-specific error is reset as described in Reporting Transport Errors.

RWRESULT_PERMANENT_FAILURE 0x0000008F The operation failed for some external-storage-related reason.

Returning this code indicates that some failure related to the external storage itself has occurred, and it is expected that all further requests will also fail. The component will not send any more requests for any file until the global error is reset as described in Reporting Transport Errors.

 
 
Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Cache 2020 .NET Edition - Version 20.0 [Build 7850]