Skip to content

Commit 48e1052

Browse files
author
Brian Tiger Chow
committed
Merge pull request #269 from jbenet/tour-content-structure
feat(tour) content
2 parents 24f319b + 72414ce commit 48e1052

File tree

3 files changed

+284
-11
lines changed

3 files changed

+284
-11
lines changed

tour/all.go

+263-10
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,269 @@ func init() {
1111
sort.Sort(IDSlice(IDs))
1212
}
1313

14+
// TODO move content into individual files if desired
15+
16+
// TODO(brian): If sub-topics are needed, write recursively (as tree comprised
17+
// of Section nodes:
18+
//
19+
// type Section interface {
20+
// Sections() []Section
21+
// Topic() Topic
22+
// }
23+
24+
var (
25+
// TODO bootstrapping
26+
27+
// TODO pinning: ensuring a block is kept in local storage (i.e. not
28+
// evicted from cache).
29+
30+
Introduction = Chapter(0)
31+
FileBasics = Chapter(1)
32+
NodeBasics = Chapter(2)
33+
MerkleDag = Chapter(3)
34+
Network = Chapter(4)
35+
Daemon = Chapter(5)
36+
Routing = Chapter(6)
37+
Exchange = Chapter(7)
38+
Ipns = Chapter(8)
39+
Mounting = Chapter(9)
40+
Plumbing = Chapter(10)
41+
Formats = Chapter(11)
42+
)
43+
1444
// Topics contains a mapping of Tour Topic ID to Topic
1545
var allTopics = []Topic{
16-
Topic{
17-
ID: ID("0"),
18-
Title: "Hello Mars",
19-
Text: "Hello Mars",
20-
},
21-
Topic{
22-
ID: ID("0.1"),
23-
Title: "Hello Mars 2",
24-
Text: "Hello Mars 2",
25-
},
46+
Topic{ID: Introduction(0), Content: IntroHelloMars},
47+
Topic{ID: Introduction(1), Content: IntroTour},
48+
Topic{ID: Introduction(2), Content: IntroAboutIpfs},
49+
50+
Topic{ID: FileBasics(1), Content: FileBasicsFilesystem},
51+
Topic{ID: FileBasics(2), Content: FileBasicsGetting},
52+
Topic{ID: FileBasics(3), Content: FileBasicsAdding},
53+
Topic{ID: FileBasics(4), Content: FileBasicsDirectories},
54+
Topic{ID: FileBasics(5), Content: FileBasicsDistributed},
55+
Topic{ID: FileBasics(6), Content: FileBasicsMounting},
56+
57+
Topic{NodeBasics(0), NodeBasicsInit},
58+
Topic{NodeBasics(1), NodeBasicsHelp},
59+
Topic{NodeBasics(2), NodeBasicsUpdate},
60+
Topic{NodeBasics(3), NodeBasicsConfig},
61+
62+
Topic{MerkleDag(0), MerkleDagIntro},
63+
Topic{MerkleDag(1), MerkleDagContentAddressing},
64+
Topic{MerkleDag(2), MerkleDagContentAddressingLinks},
65+
Topic{MerkleDag(3), MerkleDagRedux},
66+
Topic{MerkleDag(4), MerkleDagIpfsObjects},
67+
Topic{MerkleDag(5), MerkleDagIpfsPaths},
68+
Topic{MerkleDag(6), MerkleDagImmutability},
69+
Topic{MerkleDag(7), MerkleDagUseCaseUnixFS},
70+
Topic{MerkleDag(8), MerkleDagUseCaseGitObjects},
71+
Topic{MerkleDag(9), MerkleDagUseCaseOperationalTransforms},
72+
73+
Topic{Network(0), Network_Intro},
74+
Topic{Network(1), Network_Ipfs_Peers},
75+
Topic{Network(2), Network_Daemon},
76+
Topic{Network(3), Network_Routing},
77+
Topic{Network(4), Network_Exchange},
78+
Topic{Network(5), Network_Intro},
79+
80+
// TODO daemon - {API, API Clients, Example} how old-school http + ftp
81+
// clients show it
82+
Topic{Daemon(0), Daemon_Intro},
83+
Topic{Daemon(1), Daemon_Running_Commands},
84+
Topic{Daemon(2), Daemon_Web_UI},
85+
86+
Topic{Routing(0), Routing_Intro},
87+
Topic{Routing(1), Rouing_Interface},
88+
Topic{Routing(2), Routing_Resolving},
89+
Topic{Routing(3), Routing_DHT},
90+
Topic{Routing(4), Routing_Other},
91+
92+
// TODO Exchange_Providing
93+
// TODO Exchange_Providers
94+
Topic{Exchange(0), Exchange_Intro},
95+
Topic{Exchange(1), Exchange_Getting_Blocks},
96+
Topic{Exchange(2), Exchange_Strategies},
97+
Topic{Exchange(3), Exchange_Bitswap},
98+
99+
Topic{Ipns(0), Ipns_Name_System},
100+
Topic{Ipns(1), Ipns_Mutability},
101+
Topic{Ipns(2), Ipns_PKI_Review},
102+
Topic{Ipns(3), Ipns_Publishing},
103+
Topic{Ipns(4), Ipns_Resolving},
104+
Topic{Ipns(5), Ipns_Consistency},
105+
Topic{Ipns(6), Ipns_Records_Etc},
106+
107+
Topic{Mounting(0), Mounting_General},
108+
Topic{Mounting(1), Mounting_Ipfs},
109+
Topic{Mounting(2), Mounting_Ipns},
110+
111+
Topic{Plumbing(0), Plumbing_Intro},
112+
Topic{Plumbing(1), Plumbing_Ipfs_Block},
113+
Topic{Plumbing(2), Plumbing_Ipfs_Object},
114+
Topic{Plumbing(3), Plumbing_Ipfs_Refs},
115+
Topic{Plumbing(4), Plumbing_Ipfs_Ping},
116+
Topic{Plumbing(5), Plumbing_Ipfs_Id},
117+
118+
Topic{Formats(0), Formats_MerkleDag},
119+
Topic{Formats(1), Formats_Multihash},
120+
Topic{Formats(2), Formats_Multiaddr},
121+
Topic{Formats(3), Formats_Multicodec},
122+
Topic{Formats(4), Formats_Multicodec},
123+
Topic{Formats(5), Formats_Multikey},
124+
Topic{Formats(6), Formats_Protocol_Specific},
125+
}
126+
127+
// Introduction
128+
129+
var IntroHelloMars = Content{
130+
Title: "Hello Mars",
131+
Text: `
132+
check things work
133+
`,
134+
}
135+
var IntroTour = Content{
136+
Title: "Hello Mars",
137+
Text: `
138+
how this works
139+
`,
140+
}
141+
var IntroAboutIpfs = Content{
142+
Title: "About IPFS",
143+
}
144+
145+
// File Basics
146+
147+
var FileBasicsFilesystem = Content{
148+
Title: "Filesystem",
149+
Text: `
150+
`,
26151
}
152+
var FileBasicsGetting = Content{
153+
Title: "Getting Files",
154+
Text: `ipfs cat
155+
`,
156+
}
157+
var FileBasicsAdding = Content{
158+
Title: "Adding Files",
159+
Text: `ipfs add
160+
`,
161+
}
162+
var FileBasicsDirectories = Content{
163+
Title: "Directories",
164+
Text: `ipfs ls
165+
`,
166+
}
167+
var FileBasicsDistributed = Content{
168+
Title: "Distributed",
169+
Text: `ipfs cat from mars
170+
`,
171+
}
172+
var FileBasicsMounting = Content{
173+
Title: "Getting Files",
174+
Text: `ipfs mount (simple)
175+
`,
176+
}
177+
178+
// Node Basics
179+
180+
var NodeBasicsInit = Content{
181+
Title: "Basics - init",
182+
183+
// TODO touch on PKI
184+
//
185+
// This is somewhat relevant at ipfs init since the generated key pair is the
186+
// basis for the node's identity in the network. A cursory nod may be
187+
// sufficient at that stage, and goes a long way in explaining init's raison
188+
// d'être.
189+
// NB: user is introduced to ipfs init before ipfs add.
190+
Text: `
191+
`,
192+
}
193+
var NodeBasicsHelp = Content{
194+
Title: "Basics - help",
195+
Text: `
196+
`,
197+
}
198+
var NodeBasicsUpdate = Content{
199+
Title: "Basics - update",
200+
Text: `
201+
`,
202+
}
203+
var NodeBasicsConfig = Content{
204+
Title: "Basics - config",
205+
Text: `
206+
`,
207+
}
208+
209+
// Merkle DAG
210+
var MerkleDagIntro = Content{}
211+
var MerkleDagContentAddressing = Content{}
212+
var MerkleDagContentAddressingLinks = Content{}
213+
var MerkleDagRedux = Content{}
214+
var MerkleDagIpfsObjects = Content{}
215+
var MerkleDagIpfsPaths = Content{}
216+
var MerkleDagImmutability = Content{
217+
Title: "Immutability",
218+
Text: `
219+
TODO plan9
220+
TODO git
221+
`,
222+
}
223+
224+
var MerkleDagUseCaseUnixFS = Content{}
225+
var MerkleDagUseCaseGitObjects = Content{}
226+
var MerkleDagUseCaseOperationalTransforms = Content{}
227+
228+
var Network_Intro = Content{}
229+
var Network_Ipfs_Peers = Content{}
230+
var Network_Daemon = Content{}
231+
var Network_Routing = Content{}
232+
var Network_Exchange = Content{}
233+
var Network_Naming = Content{}
234+
235+
var Daemon_Intro = Content{}
236+
var Daemon_Running_Commands = Content{}
237+
var Daemon_Web_UI = Content{}
238+
239+
var Routing_Intro = Content{}
240+
var Rouing_Interface = Content{}
241+
var Routing_Resolving = Content{}
242+
var Routing_DHT = Content{}
243+
var Routing_Other = Content{}
244+
245+
var Exchange_Intro = Content{}
246+
var Exchange_Bitswap = Content{}
247+
var Exchange_Strategies = Content{}
248+
var Exchange_Getting_Blocks = Content{}
249+
250+
var Ipns_Consistency = Content{}
251+
var Ipns_Mutability = Content{}
252+
var Ipns_Name_System = Content{}
253+
var Ipns_PKI_Review = Content{
254+
Title: "PKI Review",
255+
Text: `
256+
TODO sign verify
257+
`,
258+
}
259+
var Ipns_Publishing = Content{}
260+
var Ipns_Records_Etc = Content{}
261+
var Ipns_Resolving = Content{}
262+
263+
var Mounting_General = Content{} // TODO note fuse
264+
var Mounting_Ipfs = Content{} // TODO cd, ls, cat
265+
var Mounting_Ipns = Content{} // TODO editing
266+
267+
var Plumbing_Intro = Content{}
268+
var Plumbing_Ipfs_Block = Content{}
269+
var Plumbing_Ipfs_Object = Content{}
270+
var Plumbing_Ipfs_Refs = Content{}
271+
var Plumbing_Ipfs_Ping = Content{}
272+
var Plumbing_Ipfs_Id = Content{}
273+
274+
var Formats_MerkleDag = Content{}
275+
var Formats_Multihash = Content{}
276+
var Formats_Multiaddr = Content{}
277+
var Formats_Multicodec = Content{}
278+
var Formats_Multikey = Content{}
279+
var Formats_Protocol_Specific = Content{}

tour/chapter.go

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package tour
2+
3+
import "fmt"
4+
5+
// returns a partially applied function.
6+
//
7+
// It's designed to make it easy to re-order chapters with minimal fuss.
8+
//
9+
// eg.
10+
// Intro := Chapter(1)
11+
// ID("1.1") == Intro(1) == Chapter(1)(1)
12+
func Chapter(number int) func(topic int) ID {
13+
return func(topic int) ID {
14+
return ID(fmt.Sprintf("%d.%d", number, topic))
15+
}
16+
}

tour/tour.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ func (a IDSlice) Less(i, j int) bool { return a[i].LessThan(a[j]) }
2626

2727
// Topic is a type of objects that structures a tour topic.
2828
type Topic struct {
29-
ID ID
29+
ID ID
30+
Content
31+
}
32+
33+
type Content struct {
3034
Title string
3135
Text string
3236
}

0 commit comments

Comments
 (0)