PORT: Files refer to qids. We unpack and determine panel and repl. Then we use that info, if they are not there, the panel must be gone. Also, we are not drawing, thus one RPC at a time seems reasonable. events not posted when channel is nil. NOTES: * We do NOT send partial updates from viewers to fs. Only when enough time passed, the viewer could just update the file in the fs, for safety. Also, before things that imply that the user wants the fs updated, it could update all the file. For example, before executing commands, etc. This removes all of ins, del, and data events. * There are no ctls other than attributes for panels. Oview rereads the ctl files and updates itself accordingly. * The appl/ subtree accepts moveto/copyto requests in ctls, but those are copyto attributes now. * Paths are relative to o/mero / * Events are sent by a write to the panel ctl file, not by the connection to the ofs. * all clts end with \n. No length sent. \n in data is escaped to \1. The convention can be that "exit" events are sent for panels removed externally. We send "done" events instead when the #repl goes down to zero. Thus, an application may know if a particular interface is no longer been viewed. And it could decide what to do, stay or die. Perhaps depending on a flag that removes the panels upon "done" events or not. TODO: * need an idiom for move and copy that can cross screens. drag-drop moves cut-paste: copyfrom cut: movefrom * hold mode: refrain from sending events to the replica. Instead, send just one update when the hold mode is released; and do not process events from held replicas. Perhaps, one process per application subtree? in charge of its panels? * dump/load: must be able to recover app list and screen layouts - add a new repl file with the replica list? or -> yet another file? but more simple. and we can cat repl > ctl to update! writes can be ignored. The ideal is to use one mkdir + one tar to restore each appl. This means that omero applications must keep their state in the UI, to reload them. NOT clear - report that from the ctl files (copyto attrs)? or -> apps may write copyto ctls again by mistake? - leave it up to the user to scan the trees and determine the replicas -> complex * check * leak * coverage? sprintattrs(r: ref Repl): string { a := r.attrs; s := ""; for (i := 0; i < len r.attrs; i++) if (a[i] != nil) s += a[i] + "\n"; if (r.rn == 0){ p:= r.p; for (i = 1; i < len p.repl; i++) if ((nr := p.repl[i]) != nil){ name := dirname(nr.path); s += "copyto " + name + "\n"; } } return s; } attrslength(r: ref Repl): int { d := array of byte sprintattrs(r); return len d; }