id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c178000 |
}
res := "[" + s.transport.store.GraphDriverName() + "@" + s.transport.store.GraphRoot() + "+" + s.transport.store.RunRoot() + optionsList + "]"
if s.named != nil {
res = res + s.named.String()
}
if s.id != "" {
res = res + "@" + s.id
}
return res
} | |
c178001 | append(namespaces, storeSpec+s.named.Name()+":"+tagged.Tag())
}
components := strings.Split(s.named.Name(), "/")
for len(components) > 0 {
namespaces = append(namespaces, storeSpec+strings.Join(components, "/"))
components = components[:len(components)-1]
}
}
namespaces = append(namespaces, storeSpec)
namespaces = append(namespaces, driverlessStoreSpec)
return namespaces
} | |
c178002 | error) {
return pgzip.NewReader(r)
} | |
c178003 | ioutil.NopCloser(bzip2.NewReader(r)), nil
} | |
c178004 | return nil, err
}
return ioutil.NopCloser(r), nil
} | |
c178005 | := range compressionAlgos {
if bytes.HasPrefix(buffer[:n], algo.prefix) {
logrus.Debugf("Detected compression format %s", name)
decompressor = algo.decompressor
break
}
}
if decompressor == nil {
logrus.Debugf("No compression detected")
}
return decompressor, io.MultiReader(bytes.NewReader(buffer[:n]), input), nil
} | |
c178006 | != nil {
return nil, err
}
return &dockerImageDestination{
ref: ref,
c: c,
}, nil
} | |
c178007 | trying to cancel at %s", uploadLocation.String())
res2, err := d.c.makeRequestToResolvedURL(ctx, "DELETE", uploadLocation.String(), nil, nil, -1, v2Auth, extraScope)
if err != nil {
logrus.Debugf("Error trying to cancel an inadvertent upload: %s", err)
} else {
defer res2.Body.Close()
if res2.StatusCode != http.StatusNoContent {
logrus.Debugf("Error trying to cancel an inadvertent upload, status %s", http.StatusText(res.StatusCode))
}
}
// Anyway, if canceling the upload fails, ignore it and return the more important error:
return fmt.Errorf("Mounting %s from %s to %s started an upload instead", srcDigest, srcRepo.Name(), d.ref.ref.Name())
default:
logrus.Debugf("Error mounting, response %#v", *res)
return errors.Wrapf(client.HandleErrorResponse(res), "Error mounting %s from %s to %s", srcDigest, srcRepo.Name(), d.ref.ref.Name())
}
} | |
c178008 | types.BICTransportScope{Opaque: reference.Domain(ref.ref)}
} | |
c178009 | reuse a blob).
return types.BICLocationReference{Opaque: ref.ref.Name()}
} | |
c178010 | return reference.ParseNormalizedNamed(lr.Opaque)
} | |
c178011 | auto-decompressing input")
}
defer uncompressedStream.Close()
// Copy the plain archive to the temporary file.
//
// TODO: This can take quite some time, and should ideally be cancellable
// using a context.Context.
if _, err := io.Copy(tarCopyFile, uncompressedStream); err != nil {
return nil, errors.Wrapf(err, "error copying contents to temporary file %q", tarCopyFile.Name())
}
succeeded = true
return &Source{
tarPath: tarCopyFile.Name(),
removeTarPathOnClose: true,
}, nil
} | |
c178012 | }
defer file.Close()
bytes, err := ioutil.ReadAll(file)
if err != nil {
return nil, err
}
return bytes, nil
} | |
c178013 | knownLayers, err := s.prepareLayerData(&tarManifest[0], &parsedConfig)
if err != nil {
s.cacheDataResult = err
return
}
// Success; commit.
s.tarManifest = &tarManifest[0]
s.configBytes = configBytes
s.configDigest = digest.FromBytes(configBytes)
s.orderedDiffIDList = parsedConfig.RootFS.DiffIDs
s.knownLayers = knownLayers
})
return s.cacheDataResult
} | |
c178014 | if err := json.Unmarshal(bytes, &items); err != nil {
return nil, errors.Wrap(err, "Error decoding tar manifest.json")
}
return items, nil
} | |
c178015 | os.Remove(s.tarPath)
}
return nil
} | |
c178016 | := make(chan error, 1)
goroutineContext, goroutineCancel := context.WithCancel(ctx)
go imageLoadGoroutine(goroutineContext, c, reader, statusChannel)
return &daemonImageDestination{
ref: ref,
mustMatchRuntimeOS: mustMatchRuntimeOS,
Destination: tarfile.NewDestination(writer, namedTaggedRef),
goroutineCancel: goroutineCancel,
statusChannel: statusChannel,
writer: writer,
committed: false,
}, nil
} | |
c178017 |
}
}()
resp, err := c.ImageLoad(ctx, reader, true)
if err != nil {
err = errors.Wrap(err, "Error saving image to docker engine")
return
}
defer resp.Body.Close()
} | |
c178018 |
}
if err := internal.ValidateImageName(image); err != nil {
return nil, err
}
return ociArchiveReference{file: file, resolvedFile: resolved, image: image}, nil
} | |
c178019 | {
return tempDirOCIRef{}, err
}
tempDirRef := tempDirOCIRef{tempDirectory: dir, ociRefExtracted: ociRef}
return tempDirRef, nil
} | |
c178020 | return tempDirOCIRef{}, errors.Wrapf(err, "error deleting temp directory %q", tempDirRef.tempDirectory)
}
return tempDirOCIRef{}, errors.Wrapf(err, "error untarring file %q", tempDirRef.tempDirectory)
}
return tempDirRef, nil
} | |
c178021 | primaryDigest,
uncompressedDigest: uncompressedDigest,
})
resLength := len(cs)
if resLength > maxCandidates {
resLength = maxCandidates
}
res := make([]types.BICReplacementCandidate, resLength)
for i := range res {
res[i] = cs[i].Candidate
}
return res
} | |
c178022 | &ostreeImageDestination{ref, "", manifestSchema{}, tmpDirPath, map[string]*blobToImport{}, "", 0, nil}, nil
} | |
c178023 | err // Coverage: This can fail only if os.Getwd() fails.
}
resolved, err = filepath.EvalSymlinks(resolved)
if err != nil {
return "", err
}
return filepath.Clean(resolved), nil
} | |
c178024 |
if versionExists {
contents, err := ioutil.ReadFile(d.ref.versionPath())
if err != nil {
return nil, err
}
// check if contents of version file is what we expect it to be
if string(contents) != version {
return nil, ErrNotContainerImageDir
}
} else {
return nil, ErrNotContainerImageDir
}
// delete directory contents so that only one image is in the directory at a time
if err = removeDirContents(d.ref.resolvedPath); err != nil {
return nil, errors.Wrapf(err, "error erasing contents in %q", d.ref.resolvedPath)
}
logrus.Debugf("overwriting existing container image directory %q", d.ref.resolvedPath)
}
} else {
// create directory if it doesn't exist
if err := os.MkdirAll(d.ref.resolvedPath, 0755); err != nil {
return nil, errors.Wrapf(err, "unable to create directory %q", d.ref.resolvedPath)
}
}
// create version file
err = ioutil.WriteFile(d.ref.versionPath(), []byte(version), 0644)
if err != nil {
return nil, errors.Wrapf(err, "error creating version file %q", d.ref.versionPath())
}
return d, nil
} | |
c178025 |
if err != nil {
return false, err
}
return len(files) == 0, nil
} | |
c178026 |
}
for _, file := range files {
if err := os.RemoveAll(filepath.Join(path, file.Name())); err != nil {
return err
}
}
return nil
} | |
c178027 | tagsHolder.Tags...)
link := res.Header.Get("Link")
if link == "" {
break
}
linkURLStr := strings.Trim(strings.Split(link, ";")[0], "<>")
linkURL, err := url.Parse(linkURLStr)
if err != nil {
return tags, err
}
// can be relative or absolute, but we only want the path (and I
// guess we're in trouble if it forwards to a new place...)
path = linkURL.Path
if linkURL.RawQuery != "" {
path += "?"
path += linkURL.RawQuery
}
}
return tags, nil
} | |
c178028 | != nil {
logrus.Debugf("Error creating parent directories for %s, using a memory-only cache: %v", blobInfoCacheFilename, err)
return memory.New()
}
logrus.Debugf("Using blob info cache at %s", path)
return boltdb.New(path)
} | |
c178029 | with trivial (uncompressed, uncompressed) mappings
// when we already record a (compressed, uncompressed) pair.
if m, ok := mem.digestsByUncompressed[anyDigest]; ok && len(m) > 0 {
return anyDigest
}
return ""
} | |
c178030 | {
defer d.tempDirRef.deleteTempDir()
return d.unpackedDest.Close()
} | |
c178031 | {
return d.unpackedDest.PutManifest(ctx, m)
} | |
c178032 | := d.tempDirRef.tempDirectory
// path to save tarred up file
dst := d.ref.resolvedFile
return tarDirectory(src, dst)
} | |
c178033 |
// copies the contents of the directory to the tar file
// TODO: This can take quite some time, and should ideally be cancellable using a context.Context.
_, err = io.Copy(outFile, input)
return err
} | |
c178034 | like "a" matching an image by ID prefix when the input was actually meant to specify an image name.
if id == "" && len(ref) >= minimumTruncatedIDLength && !strings.ContainsAny(ref, "@:") {
if img, err := store.Image(ref); err == nil && img != nil && strings.HasPrefix(img.ID, ref) {
// It's a truncated version of the ID of an image that's present in local storage;
// we need to expand it.
id = img.ID
ref = ""
}
}
var named reference.Named
// Unless we have an un-named "ID" or "@ID" reference (where ID might only have been a prefix), which has been
// completely parsed above, the initial portion should be a name, possibly with a tag and/or a digest..
if ref != "" {
var err error
named, err = reference.ParseNormalizedNamed(ref)
if err != nil {
return nil, errors.Wrapf(err, "error parsing named reference %q", ref)
}
named = reference.TagNameOnly(named)
}
result, err := newReference(storageTransport{store: store, defaultUIDMap: s.defaultUIDMap, defaultGIDMap: s.defaultGIDMap}, named, id)
if err != nil {
return nil, err
}
logrus.Debugf("parsed reference into %q", result.StringWithinTransport())
return result, nil
} | |
c178035 | := range list.Manifests {
if d.Platform.Architecture == wantedArch && d.Platform.OS == wantedOS {
return d.Digest, nil
}
}
return "", fmt.Errorf("no image found in manifest list for architecture %s, OS %s", wantedArch, wantedOS)
} | |
c178036 | probably along with manifest list editing.
blob, mt, err := src.Manifest(ctx)
if err != nil {
return "", err
}
if mt != manifest.DockerV2ListMediaType {
return "", fmt.Errorf("Internal error: Trying to select an image from a non-manifest-list manifest type %s", mt)
}
return chooseDigestFromManifestList(sys, blob)
} | |
c178037 | fsLayers, history, architecture)
if err != nil {
return nil, err
}
return &manifestSchema1{m: m}, nil
} | |
c178038 | == digest.Canonical {
return d, nil
}
}
if err := s.ensureManifestIsLoaded(ctx); err != nil {
return "", err
}
return manifest.Digest(s.cachedManifest)
} | |
c178039 | getPath, headers, nil, v2Auth, nil)
if err != nil {
return err
}
defer get.Body.Close()
manifestBody, err := ioutil.ReadAll(get.Body)
if err != nil {
return err
}
switch get.StatusCode {
case http.StatusOK:
case http.StatusNotFound:
return errors.Errorf("Unable to delete %v. Image may not exist or is not stored with a v2 Schema in a v2 registry", ref.ref)
default:
return errors.Errorf("Failed to delete %v: %s (%v)", ref.ref, manifestBody, get.Status)
}
digest := get.Header.Get("Docker-Content-Digest")
deletePath := fmt.Sprintf(manifestPath, reference.Path(ref.ref), digest)
// When retrieving the digest from a registry >= 2.3 use the following header:
// "Accept": "application/vnd.docker.distribution.manifest.v2+json"
delete, err := c.makeRequest(ctx, "DELETE", deletePath, headers, nil, v2Auth, nil)
if err != nil {
return err
}
defer delete.Body.Close()
body, err := ioutil.ReadAll(delete.Body)
if err != nil {
return err
}
if delete.StatusCode != http.StatusAccepted {
return errors.Errorf("Failed to delete %v: %s (%v)", deletePath, string(body), delete.Status)
}
if c.signatureBase != nil {
manifestDigest, err := manifest.Digest(manifestBody)
if err != nil {
return err
}
for i := 0; ; i++ {
url := signatureStorageURL(c.signatureBase, manifestDigest, i)
if url == nil {
return errors.Errorf("Internal error: signatureStorageURL with non-nil base returned nil")
}
missing, err := c.deleteOneSignature(url)
if err != nil {
return err
}
if missing {
break
}
}
}
return nil
} | |
c178040 | := Schema1{
Name: name,
Tag: tag,
Architecture: architecture,
FSLayers: fsLayers,
History: history,
SchemaVersion: 1,
}
if err := s1.initialize(); err != nil {
return nil, err
}
return &s1, nil
} | |
c178041 | if err := json.Unmarshal([]byte(h.V1Compatibility), &m.ExtractedV1Compatibility[i]); err != nil {
return errors.Wrapf(err, "Error parsing v2s1 history entry %d", i)
}
}
return nil
} | |
c178042 | "id")
delete(raw, "parent")
delete(raw, "parent_id")
delete(raw, "layer_id")
delete(raw, "throwaway")
delete(raw, "Size")
// Add the history and rootfs information.
rootfs, err := json.Marshal(rootFS)
if err != nil {
return nil, errors.Errorf("error encoding rootfs information %#v: %v", rootFS, err)
}
rawRootfs := json.RawMessage(rootfs)
raw["rootfs"] = &rawRootfs
history, err := json.Marshal(convertedHistory)
if err != nil {
return nil, errors.Errorf("error encoding history information %#v: %v", convertedHistory, err)
}
rawHistory := json.RawMessage(history)
raw["history"] = &rawHistory
// Encode the result.
config, err = json.Marshal(raw)
if err != nil {
return nil, errors.Errorf("error re-encoding compat image config %#v: %v", s1, err)
}
return config, nil
} | |
c178043 |
}
manifest, err = sig.Payload()
if err != nil {
// Coverage: This should never happen, libtrust's Payload() can fail only if joseBase64UrlDecode() fails, on a string
// that libtrust itself has josebase64UrlEncode()d
return "", err
}
}
return digest.FromBytes(manifest), nil
} | |
c178044 |
if err != nil {
return false, err
}
return expectedDigest == actualDigest, nil
} | |
c178045 | deserialize using v2s1 as per https://github.com/docker/distribution/blob/master/manifests.go#L108
// and https://github.com/docker/distribution/blob/master/manifest/schema1/manifest.go#L50
//
// Crane registries can also return "text/plain", or pretty much anything else depending on a file extension “recognized” in the tag.
// This makes no real sense, but it happens
// because requests for manifests are
// redirected to a content distribution
// network which is configured that way. See https://bugzilla.redhat.com/show_bug.cgi?id=1389442
return DockerV2Schema1SignedMediaType
}
} | |
c178046 | individual manifests is not implemented")
default: // Note that this may not be reachable, NormalizedMIMEType has a default for unknown values.
return nil, fmt.Errorf("Unimplemented manifest MIME type %s", mt)
}
} | |
c178047 | nil, err
}
return dirReference{path: path, resolvedPath: resolved}, nil
} | |
c178048 | the digest identification?
return filepath.Join(ref.path, digest.Hex())
} | |
c178049 | fmt.Sprintf("signature-%d", index+1))
} | |
c178050 | reqChan: make(chan workRequest),
}
p.SetSize(n)
return p
} | |
c178051 | return &closureWorker{
processor: f,
}
})
} | |
c178052 |
request.interruptFunc()
return nil, ErrJobTimedOut
}
select {
case payload, open = <-request.retChan:
if !open {
return nil, ErrWorkerClosed
}
case <-tout.C:
request.interruptFunc()
return nil, ErrJobTimedOut
}
tout.Stop()
return payload, nil
} | |
c178053 | newWorkerWrapper(p.reqChan, p.ctor()))
}
// Asynchronously stop all workers > N
for i := n; i < lWorkers; i++ {
p.workers[i].stop()
}
// Synchronously wait for all workers > N to stop
for i := n; i < lWorkers; i++ {
p.workers[i].join()
}
// Remove stopped workers from slice
p.workers = p.workers[:n]
} | |
c178054 | p.workerMut.Unlock()
return len(p.workers)
} | |
c178055 | {
return Point{int(r.x), int(r.y)}
} | |
c178056 | + int(r.width), int(r.y) + int(r.height)}
} | |
c178057 |
cvBox.center.y = C.float(box.center.Y)
cvBox.size.width = C.float(box.size.Width)
cvBox.size.height = C.float(box.size.Height)
return cvBox
} | |
c178058 | i, p := range pts {
outPts[i].X = float32(p.x)
outPts[i].Y = float32(p.y)
}
return outPts
} | |
c178059 | C.int(c2), C.int(c3), C.int(c4))
return uint32(rv)
} | |
c178060 | unsafe.Pointer(imgRed),
unsafe.Pointer(imgAlpha),
unsafe.Pointer(dst),
)
} | |
c178061 | unsafe.Pointer(imgGreen),
unsafe.Pointer(imgRed),
unsafe.Pointer(imgAlpha),
)
} | |
c178062 |
unsafe.Pointer(src2),
C.double(beta),
C.double(gamma),
unsafe.Pointer(dst),
)
} | |
c178063 | AndWithMask(src1, src2, dst, nil)
} | |
c178064 | unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178065 | AndScalarWithMask(src, value, dst, nil)
} | |
c178066 |
C.cvAndS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178067 | OrWithMask(src1, src2, dst, nil)
} | |
c178068 | unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178069 | OrScalarWithMask(src, value, dst, nil)
} | |
c178070 |
C.cvOrS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178071 | unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178072 | AddScalarWithMask(src, value, dst, nil)
} | |
c178073 |
C.cvAddS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178074 | SubtractWithMask(src1, src2, dst, nil)
} | |
c178075 |
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178076 | SubScalarWithMask(src, value, dst, nil)
} | |
c178077 |
C.cvSubS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178078 | *IplImage) {
SubScalarWithMaskRev(value, src, dst, nil)
} | |
c178079 | (C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | |
c178080 | unsafe.Pointer(src2),
unsafe.Pointer(dst),
)
} | |
c178081 | {
C.cvAbsDiffS(
unsafe.Pointer(src),
unsafe.Pointer(dst),
(C.CvScalar)(value),
)
} | |
c178082 |
unsafe.Pointer(src),
(*C.CvScalar)(&mean),
(*C.CvScalar)(&stdDev),
unsafe.Pointer(mask),
)
return mean, stdDev
} | |
c178083 |
C.int(seq_flags),
C.size_t(unsafe.Sizeof(Seq{})),
C.size_t(elem_size),
C.cvCreateMemStorage(C.int(0)),
))
} | |
c178084 | {
return unsafe.Pointer(C.cvSeqPush((*C.struct_CvSeq)(seq), element))
} | |
c178085 | C.cvSeqPop((*C.struct_CvSeq)(seq), element)
} | |
c178086 | {
return unsafe.Pointer((C.cvSeqPushFront((*C.struct_CvSeq)(seq), element)))
} | |
c178087 | C.cvSeqPopFront((*C.struct_CvSeq)(seq), element)
} | |
c178088 | (unsafe.Pointer)(C.cvGetSeqElem(
(*C.struct_CvSeq)(seq),
C.int(index),
))
} | |
c178089 |
C.cvSeqRemove((*C.struct_CvSeq)(seq), C.int(index))
} | |
c178090 | *Config) {
c.delay = delay
}
} | |
c178091 | config.delay * (1 << (n - 1))
} | |
c178092 |
return fmt.Sprintf("All attempts fail:\n%s", strings.Join(logWithNumber, "\n"))
} | |
c178093 | = append(r.args, args...)
return r
} | |
c178094 | r.Body(strings.NewReader(body))
} | |
c178095 | r.Body(bytes.NewReader(body))
} | |
c178096 | *RequestBuilder {
r.body = body
return r
} | |
c178097 |
// slow case.
s = fmt.Sprint(value)
}
if r.opts == nil {
r.opts = make(map[string]string, 1)
}
r.opts[key] = s
return r
} | |
c178098 | = make(map[string]string, 1)
}
r.headers[name] = value
return r
} | |
c178099 | r.shell.url, r.command, r.args...)
req.Opts = r.opts
req.Headers = r.headers
req.Body = r.body
return req.Send(&r.shell.httpcli)
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.