alfs messaging

Bryan Dumm bdumm at bobby.bcpub.com
Tue Feb 13 15:26:47 PST 2001


Howdy,

I have been looking @ messaging and all the possible combos like

console alfs_app
qt frontend/alfs daemon backend
web frontend/alfs daemon backend

Well I also have been looking @ things like how our handlers work,
user interaction, etc.

Well in web transactions, you don't normally go passing info
back and forth like how we are doing it from the console now.

Considering that, and other wierdisms like this that might occur
in an alfs_app, I have considered the following...

1. Each handler reports either success or it's error
2. Alfs.pm loads up "successes" and sends them all back in one xml message
3. Alfs.pm will stop immediately if the $msg is type "error" and will send  
    the error message, profile to the alfs_app that then does whatever 
    with it.

So like mkdir.xml would become something like

<register_tag tagname="mkdir">
{
	my ($self, $elt) = @_;

	return if $elt->att('preload') eq 'yes';

	my $dir = $elt->att('dir') || "/";
	my $permissions = $elt->att('permissions') || "";
	my @dirs = split(/\s+/, $self->fix_text($elt->text));

	while (! chdir $dir) {
		my $msg = {
			msg => "Unable to change directory to $dir",
			reason => "$!",
			input => "retry continue quit"
			type => "error"
			elt => "$elt"
		};
		return
		if $self->send_msg($msg);
	}

	foreach (@dirs) {
		print "\tMaking: $_\n";

		next if (! $self->to_continue( $elt ));

		if (! mkdir $_, 0777) {
			my $msg = {
				msg => "Unable to make directory",
				reason => "$!",
				input => "retry continue quit"
				type => "error"
				elt => "$elt"
			};
			return 
			if $self->send_msg($msg);
		}

		next if ($permissions eq "");

		if (! chmod oct($permissions), $_) {
			my $msg = {
				msg => "Unable to set permissions",
				reason => "$!",
				input => "retry continue quit"
				type => "error"
				elt => "$elt"
			};
			return 
			if $self->send_msg($msg);
		}
	}

	};
	my $msg = {
		msg => "Making directories in $dir (perm: $permissions)"; 
		type => "ok"
		elt => "$elt"
	return
	if $self->send_msg($msg);

}
</register_tag>


I am still not sure if this is correct, but it would prevent handlers
or ALFS.pm from introducing situations like the port thing above.
Or other things...

thoughts?

Bryan





More information about the alfs-discuss mailing list