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

Function Copy

chapter10/listing01/listing01.go:86–101  ·  view source on GitHub ↗

Copy knows how to pull and store data from the System.

(sys *System, batch int)

Source from the content-addressed store, hash-verified

84
85// Copy knows how to pull and store data from the System.
86func Copy(sys *System, batch int) error {
87 data := make([]Data, batch)
88
89 for {
90 i, err := pull(&sys.Xenia, data)
91 if i > 0 {
92 if _, err := store(&sys.Pillar, data[:i]); err != nil {
93 return err
94 }
95 }
96
97 if err != nil {
98 return err
99 }
100 }
101}
102
103// =============================================================================
104

Callers 1

mainFunction · 0.70

Calls 2

pullFunction · 0.70
storeFunction · 0.70

Tested by

no test coverage detected