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

Function Copy

chapter10/listing02/listing02.go:98–113  ·  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

96
97// Copy knows how to pull and store data from the System.
98func Copy(sys *System, batch int) error {
99 data := make([]Data, batch)
100
101 for {
102 i, err := pull(&sys.Xenia, data)
103 if i > 0 {
104 if _, err := store(&sys.Pillar, data[:i]); err != nil {
105 return err
106 }
107 }
108
109 if err != nil {
110 return err
111 }
112 }
113}
114
115// =============================================================================
116

Callers 1

mainFunction · 0.70

Calls 2

pullFunction · 0.70
storeFunction · 0.70

Tested by

no test coverage detected