MCPcopy Create free account
hub / github.com/goinaction/code / Pull

Method Pull

chapter10/listing02/listing02.go:41–54  ·  view source on GitHub ↗

Pull knows how to pull data out of Xenia.

(d *Data)

Source from the content-addressed store, hash-verified

39
40// Pull knows how to pull data out of Xenia.
41func (Xenia) Pull(d *Data) error {
42 switch rand.Intn(10) {
43 case 1, 9:
44 return io.EOF
45
46 case 5:
47 return errors.New("Error reading data from Xenia")
48
49 default:
50 d.Line = "Data"
51 fmt.Println("In:", d.Line)
52 return nil
53 }
54}
55
56// Pillar is a system we need to store data into.
57type Pillar struct{}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected