summaryrefslogtreecommitdiff
path: root/hurd/translator/nsmux.mdwn
blob: d156772b4c348ce4cd733b3c557d5fc8877cc8e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
[[!meta copyright="Copyright © 2009 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled
[[GNU Free Documentation License|/fdl]]."]]"""]]

# nsmux

`nsmux` implements the simplest use-case of namespace-based translator
selection (see below).

To use `nsmux` do the following:

    $ settrans -a <node> nsmux <directory>

After this operation `<node>` will be a mirror of `<directory>` with
namespace-based translator selection functionality enabled.

Please note that due to some details `nsmux` may complain a lot when
run as a normal user.  This matter is the most urgent on the TODO
list.

## Source

`nsmux` translator can be obtained with the following series of
commands:

	$ git clone git://git.sv.gnu.org/hurd/incubator.git nsmux
	$ cd nsmux/
	$ git checkout -b nsmux origin/nsmux

`filter` translator can be obtained with the following series of
commands:

	$ git clone git://git.sv.gnu.org/hurd/incubator.git filter
	$ cd filter/
	$ git checkout -b filter origin/filter

The filter is not yet working.

## Namespace-based Translator Selection

Namespace-based translator selection is the special technique of using
"magic" filenames for both accessing the file and setting translators
on it.

A "magic" filename is a filename which contains an unescaped sequence
of two commas: ",,".  This sequence can be escaped by adding another
comma: ",,,".  In the magic filename the part up to the first double
commas is interpreted as the filename itself; the remaining segments
into which the string is split by occurrences of ",," are treated as
names of translators located under `/hurd/`.

The simplest advantage before traditional way of setting
translators is shown in the following examples.  Compare this

    $ settrans -a file translator1
    $ settrans -a file translator2
    $ cat file

to this:
    
    $ cat file,,translator1,,translator2
   
One simple command versus three more lengthy ones is an obvious
improvement.  However, this advantage is not the only one and,
probably, not even the most important.

What is a good candidate for the most important advantage is that
translators requested via "magic" filenames are session-bound.  In
other words, by running `cat file,,translator` we set a translator
visible *only* to `cat`, while the original file remains untranslated.
Such session-specific translators are called **dynamic** and there is
no (theoretical) way for a client to get a port to a dynamic
translator requested by another client.

Obviously, dynamic translators can be stacked, similarly to static
translators.  Also, dynamic translator stacks may reside on top of
static translator stacks.

An important operation of namespace-based translator selection is
*filtering*.  Filtering basically consists in looking up a translator
by name in the stack and ignoring translators located on top of it.
Note that filtering does not mean dropping some translators: in the
current implementation a filter is expected to be a normal dynamic
translator, included in the dynamic translator stack similarly to
other translators.

An important detail is that filtering is not limited to dynamic
translator stacks: a filter should be able to descend into static
translator stacks as well.

Although the concept of filtering may seem purely abstract in the
simplest use-case of setting dynamic translators on top of files, the
situation changes greatly when dynamic translator stacks on top of
directories are considered.  In this case, the implementation of
namespace-based translator selection is expected to be able to
propagate the dynamic translators associated with the directory down
the directory structure.  That is, all files located under a directory
opened with magic syntax, are expected to be translated by the same
set of translators.  In this case having the possibility to
specifically discard some of the translators set up on top of certain
files is very useful.

Note that the implementation of propagation of dynamic translators
down directories is not fully conceived at the moment.  The
fundamental problem is distinguishing between situations when the
dynamic translators are to be set on the underlying files of the
directory or on the directory itself.

## Currently Implemented

Currently there a working (though not heavily tested) implementation
of the simplest use-case of namespace-based translator selection in
the form of translator `nsmux`.  The filter is partially implemented
and this is the immediate goal.  Propagating translators down
directories is the next objective.