MCPcopy Create free account
hub / github.com/aptly-dev/aptly / putFile

Method putFile

gcs/public.go:144–165  ·  view source on GitHub ↗
(path string, source io.Reader, sourceMD5 string)

Source from the content-addressed store, hash-verified

142}
143
144func (g *PublishedStorage) putFile(path string, source io.Reader, sourceMD5 string) error {
145 obj := g.objectHandle(path)
146 writer := obj.NewWriter(context.TODO())
147
148 if g.storageClass != "" {
149 writer.StorageClass = g.storageClass
150 }
151 if sourceMD5 != "" {
152 writer.Metadata = map[string]string{"Md5": sourceMD5}
153 }
154
155 if _, err := io.Copy(writer, source); err != nil {
156 _ = writer.Close()
157 return err
158 }
159
160 if err := writer.Close(); err != nil {
161 return err
162 }
163
164 return g.applyACL(obj)
165}
166
167func (g *PublishedStorage) getMD5(path string) (string, error) {
168 attrs, err := g.objectHandle(path).Attrs(context.TODO())

Callers 2

PutFileMethod · 0.95
LinkFromPoolMethod · 0.95

Calls 4

objectHandleMethod · 0.95
applyACLMethod · 0.95
CloseMethod · 0.65
CopyMethod · 0.45

Tested by

no test coverage detected