Deprecated.
NAME
Yars::Tools - various utility functions dealing with servers, hosts, etc
VERSION
version 1.33
DESCRIPTION
This module is largely used internally by Yars. Documentation for some of its capabilities are provided here for the understanding of how the rest of the Yars server works, but they should not be considered to be a public interface and they may change in the future, though probably not for a good reason.
FUNCTIONS
new
Create a new instance of Yars::Tools
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_up_verified
This is the same as disk_is_up, but doesn't trust the operating system, and tries to write a file to the disk's temp directory and verify that the file is not of zero size.
disk_is_down
Disk is not up.
disk_is_local
Return true if 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 directory, traverse upwards until encountering a local disk root or a non-empty directory, and remove all empty directories.
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 if the content is the same for both.
hex2b64, b642hex
Convert from hex to base 64.
SEE ALSO
AUTHOR
Original author: Marty Brandon
Current maintainer: Graham Ollis <plicease@cpan.org>
Contributors:
Brian Duggan
Curt Tilmes
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.