NAME
Yars::Tools - various utility functions dealing with servers, hosts, etc
VERSION
version 0.83_10
DESCRIPTION
Just some useful functions here.
FUNCTIONS
refresh_config
Refresh the configuration data cached in memory.
disk_for
Given an md5 digest, calculate the root directory of this file. Undef is returned if this file does not belong on the current host.
local_buckets
Get a hash from disk to list of buckets for this server.
disk_is_up
Given a disk root, return true unless the disk is marked down. A disk is down if the state file indicates it, or if it exists but is unwriteable.
disk_is_down
Disk is not up.
disk_is_local
Return true iff the disk is on this server.
server_is_up, server_is_down
Check to see if a remote server is up or down.
mark_disk_down, mark_disk_up
Mark a disk as up or down.
server_for
Given an md5, return the url for the server for this file.
bucket_map
Return a map from bucket prefix to server url.
storage_path
Calculate the directory of an md5 on disk. Optionally pass a second parameter to force it onto a particular disk.
remote_stashed_server
Find a server which is stashing this file, if one exists. Parameters : $c - controller $filename - filename $digest - digest
local_stashed_dir
Find a local directory stashing this file, if one exists. Parameters : $filename - filename $digest - digest Returns : The directory or false.
server_exists
Does this server exist?
server_url
Returns the url of the current server.
disk_roots
Return all the local directory roots, in a random order.
server_urls
Return all the other urls, in a random order.
cleanup_tree
Given a direcory, traverse upwards until encountering a local disk root or a non-empty directory, and remove all empty dirs.
count_files
Count the number of files in a directory tree.
human_size
Given a size, format it like df -kh
content_is_same
Given a filename and an Asset, return true iff the content is the same for both.
hex2b64, b642hex
Convert from hex to base 64.
SEE ALSO
AUTHOR
Graham Ollis <plicease@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by NASA GSFC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.