globus_gass_cache(3)
π globus_gass_cache(3) β Globus GASS Cache π
okay bestie, gather round π«Ά this is the Library Functions Manual page for globus_gass_cache. It's long, so it's coming at you in multiple parts β this is part 1, so don't go anywhere. β¨
πΈ NAME πΈ
globus_gass_cache β Globus GASS Cache.
- Globus GASS Cache.
β¨ SYNOPSIS β¨
π Macros π
#define GLOBUS_GASS_CACHE_MODULE (&globus_i_gass_cache_module)
module_descriptor
π¦ Typedefs π¦
typedef struct globus_i_gass_cache_t * globus_gass_cache_t
GASS Cache Handle.
π Functions π
int globus_gass_cache_open (const char *cache_directory_path,
globus_gass_cache_t *cache_handlep)
Open a GASS Cache.
int globus_gass_cache_close (globus_gass_cache_t *cache_handlep)
Close a cache handle.
int globus_gass_cache_add (globus_gass_cache_t cache_handle, const char
*url, const char *tag, globus_bool_t create, unsigned long
*timestamp, char **local_filename)
Add a tag to an URL in the cache.
int globus_gass_cache_add_done (globus_gass_cache_t cache_handle, const
char *url, const char *tag, unsigned long timestamp)
Complete adding a cache entry and unlock it.
int globus_gass_cache_query (globus_gass_cache_t cache_handle, const
char *url, const char *tag, globus_bool_t wait_for_lock, unsigned
long *timestamp, char **local_filename, globus_bool_t *is_locked)
Query the GASS Cache.
int globus_gass_cache_delete_start (globus_gass_cache_t cache_handle,
const char *url, const char *tag, unsigned long *timestamp)
Remove a cache tag.
int globus_gass_cache_delete (globus_gass_cache_t cache_handle, const
char *url, const char *tag, unsigned long timestamp, globus_bool_t
is_locked)
Remove one instance of the tag from the cache entry's tag list.
int globus_gass_cache_cleanup_tag (globus_gass_cache_t cache_handle,
const char *url, const char *tag)
Remove a tag from a cache entry.
int globus_gass_cache_cleanup_tag_all (globus_gass_cache_t cache_handle,
char *tag)
Remove a tag from all cache entries
and like, here's the vibe of that last one, no cap:
Remove all instances of the tag from the cache entry's tag list. If there are no more tags in the tag list, then remove this cache entry and delete the associated local cache file. If the cache entry is locked with the same tag as is passed to this function, then the entry is unlocked after removing the tags. Otherwise, the cache entry's lock is left untouched. "
int globus_gass_cache_mangle_url (const globus_gass_cache_t cache_handle,
const char *url, char **mangled_url, int *length)
Convert a URL to a string suitable as a file path.
int globus_gass_cache_mangle_tag (const globus_gass_cache_t cache_handle,
const char *tag, char **mangled_tag, int *length)
Convert a tag to a string suitable as a file path.
int globus_gass_cache_get_cache_dir (const globus_gass_cache_t cache_handle,
char **cache_dir)
Get the GASS Cache's root directory.
int globus_gass_cache_get_dirs (const globus_gass_cache_t cache_handle,
const char *url, const char *tag, char **global_root, char **local_root,
char **tmp_root, char **log_root, char **global_dir, char **local_dir)
Get the set of directories used by a GASS Cache.
int globus_gass_cache_get_cache_type_string (const globus_gass_cache_t
cache_handle, char **cache_type)
Get the type of GASS Cache directory layout.
const char * globus_gass_cache_error_string (int error_code)
Look up the error string corresponding to a GASS Cache error.
π§ Detailed Description π§
Globus GASS Cache. π
The GASS cache management API is part of the Globus module called "GASS", (Global Access to Secondary Storage). The GASS cache management API defines calls for manipulating a local file cache. periodt.
Every cache entry can be locked during addition and deletion, which is how you get atomic handling of the cache file contents. π
Each cache entry also has an associated timestamp. And no, bestie, this timestamp is independent of the local cache file's modification time. Instead, the cache entry timestamp is maintained by the user. It can, for example, be used to keep track of the timestamp of a remote file that is associated with the cache entry. π°οΈ
Note: all timestamps are as seconds since the epoch. (01 Jan 1970, 00:00 GMT) β³
The following functions are part of the API:
globus_gass_cache_open()globus_gass_cache_close()globus_gass_cache_add()globus_gass_cache_add_done()globus_gass_cache_delete_start()globus_gass_cache_delete()globus_gass_cache_cleanup_tag()globus_gass_cache_cleanup_tag_all()globus_gass_cache_mangle_url()globus_gass_cache_mangle_tag()globus_gass_cache_get_dirs()globus_gass_cache_get_cache_dir()
π Typedef Documentation π
π typedef struct globus_i_gass_cache_t* globus_gass_cache_t π
GASS Cache Handle. This is the data structure used to store information concerning an open cache directory. This structure MUST NOT be modified directly, but passed to the globus_gass_cache functions. π like, hands off, fr fr.
π Function Documentation π
β int globus_gass_cache_add (...) [extern] β
int globus_gass_cache_add (globus_gass_cache_t cache_handle, const char *
url, const char * tag, globus_bool_t create, unsigned long * timestamp,
char ** local_filename)
Add a tag to an URL in the cache. Create a new cache file or add a tag on it. β¨
- If the URL is already in the cache but is locked, then this call will block until the cache entry is unlocked, and then will proceed with the subsequent operations. π΄
- If the URL is already in the cache and unlocked, then it adds the tag to the cache entry's tag list, returns the local cache filename in
*local_filename, returns the entry's current timestamp in*timestamp, locks the cache entry, and returnsGLOBUS_GASS_CACHE_ADD_EXISTS. π - If the URL is not in the cache, and
create==GLOBUS_TRUE, then it creates a new unique empty local cache file, adds it to the cache with the specified tag, returns the filename in*local_filename, returns*timestampset toGLOBUS_GASS_CACHE_TIMESTAMP_UNKNOWN, locks the cache entry, and returnsGLOBUS_GASS_CACHE_ADD_NEW. π - If the URL is not in the cache, and
create==GLOBUS_FALSE, then it does not add it to the cache, and returnsGLOBUS_GASS_CACHE_URL_NOT_FOUND. π - If this function returns
GLOBUS_GASS_CACHE_ADD_EXISTSorGLOBUS_GASS_CACHE_ADD_NEW, thenglobus_gass_cache_add_done()orglobus_gass_cache_delete()must be subsequently called to unlock the cache entry. don't leave it hanging, bestie. - Subsequent calls to
globus_gass_cache_add()andglobus_gass_cache_delete_start()on the same cache and url, made either from this process or another, will block until the cache entry is unlocked. π§ - If
tag==NULL, then a tag with the value"null"will be added to the cache entry's tag list. - The same tag can be used multiple times, in which case this tag will be added to the entry's tag list multiple times. π
Note: It is recommended that proglobus_grams started viaGLOBUS_GRAMpass a tag value ofgetenv("GLOBUS_GRAM_JOB_CONTACT"), since upon completion of a jobGLOBUS_GRAMwill automatically cleanup entries with this tag. π§Ή
Note: thelocal_filenameMUST be free by the user in a subsequent operation, usingfree(). yes queen, you gotta clean up after yourself.
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ URL of the file to be cached. It is used as the main key to the cache entries.tagβ Tag specifying which job is/are using the cache. This is usually theGLOBUS_GRAM_JOB_CONTACT. Can beNULLor empty; the tag"null"is then used.create- Tells if the cache entry should be created if it is not already existing.createβ Flag to create if it does not already exist.timestampβ Timestamp of the cached file, set byglobus_gass_cache_done(), (orglobus_gass_cache_delete()).local_filenameβ Path the the local file caching the file specified by "url".NULLif "url" not yet cached and creation not requested (create false).
Returns
GLOBUS_GASS_CACHE_URL_NOT_FOUNDGLOBUS_GASS_CACHE_ADD_NEWGLOBUS_GASS_CACHE_ADD_EXISTS- or any of the defined gass error code.
π¦ int globus_gass_cache_add_done (...) [extern] π¦
int globus_gass_cache_add_done (globus_gass_cache_t cache_handle, const char
* url, const char * tag, unsigned long timestamp)
Complete adding a cache entry and unlock it. π
globus_gass_cache_add_done() MUST be called after globus_gass_cache_add(), to set the timestamp in the cache entry for the URL, and then unlock the cache entry. (The only case it does not need to be called is if globus_gass_cache_add() has returned GLOBUS_GASS_CACHE_URL_NOT_FOUND, of course.) π
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ URL of the cached file to set as"done"(unlock)tagβ Tag specifying which job has locked the cache and must therefore be unlocked. It is an error to call this function with a tag which does not currently own the cache lock. π«timestampβ Timestamp of the cached file.
Returns
globus_gass_cache_add_done() returns GLOBUS_SUCCESS or any of the defined GASS Cache error codes.
πΈ int globus_gass_cache_cleanup_tag (...) [extern] πΈ
int globus_gass_cache_cleanup_tag (globus_gass_cache_t cache_handle, const
char * url, const char * tag)
Remove a tag from a cache entry. Remove all instances of the tag from the cache entry's tag list. If there are no more tags in the tag list, then remove this cache entry and delete the associated local cache file. If the cache entry is locked with the same tag as is passed to this function, then the entry is unlocked after removing the tags. Otherwise, the cache entry's lock is left untouched. π§Ό
This function does not block on a locked reference. πβοΈ
Note: TheGLOBUS_GRAMjob manager will automatically call this function with a tag ofgetenv("GLOBUS_GRAM_JOB_CONTACT")upon completion of a job. β¨
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ URL of the file to be cached. It is used as the main key to the cache entries.tagβ Tag specifying which job is/are using the cache. This is usually theGLOBUS_GRAM_JOB_CONTACT. Can beNULLor empty; the tag"null"is then used.
Returns
The globus_gass_cache_cleanup_tag() function returns GLOBUS_SUCCESS or any of the defined GASS Cache error codes.
π int globus_gass_cache_cleanup_tag_all (...) [extern] π
int globus_gass_cache_cleanup_tag_all (globus_gass_cache_t cache_handle,
char * tag)
Remove a tag from all cache entries π
Remove all instances of the tag from the cache entry's tag list. If there are no more tags in the tag list, then remove this cache entry and delete the associated local cache file. If the cache entry is locked with the same tag as is passed to this function, then the entry is unlocked after removing the tags. Otherwise, the cache entry's lock is left untouched. This function does not block on a locked reference. This function differs from globus_gass_cache_cleanup_tag() in that this cleans up all URLs related with this tag. π
Note β¨ the GLOBUS_GRAM job manager will automatically call this function with a tag of getenv("GLOBUS_GRAM_JOB_CONTACT") upon completion of a job. bestie it literally does it for you, no cap π
Parameters π
cache_handleβ handle to the opened cache directory to use.tagβ tag specifying which job is/are using the cache. This is usually theGLOBUS_GRAM_JOB_CONTACT. Can beNULLor empty; the tag"null"is then used.
Returns πΈ
The globus_gass_cache_cleanup_tag_all() function returns GLOBUS_SUCCESS or any of the defined GASS Cache error codes.
π int globus_gass_cache_close (globus_gass_cache_t * cache_handlep)
Close a cache handle. Close (NOT delete, ok?? very different vibes) a previously opened cache:
- close the opened files and
- free the memory allocated for the
cache_handle. - mark the handle as
"not initialized".
Parameters: cache_handle: Handle to the opened cache directory to use.
cache_handle->is_init set to "not initialized" and all the files opened bu globus_gass_cache_open are closed .
Returns: GLOBUS_SUCCESS or error code: GLOBUS_GASS_CACHE_ERROR_CACHE_NOT_OPENED
π¦ int globus_gass_cache_delete (globus_gass_cache_t cache_handle, const char * url, const char * tag, unsigned long timestamp, globus_bool_t is_locked) [extern]
Remove one instance of the tag from the cache entry's tag list. If there are no more tags in the tag list, then remove this cache entry and delete the associated local cache file. gone. deleted. not coming back π
Otherwise, update the timestamp to the passed value.
This call will leave the cache entry unlocked.
If is_locked==GLOBUS_TRUE, then this cache entry was locked during a previous call to globus_gass_cache_add() or globus_gass_cache_delete_start(). The cache file should be locked by the corresponding url/tag, or an error is returned. If it is locked by the corresponding url/tag, then the normal operation occur, without blocking (remove one instance from the tag update the timestamp and unlock the cache).
If is_locked==GLOBUS_FALSE, eventually wait the cache is not locked any more, and then proceed with the normal operations.(remove one instance from the tag list and update the timestamp).
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ URL of the file to be cached. It is used as the main key to the cache entries.tagβ Tag specifying which job is/are using the cache. This is usually theGLOBUS_GRAM_JOB_CONTACT. Can beNULLor empty; the tag"null"is then used.timestampβ Timestamp of the cached file.is_lockedβ Indicate if this cache entry was locked during a previous call toglobus_gass_cache_add()orglobus_gass_cache_delete_start().
Returns
The globus_gass_cache_delete() function returns GLOBUS_SUCCESS or any of the defined GASS Cache error codes.
π int globus_gass_cache_delete_start (globus_gass_cache_t cache_handle, const char * url, const char * tag, unsigned long * timestamp) [extern]
Remove a cache tag. Lock the cache entry for the URL, and return the cache entry's current timestamp in *timestamp. This function will block if the data file is already locked, until it is unlocked. so yeah it just sits there. patiently. iconic behavior honestly π
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ URL of the cached file to set as"done"(unlock)tagβ Tag specifying which job has locked the cache and must therefore be unlocked. It is an error to call this function with a tag which does not currently own the cache lock. π¨timestampβ Timestamp of the cached file, set byglobus_gass_cache_done(), (orglobus_gass_cache_delete()).
Returns
The globus_gass_cache_delete_start() function returns GLOBUS_SUCCESS or any of the defined GASS Cache error code.
π const char * globus_gass_cache_error_string (int error_code) [extern]
Look up the error string corresponding to a GASS Cache error. Return a pointer on an error description string. it's giving "translator for your sadness" π
Parameters
error_codeβ error code returned by a previously calledglobus_gass_cachefunction.
Returns
The globus_gass_cache_error_string() function returns a pointer to an error message, or NULL if error_code is invalid.
π§ int globus_gass_cache_get_cache_dir (const globus_gass_cache_t cache_handle, char ** cache_dir) [extern]
Get the GASS Cache's root directory. Get a the root cache of directory. This is exported for use in the globus_gass_cache program.
Parameters
cache_handleβ Handle to the opened cache directory to use.cache_dirβ Pointer to the cache directory
Return values
GLOBUS_SUCCESSβ SuccessGLOBUS_GASS_CACHE_ERROR_NO_MEMORYβ No memory
π
int globus_gass_cache_get_cache_type_string (const globus_gass_cache_t cache_handle, char ** cache_type) [extern]
Get the type of GASS Cache directory layout. Get a string which describes the cache type ("normal" or "flat"). literally just those two, pick your fighter β
Parameters
cache_handleβ Handle to the opened cache directory to use.cache_typeβ Pointer to thestrdup()ed string
Return values
GLOBUS_SUCCESSβ SuccessGLOBUS_GASS_CACHE_ERROR_NO_MEMORYβ No memory
π int globus_gass_cache_get_dirs (const globus_gass_cache_t cache_handle, const char * url, const char * tag, char ** global_root, char ** local_root, char ** tmp_root, char ** log_root, char ** global_dir, char ** local_dir) [extern]
Get the set of directories used by a GASS Cache. Gets a bunch of directories. This is exported for use in the globus_gass_cache program. a whole haul of dirs, bestie π
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ The incoming URLtagβ The incoming taglocal_rootβ Pointer to the"local root"directoryglobal_rootβ Pointer to the"global root"directorytmp_rootβ Pointer to the"tmp root"directorylog_rootβ Pointer to the root log directorylocal_dirβ Pointer to the related"local"directoryglobal_dirβ Pointer to the related"global"directory
Return values
GLOBUS_SUCCESSβ SuccessGLOBUS_GASS_CACHE_ERROR_NO_MEMORYβ No memory
πΈ int globus_gass_cache_mangle_tag (const globus_gass_cache_t cache_handle, const char * tag, char ** mangled_tag, int * length) [extern]
Convert a tag to a string suitable as a file path. Mangles the given tag into a chunk suitable for using as a file / path name. This is exported for use in the globus_gass_cache program. yes "mangle", it's fine, it's a whole aesthetic π₯
Parameters
cache_handleβ Handle to the opened cache directory to use.tagβ The incoming tag to mangle (NULL-terminated)mangled_tagβ Pointer to the output string; a buffer for the real string ismalloc()ed for the application. IfmangledisNULL, then no such buffer is allocated, and no mangled string is created. This can be useful to just get the length of the mangled string.lengthβ A pointer to the length of the resulting string. IfNULL, this is not assigned to.
Return values
GLOBUS_SUCCESSβ SuccessGLOBUS_GASS_CACHE_ERROR_NO_MEMORYβ No memory
π¦ int globus_gass_cache_mangle_url (const globus_gass_cache_t cache_handle, const char * url, char ** mangled_url, int * length) [extern]
Convert a URL to a string suitable as a file path. Mangles the given URL into a chunk suitable for using as a file / path name. This is exported for use in the globus_gass_cache program.
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ The incoming URL to mangle (NULL-terminated)mangled_urlβ Pointer to the output string; a buffer for the real string ismalloc()ed for the application. IfmangledisNULL, then no such buffer is allocated, and no mangled string is created. This can be useful to just get the length of the mangled string.lengthβ A pointer to the length of the resulting string. IfNULL, this is not assigned to.
Return values
GLOBUS_SUCCESSβ SuccessGLOBUS_GASS_CACHE_ERROR_NO_MEMORYβ No memory
π int globus_gass_cache_open (const char * cache_directory_path, globus_gass_cache_t * cache_handlep)
Open a GASS Cache. Open the cache specified by the cache_directory_path argument, and return a cache handle that can be used in subsequent cache calls. this is the glow-up moment, the main character entrance π
If cache_directory_path is NULL, then use the value contained in the GLOBUS_GASS_CACHE_DEFAULT environment variable if it is defined, otherwise use ~/.globus_gass_cache.
The cache_directory_path must be a directory. If it is a file, this call will fail with a non-0 return value.
If the specified directory does not exist, then this call will create the directory. manifesting it into existence fr fr β¨
Parameters
cache_directory_pathβ Path to the cache directory to open. Can beNULL(see above)cache_handlepβ Structure containning all the necessary information to access the cache (file names, descriptor,...) (seeglobus_gass_gache.h) Some files are also opened:globus_gass_cache_close()must be called subsequently to close those files. This parameter is modified by theglobus_gass_cache_open()
Return values
GLOBUS_SUCCESSβ SuccessGLOBUS_GASS_CACHE_ERROR_CACHE_ALREADY_OPENEDβ Handle already openedGLOBUS_GASS_CACHE_ERROR_NAME_TOO_LONGβ Path name too longGLOBUS_GASS_CACHE_ERROR_NO_HOMEβ Can't find home directory for default cache path
β int globus_gass_cache_query (globus_gass_cache_t cache_handle, const char * url, const char * tag, globus_bool_t wait_for_lock, unsigned long * timestamp, char ** local_filename, globus_bool_t * is_locked) [extern]
Query the GASS Cache. Query if an item is in the cache. is it there or is it not, we're checking π«Ά
This call will block only if wait_for_lock is GLOBUS_TRUE
Parameters
cache_handleβ Handle to the opened cache directory to use.urlβ URL of the file to query. It is used as the main key to the cache entries.tagβ Tag specifying which job is/are using the cache. This is usually theGLOBUS_GRAM_JOB_CONTACT. Can beNULLor empty; the tag"null"is then used.wait_for_lockβ IfGLOBUS_TRUE, wait for any lock existing lock to be released. IfGLOBUS_FALSE, doesn't wait for a lock to be released.timestampβ Timestamp of the cached file, set byglobus_gass_cache_done(), (orglobus_gass_cache_delete()).local_filenameβ Path the the local file caching the file specified by"url".NULLif"url"not yet cached and creation not requested (create false).is_lockedβGLOBUS_TRUEif the file is currently (at return time) locked.
Returns
The globus_gass_cache_query() function returns GLOBUS_SUCCESS, GLOBUS_GASS_CACHE_URL_NOT_FOUND, or any of the defined gass error code.
π Author π
Generated automatically by Doxygen for globus_gass_cache from the source code.
okay bestie that's the whole page π this one came from the globus_gass_cache source, Version 10.3, and it's the globus_gass_cache(3) man page β so if you ever forget any of it, just run man 3 globus_gass_cache and it'll be right there waiting for you like the loyal icon it is πβ¨ go forth and cache responsibly, mwah π
π¦ where this page comes from
- fedora 43: globus-gass-cache-doc 10.3-11.fc43 Β· Apache-2.0
- fedora 44: globus-gass-cache-doc 10.3-12.fc44 Β· Apache-2.0
- ubuntu resolute: libglobus-gass-cache-doc 10.3-3build1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms