CBFS Connect 2020 Python Edition

Questions / Feedback?

enable_route_cache Method

Enable the automatic routing of requests to local files.

Syntax

def enable_route_cache(location: str, flags: int) -> None: ...

Remarks

This method enables the automatic routing of requests to files that exist in the directory specified by Location. The Flags parameter is used to specify which kinds of requests should not be routed automatically (see below).

When automatic request routing is enabled, and a file in the virtual drive is opened, the class will immediately check the cache directory to see if a file with the same path and name exists. If such a file is found, all operations will be performed on it directly and the corresponding events will not fire (except for the operations excluded from routing by the specified Flags).

When attempting to find a matching file, the class assumes that the contents of the specified cache directory mirror that of the virtual drive. That is, the cache directory corresponds to the root of the virtual drive, and the files and directory structure are the same in each. If the class fails to find a matching file (or if the operation in question is excluded from routing), then the applicable events fire as usual.

The Flags value should be created by OR'ing together zero or more of the following flags:

CBFS_ROUTE_FILE_READ_ONLY0x00000001Causes files to be treated as read-only; all write operations will be automatically denied.

CBFS_ROUTE_OPEN_EVENT0x00000020Prevents 'open' requests from being routed automatically.

If set, the on_open_file event will fire as usual when such requests arrive.

Note: This flag is implied if any of the other CBFS_ROUTE_*_EVENT flags are present.

CBFS_ROUTE_CLEANUP_EVENT0x00000040Prevents 'cleanup' requests from being routed automatically.

If set, the on_cleanup_file event will fire as usual when such requests arrive.

CBFS_ROUTE_CLOSE_EVENT0x00000080Prevents 'close' requests from being routed automatically.

If set, the on_close_file event will fire as usual when such requests arrive.

Note: This flag is implied if any of the other CBFS_ROUTE_*_EVENT flags are present.

CBFS_ROUTE_ENUMERATE_DIRECTORY_EVENT0x00000200Prevents 'enumerate directory' requests from being routed automatically.

If set, the on_enumerate_directory event will fire as usual when such requests arrive.

CBFS_ROUTE_SET_SECURITY_EVENT0x00000400Prevents 'set security' requests from being routed automatically.

If set, the on_set_file_security event will fire as usual when such requests arrive.

CBFS_ROUTE_GET_SECURITY_EVENT0x00000800Prevents 'get security' requests from being routed automatically.

If set, the on_get_file_security event will fire as usual when such requests arrive.

CBFS_ROUTE_SET_FILE_ATTRIBUTES_EVENT0x00002000Prevents 'set file attributes' requests from being routed automatically.

If set, the on_set_file_attributes event will fire as usual when such requests arrive.

CBFS_ROUTE_SET_FILE_SIZES_EVENT0x00004000Prevents 'set file size' requests from being routed automatically.

If set, the on_set_file_size event will fire as usual when such requests arrive.

CBFS_ROUTE_SET_VALID_DATA_LENGTH_EVENT0x00008000Prevents 'set valid data length' requests from being routed automatically.

If set, the on_open_file event will fire as usual when such requests arrive.

CBFS_ROUTE_CREATE_HARD_LINK_EVENT0x00020000Prevents 'create hard link' requests from being routed automatically.

If set, the on_create_hard_link event will fire as usual when such requests arrive.

CBFS_ROUTE_QUERY_QUOTA_EVENT0x00040000Prevents 'query quota' requests from being routed automatically.

If set, the on_query_quotas event will fire as usual when such requests arrive.

CBFS_ROUTE_SET_QUOTA_EVENT0x00080000Prevents 'set quota' requests from being routed automatically.

If set, the on_set_quotas event will fire as usual when such requests arrive.

CBFS_ROUTE_CAN_FILE_BE_DELETED_EVENT0x00200000Prevents 'can file be deleted' requests from being routed automatically.

If set, the on_can_file_be_deleted event will fire as usual when such requests arrive.

CBFS_ROUTE_IS_DIRECTORY_EMPTY_EVENT0x00400000Prevents 'is directory empty' requests from being routed automatically.

If set, the on_is_directory_empty event will fire as usual when such requests arrive.

CBFS_ROUTE_RENAME_EVENT0x00800000Prevents 'rename/move' requests from being routed automatically.

If set, the on_rename_or_move_file event will fire as usual when such requests arrive.

Note: This method cannot be called within events.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Connect 2020 Python Edition - Version 20.0 [Build 8348]