-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmiracles.go
More file actions
29 lines (25 loc) · 872 Bytes
/
miracles.go
File metadata and controls
29 lines (25 loc) · 872 Bytes
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
package figtree
// Mutations returns a receiver channel of Mutation data
func (tree *figTree) Mutations() <-chan Mutation {
return tree.mutationsCh
}
// Recall is when you bring the mutations channel back to life and you unlock making further changes to the fig *figTree
func (tree *figTree) Recall() {
tree.angel.Store(false)
tree.mutationsCh = make(chan Mutation, tree.harvest)
tree.tracking = true
}
// Curse is when you lock the fig *figTree from further changes, stop tracking and close the channel
func (tree *figTree) Curse() {
tree.angel.Store(true)
tree.tracking = false
close(tree.mutationsCh)
}
// FigFlesh returns a Flesh interface to the Value on the figTree
func (tree *figTree) FigFlesh(name string) Flesh {
tree.mu.RLock()
defer tree.mu.RUnlock()
name = tree.resolveName(name)
value := tree.useValue(tree.from(name))
return value.Flesh()
}