aboutsummaryrefslogtreecommitdiffstats
path: root/utils/merkletrie/internal/fsnoder/doc.go
diff options
context:
space:
mode:
authorAlberto Cortés <alcortesm@gmail.com>2017-01-30 21:34:33 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-01-30 21:34:33 +0100
commite80d7b7267ba9f2057f259be331c4de927a60ecb (patch)
tree7d7d6917576596d76c4be78ca099e039552ae4e0 /utils/merkletrie/internal/fsnoder/doc.go
parent90c1bbd07862c6e1c3ce80306d69eee8ed277056 (diff)
downloadgo-git-e80d7b7267ba9f2057f259be331c4de927a60ecb.tar.gz
delete old noder, create a new one in utils (#241)
Diffstat (limited to 'utils/merkletrie/internal/fsnoder/doc.go')
-rw-r--r--utils/merkletrie/internal/fsnoder/doc.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/utils/merkletrie/internal/fsnoder/doc.go b/utils/merkletrie/internal/fsnoder/doc.go
new file mode 100644
index 0000000..86cae7c
--- /dev/null
+++ b/utils/merkletrie/internal/fsnoder/doc.go
@@ -0,0 +1,50 @@
+/*
+Package fsnoder allows to create merkletrie noders that resemble file
+systems, from human readable string descriptions. Its intended use is
+generating noders in tests in a readable way.
+
+For example:
+
+ root, _ = New("(a<1> b<2>, B(c<3> d()))")
+
+will create a noder as follows:
+
+ root - "root" is an unnamed dir containing "a", "b" and "B".
+ / | \ - "a" is a file containing the string "1".
+ / | \ - "b" is a file containing the string "2".
+ a b B - "B" is a directory containing "c" and "d".
+ / \ - "c" is a file containing the string "3".
+ c d - "D" is an empty directory.
+
+Files are expressed as:
+
+- a single letter for the name of the file.
+
+- a single number, between angle brackets, for the contents of the file.
+
+Directories are expressed as:
+
+- a single letter for the name of the directory.
+
+- its elements between parents, separated with spaces, in any order.
+
+- (optionally) the root directory can be unnamed, by skiping its name.
+
+Examples:
+
+- D(a<1> b<2>) : two files, "a" and "b", having "1" and "2" as their
+respective contents, inside a directory called "D".
+
+- A() : An empty directory called "A".
+
+- A(b<>) : An directory called "A", with an empty file inside called "b":
+
+- (b(c<1> d(e<2>)) f<>) : an unamed directory containing:
+
+ ├── b --> directory
+ │   ├── c --> file containing "1"
+ │   └── d --> directory
+ │   └── e --> file containing "2"
+ └── f --> empty file
+*/
+package fsnoder