id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
31,600
perkeep/perkeep
internal/magic/magic.go
MIMETypeByExtension
func MIMETypeByExtension(ext string) string { mimeParts := strings.SplitN(mime.TypeByExtension(ext), ";", 2) return strings.TrimSpace(mimeParts[0]) }
go
func MIMETypeByExtension(ext string) string { mimeParts := strings.SplitN(mime.TypeByExtension(ext), ";", 2) return strings.TrimSpace(mimeParts[0]) }
[ "func", "MIMETypeByExtension", "(", "ext", "string", ")", "string", "{", "mimeParts", ":=", "strings", ".", "SplitN", "(", "mime", ".", "TypeByExtension", "(", "ext", ")", ",", "\"", "\"", ",", "2", ")", "\n", "return", "strings", ".", "TrimSpace", "(", ...
// MIMETypeByExtension calls mime.TypeByExtension, and removes optional parameters, // to keep only the type and subtype.
[ "MIMETypeByExtension", "calls", "mime", ".", "TypeByExtension", "and", "removes", "optional", "parameters", "to", "keep", "only", "the", "type", "and", "subtype", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/magic/magic.go#L268-L271
31,601
perkeep/perkeep
pkg/blobserver/blobpacked/blobpacked.go
checkLargeIntegrity
func (s *storage) checkLargeIntegrity() (RecoveryMode, error) { inLarge := 0 var missing []blob.Ref // blobs in large but not in meta var extra []blob.Ref // blobs in meta but not in large t := s.meta.Find(zipMetaPrefix, zipMetaPrefixLimit) defer t.Close() iterate := true var enumFunc func(sb blob.SizedRef) er...
go
func (s *storage) checkLargeIntegrity() (RecoveryMode, error) { inLarge := 0 var missing []blob.Ref // blobs in large but not in meta var extra []blob.Ref // blobs in meta but not in large t := s.meta.Find(zipMetaPrefix, zipMetaPrefixLimit) defer t.Close() iterate := true var enumFunc func(sb blob.SizedRef) er...
[ "func", "(", "s", "*", "storage", ")", "checkLargeIntegrity", "(", ")", "(", "RecoveryMode", ",", "error", ")", "{", "inLarge", ":=", "0", "\n", "var", "missing", "[", "]", "blob", ".", "Ref", "// blobs in large but not in meta", "\n", "var", "extra", "[",...
// checkLargeIntegrity verifies that all large blobs in the large storage are // indexed in meta, and vice-versa, that all rows in meta referring to a large blob // correspond to an existing large blob in the large storage. If any of the above // is not true, it returns the recovery mode that should be used to fix the ...
[ "checkLargeIntegrity", "verifies", "that", "all", "large", "blobs", "in", "the", "large", "storage", "are", "indexed", "in", "meta", "and", "vice", "-", "versa", "that", "all", "rows", "in", "meta", "referring", "to", "a", "large", "blob", "correspond", "to"...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobpacked/blobpacked.go#L383-L441
31,602
perkeep/perkeep
pkg/blobserver/blobpacked/blobpacked.go
getMetaRow
func (s *storage) getMetaRow(br blob.Ref) (meta, error) { v, err := s.meta.Get(blobMetaPrefix + br.String()) if err == sorted.ErrNotFound { return meta{}, nil } if err != nil { return meta{}, fmt.Errorf("blobpacked.getMetaRow(%v) = %v", br, err) } return parseMetaRow([]byte(v)) }
go
func (s *storage) getMetaRow(br blob.Ref) (meta, error) { v, err := s.meta.Get(blobMetaPrefix + br.String()) if err == sorted.ErrNotFound { return meta{}, nil } if err != nil { return meta{}, fmt.Errorf("blobpacked.getMetaRow(%v) = %v", br, err) } return parseMetaRow([]byte(v)) }
[ "func", "(", "s", "*", "storage", ")", "getMetaRow", "(", "br", "blob", ".", "Ref", ")", "(", "meta", ",", "error", ")", "{", "v", ",", "err", ":=", "s", ".", "meta", ".", "Get", "(", "blobMetaPrefix", "+", "br", ".", "String", "(", ")", ")", ...
// if not found, err == nil.
[ "if", "not", "found", "err", "==", "nil", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobpacked/blobpacked.go#L841-L850
31,603
perkeep/perkeep
pkg/blobserver/blobpacked/blobpacked.go
check
func check(err error) { if err != nil { b := make([]byte, 2<<10) b = b[:runtime.Stack(b, false)] log.Printf("Unlikely error condition triggered: %v at %s", err, b) panic(err) } }
go
func check(err error) { if err != nil { b := make([]byte, 2<<10) b = b[:runtime.Stack(b, false)] log.Printf("Unlikely error condition triggered: %v at %s", err, b) panic(err) } }
[ "func", "check", "(", "err", "error", ")", "{", "if", "err", "!=", "nil", "{", "b", ":=", "make", "(", "[", "]", "byte", ",", "2", "<<", "10", ")", "\n", "b", "=", "b", "[", ":", "runtime", ".", "Stack", "(", "b", ",", "false", ")", "]", ...
// check should only be used for things which really shouldn't ever happen, but should // still be checked. If there is interesting logic in the 'else', then don't use this.
[ "check", "should", "only", "be", "used", "for", "things", "which", "really", "shouldn", "t", "ever", "happen", "but", "should", "still", "be", "checked", ".", "If", "there", "is", "interesting", "logic", "in", "the", "else", "then", "don", "t", "use", "t...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobpacked/blobpacked.go#L1297-L1304
31,604
perkeep/perkeep
pkg/blobserver/blobpacked/blobpacked.go
foreachZipBlob
func (s *storage) foreachZipBlob(ctx context.Context, zipRef blob.Ref, fn func(BlobAndPos) error) error { sb, err := blobserver.StatBlob(ctx, s.large, zipRef) if err != nil { return err } zr, err := zip.NewReader(blob.ReaderAt(ctx, s.large, zipRef), int64(sb.Size)) if err != nil { return zipOpenError{zipRef, e...
go
func (s *storage) foreachZipBlob(ctx context.Context, zipRef blob.Ref, fn func(BlobAndPos) error) error { sb, err := blobserver.StatBlob(ctx, s.large, zipRef) if err != nil { return err } zr, err := zip.NewReader(blob.ReaderAt(ctx, s.large, zipRef), int64(sb.Size)) if err != nil { return zipOpenError{zipRef, e...
[ "func", "(", "s", "*", "storage", ")", "foreachZipBlob", "(", "ctx", "context", ".", "Context", ",", "zipRef", "blob", ".", "Ref", ",", "fn", "func", "(", "BlobAndPos", ")", "error", ")", "error", "{", "sb", ",", "err", ":=", "blobserver", ".", "Stat...
// foreachZipBlob calls fn for each blob in the zip pack blob // identified by zipRef. If fn returns a non-nil error, // foreachZipBlob stops enumerating with that error.
[ "foreachZipBlob", "calls", "fn", "for", "each", "blob", "in", "the", "zip", "pack", "blob", "identified", "by", "zipRef", ".", "If", "fn", "returns", "a", "non", "-", "nil", "error", "foreachZipBlob", "stops", "enumerating", "with", "that", "error", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobpacked/blobpacked.go#L1522-L1590
31,605
perkeep/perkeep
pkg/blobserver/blobpacked/blobpacked.go
deleteZipPack
func (s *storage) deleteZipPack(ctx context.Context, br blob.Ref) error { inUse, err := s.zipPartsInUse(ctx, br) if err != nil { return err } if len(inUse) > 0 { return fmt.Errorf("can't delete zip pack %v: %d parts in use: %v", br, len(inUse), inUse) } if err := s.large.RemoveBlobs(ctx, []blob.Ref{br}); err ...
go
func (s *storage) deleteZipPack(ctx context.Context, br blob.Ref) error { inUse, err := s.zipPartsInUse(ctx, br) if err != nil { return err } if len(inUse) > 0 { return fmt.Errorf("can't delete zip pack %v: %d parts in use: %v", br, len(inUse), inUse) } if err := s.large.RemoveBlobs(ctx, []blob.Ref{br}); err ...
[ "func", "(", "s", "*", "storage", ")", "deleteZipPack", "(", "ctx", "context", ".", "Context", ",", "br", "blob", ".", "Ref", ")", "error", "{", "inUse", ",", "err", ":=", "s", ".", "zipPartsInUse", "(", "ctx", ",", "br", ")", "\n", "if", "err", ...
// deleteZipPack deletes the zip pack file br, but only if that zip // file's parts are deleted already from the meta index.
[ "deleteZipPack", "deletes", "the", "zip", "pack", "file", "br", "but", "only", "if", "that", "zip", "file", "s", "parts", "are", "deleted", "already", "from", "the", "meta", "index", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobpacked/blobpacked.go#L1594-L1606
31,606
perkeep/perkeep
internal/video/thumbnail/service.go
NewService
func NewService(th Thumbnailer, timeout time.Duration, maxProcs int) *Service { var g *syncutil.Gate if maxProcs > 0 { g = syncutil.NewGate(maxProcs) } return &Service{ thumbnailer: th, timeout: timeout, gate: g, } }
go
func NewService(th Thumbnailer, timeout time.Duration, maxProcs int) *Service { var g *syncutil.Gate if maxProcs > 0 { g = syncutil.NewGate(maxProcs) } return &Service{ thumbnailer: th, timeout: timeout, gate: g, } }
[ "func", "NewService", "(", "th", "Thumbnailer", ",", "timeout", "time", ".", "Duration", ",", "maxProcs", "int", ")", "*", "Service", "{", "var", "g", "*", "syncutil", ".", "Gate", "\n", "if", "maxProcs", ">", "0", "{", "g", "=", "syncutil", ".", "Ne...
// NewService builds a new Service. Zero timeout or maxProcs means no limit.
[ "NewService", "builds", "a", "new", "Service", ".", "Zero", "timeout", "or", "maxProcs", "means", "no", "limit", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/video/thumbnail/service.go#L82-L94
31,607
perkeep/perkeep
internal/video/thumbnail/service.go
Generate
func (s *Service) Generate(videoRef blob.Ref, w io.Writer, src blob.Fetcher) error { if s.gate != nil { s.gate.Start() defer s.gate.Done() } ln, err := netutil.ListenOnLocalRandomPort() if err != nil { return err } defer ln.Close() videoURI := &url.URL{ Scheme: "http", Host: ln.Addr().String(), ...
go
func (s *Service) Generate(videoRef blob.Ref, w io.Writer, src blob.Fetcher) error { if s.gate != nil { s.gate.Start() defer s.gate.Done() } ln, err := netutil.ListenOnLocalRandomPort() if err != nil { return err } defer ln.Close() videoURI := &url.URL{ Scheme: "http", Host: ln.Addr().String(), ...
[ "func", "(", "s", "*", "Service", ")", "Generate", "(", "videoRef", "blob", ".", "Ref", ",", "w", "io", ".", "Writer", ",", "src", "blob", ".", "Fetcher", ")", "error", "{", "if", "s", ".", "gate", "!=", "nil", "{", "s", ".", "gate", ".", "Star...
// Generate reads the video given by videoRef from src and writes its thumbnail image to w.
[ "Generate", "reads", "the", "video", "given", "by", "videoRef", "from", "src", "and", "writes", "its", "thumbnail", "image", "to", "w", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/video/thumbnail/service.go#L99-L155
31,608
perkeep/perkeep
server/perkeepd/ui/goui/downloadbutton/gen_DownloadItemsBtn_reactGen.go
Props
func (d DownloadItemsBtnDef) Props() DownloadItemsBtnProps { uprops := d.ComponentDef.Props() return uprops.(DownloadItemsBtnProps) }
go
func (d DownloadItemsBtnDef) Props() DownloadItemsBtnProps { uprops := d.ComponentDef.Props() return uprops.(DownloadItemsBtnProps) }
[ "func", "(", "d", "DownloadItemsBtnDef", ")", "Props", "(", ")", "DownloadItemsBtnProps", "{", "uprops", ":=", "d", ".", "ComponentDef", ".", "Props", "(", ")", "\n", "return", "uprops", ".", "(", "DownloadItemsBtnProps", ")", "\n", "}" ]
// Props is an auto-generated proxy to the current props of DownloadItemsBtn
[ "Props", "is", "an", "auto", "-", "generated", "proxy", "to", "the", "current", "props", "of", "DownloadItemsBtn" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/server/perkeepd/ui/goui/downloadbutton/gen_DownloadItemsBtn_reactGen.go#L30-L33
31,609
perkeep/perkeep
pkg/server/import_share.go
importAll
func (si *shareImporter) importAll(ctx context.Context) error { src, shared, err := client.NewFromShareRoot(ctx, si.shareURL, client.OptionNoExternalConfig()) if err != nil { return err } si.src = src si.br = shared si.workc = make(chan work, 2*numWorkers) defer close(si.workc) // fan out over a pool of numW...
go
func (si *shareImporter) importAll(ctx context.Context) error { src, shared, err := client.NewFromShareRoot(ctx, si.shareURL, client.OptionNoExternalConfig()) if err != nil { return err } si.src = src si.br = shared si.workc = make(chan work, 2*numWorkers) defer close(si.workc) // fan out over a pool of numW...
[ "func", "(", "si", "*", "shareImporter", ")", "importAll", "(", "ctx", "context", ".", "Context", ")", "error", "{", "src", ",", "shared", ",", "err", ":=", "client", ".", "NewFromShareRoot", "(", "ctx", ",", "si", ".", "shareURL", ",", "client", ".", ...
// importAll imports all the shared contents transitively reachable under // si.shareURL.
[ "importAll", "imports", "all", "the", "shared", "contents", "transitively", "reachable", "under", "si", ".", "shareURL", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/import_share.go#L176-L207
31,610
perkeep/perkeep
pkg/server/import_share.go
importAssembled
func (si *shareImporter) importAssembled(ctx context.Context) { res, err := http.Get(si.shareURL) if err != nil { return } defer res.Body.Close() br, err := schema.WriteFileFromReader(ctx, si.dest, "", res.Body) if err != nil { return } si.mu.Lock() si.br = br si.mu.Unlock() return }
go
func (si *shareImporter) importAssembled(ctx context.Context) { res, err := http.Get(si.shareURL) if err != nil { return } defer res.Body.Close() br, err := schema.WriteFileFromReader(ctx, si.dest, "", res.Body) if err != nil { return } si.mu.Lock() si.br = br si.mu.Unlock() return }
[ "func", "(", "si", "*", "shareImporter", ")", "importAssembled", "(", "ctx", "context", ".", "Context", ")", "{", "res", ",", "err", ":=", "http", ".", "Get", "(", "si", ".", "shareURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}"...
// importAssembled imports the assembled file shared at si.shareURL.
[ "importAssembled", "imports", "the", "assembled", "file", "shared", "at", "si", ".", "shareURL", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/import_share.go#L210-L224
31,611
perkeep/perkeep
pkg/server/import_share.go
isAssembled
func (si *shareImporter) isAssembled() (bool, error) { u, err := url.Parse(si.shareURL) if err != nil { return false, err } isAs, _ := strconv.ParseBool(u.Query().Get("assemble")) return isAs, nil }
go
func (si *shareImporter) isAssembled() (bool, error) { u, err := url.Parse(si.shareURL) if err != nil { return false, err } isAs, _ := strconv.ParseBool(u.Query().Get("assemble")) return isAs, nil }
[ "func", "(", "si", "*", "shareImporter", ")", "isAssembled", "(", ")", "(", "bool", ",", "error", ")", "{", "u", ",", "err", ":=", "url", ".", "Parse", "(", "si", ".", "shareURL", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", ...
// isAssembled reports whether si.shareURL is of a shared assembled file.
[ "isAssembled", "reports", "whether", "si", ".", "shareURL", "is", "of", "a", "shared", "assembled", "file", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/import_share.go#L227-L234
31,612
perkeep/perkeep
pkg/server/import_share.go
serveProgress
func (si *shareImporter) serveProgress(w http.ResponseWriter, r *http.Request) { si.mu.RLock() defer si.mu.RUnlock() httputil.ReturnJSON(w, camtypes.ShareImportProgress{ FilesSeen: si.seen, FilesCopied: si.copied, Running: si.running, Assembled: si.assembled, BlobRef: si.br, }) }
go
func (si *shareImporter) serveProgress(w http.ResponseWriter, r *http.Request) { si.mu.RLock() defer si.mu.RUnlock() httputil.ReturnJSON(w, camtypes.ShareImportProgress{ FilesSeen: si.seen, FilesCopied: si.copied, Running: si.running, Assembled: si.assembled, BlobRef: si.br, }) }
[ "func", "(", "si", "*", "shareImporter", ")", "serveProgress", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "si", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "si", ".", "mu", ".", "RUnlock", "(", ...
// serveProgress serves the state of the currently running importing process
[ "serveProgress", "serves", "the", "state", "of", "the", "currently", "running", "importing", "process" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/import_share.go#L304-L314
31,613
perkeep/perkeep
internal/httputil/certs.go
GenSelfTLS
func GenSelfTLS(hostname string) (certPEM, keyPEM []byte, err error) { priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { return certPEM, keyPEM, fmt.Errorf("failed to generate private key: %s", err) } now := time.Now() if hostname == "" { hostname = "localhost" } serialNumberLimit := new(big....
go
func GenSelfTLS(hostname string) (certPEM, keyPEM []byte, err error) { priv, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { return certPEM, keyPEM, fmt.Errorf("failed to generate private key: %s", err) } now := time.Now() if hostname == "" { hostname = "localhost" } serialNumberLimit := new(big....
[ "func", "GenSelfTLS", "(", "hostname", "string", ")", "(", "certPEM", ",", "keyPEM", "[", "]", "byte", ",", "err", "error", ")", "{", "priv", ",", "err", ":=", "rsa", ".", "GenerateKey", "(", "rand", ".", "Reader", ",", "2048", ")", "\n", "if", "er...
// GenSelfTLS generates a self-signed certificate and key for hostname.
[ "GenSelfTLS", "generates", "a", "self", "-", "signed", "certificate", "and", "key", "for", "hostname", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/httputil/certs.go#L54-L100
31,614
perkeep/perkeep
internal/httputil/certs.go
CertFingerprint
func CertFingerprint(certPEM []byte) (string, error) { p, _ := pem.Decode(certPEM) if p == nil { return "", errors.New("no valid PEM data found") } cert, err := x509.ParseCertificate(p.Bytes) if err != nil { return "", fmt.Errorf("failed to parse certificate: %v", err) } return hashutil.SHA256Prefix(cert.Raw...
go
func CertFingerprint(certPEM []byte) (string, error) { p, _ := pem.Decode(certPEM) if p == nil { return "", errors.New("no valid PEM data found") } cert, err := x509.ParseCertificate(p.Bytes) if err != nil { return "", fmt.Errorf("failed to parse certificate: %v", err) } return hashutil.SHA256Prefix(cert.Raw...
[ "func", "CertFingerprint", "(", "certPEM", "[", "]", "byte", ")", "(", "string", ",", "error", ")", "{", "p", ",", "_", ":=", "pem", ".", "Decode", "(", "certPEM", ")", "\n", "if", "p", "==", "nil", "{", "return", "\"", "\"", ",", "errors", ".", ...
// CertFingerprint returns the SHA-256 prefix of the x509 certificate encoded in certPEM.
[ "CertFingerprint", "returns", "the", "SHA", "-", "256", "prefix", "of", "the", "x509", "certificate", "encoded", "in", "certPEM", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/httputil/certs.go#L103-L113
31,615
perkeep/perkeep
internal/httputil/certs.go
GenSelfTLSFiles
func GenSelfTLSFiles(hostname, certPath, keyPath string) (fingerprint string, err error) { cert, key, err := GenSelfTLS(hostname) if err != nil { return "", err } sig, err := CertFingerprint(cert) if err != nil { return "", fmt.Errorf("could not get SHA-256 fingerprint of certificate: %v", err) } if err := w...
go
func GenSelfTLSFiles(hostname, certPath, keyPath string) (fingerprint string, err error) { cert, key, err := GenSelfTLS(hostname) if err != nil { return "", err } sig, err := CertFingerprint(cert) if err != nil { return "", fmt.Errorf("could not get SHA-256 fingerprint of certificate: %v", err) } if err := w...
[ "func", "GenSelfTLSFiles", "(", "hostname", ",", "certPath", ",", "keyPath", "string", ")", "(", "fingerprint", "string", ",", "err", "error", ")", "{", "cert", ",", "key", ",", "err", ":=", "GenSelfTLS", "(", "hostname", ")", "\n", "if", "err", "!=", ...
// GenSelfTLSFiles generates a self-signed certificate and key for hostname, // and writes them to the given paths. If it succeeds it also returns // the SHA256 prefix of the new cert.
[ "GenSelfTLSFiles", "generates", "a", "self", "-", "signed", "certificate", "and", "key", "for", "hostname", "and", "writes", "them", "to", "the", "given", "paths", ".", "If", "it", "succeeds", "it", "also", "returns", "the", "SHA256", "prefix", "of", "the", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/httputil/certs.go#L118-L134
31,616
perkeep/perkeep
pkg/types/camtypes/search.go
Contains
func (b LocationBounds) Contains(loc Location) bool { if b.SpansDateLine() { return loc.Longitude >= b.West || loc.Longitude <= b.East } return loc.Longitude >= b.West && loc.Longitude <= b.East }
go
func (b LocationBounds) Contains(loc Location) bool { if b.SpansDateLine() { return loc.Longitude >= b.West || loc.Longitude <= b.East } return loc.Longitude >= b.West && loc.Longitude <= b.East }
[ "func", "(", "b", "LocationBounds", ")", "Contains", "(", "loc", "Location", ")", "bool", "{", "if", "b", ".", "SpansDateLine", "(", ")", "{", "return", "loc", ".", "Longitude", ">=", "b", ".", "West", "||", "loc", ".", "Longitude", "<=", "b", ".", ...
// Contains reports whether loc is in the bounds b.
[ "Contains", "reports", "whether", "loc", "is", "in", "the", "bounds", "b", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/types/camtypes/search.go#L285-L290
31,617
perkeep/perkeep
pkg/types/camtypes/search.go
Expand
func (b LocationBounds) Expand(loc Location) LocationBounds { if b == (LocationBounds{}) { return LocationBounds{ North: loc.Latitude, South: loc.Latitude, West: loc.Longitude, East: loc.Longitude, } } nb := LocationBounds{ North: b.North, South: b.South, West: b.West, East: b.East, } i...
go
func (b LocationBounds) Expand(loc Location) LocationBounds { if b == (LocationBounds{}) { return LocationBounds{ North: loc.Latitude, South: loc.Latitude, West: loc.Longitude, East: loc.Longitude, } } nb := LocationBounds{ North: b.North, South: b.South, West: b.West, East: b.East, } i...
[ "func", "(", "b", "LocationBounds", ")", "Expand", "(", "loc", "Location", ")", "LocationBounds", "{", "if", "b", "==", "(", "LocationBounds", "{", "}", ")", "{", "return", "LocationBounds", "{", "North", ":", "loc", ".", "Latitude", ",", "South", ":", ...
// Expand returns a new LocationBounds nb. If either of loc coordinates is // outside of b, nb is the dimensions of b expanded as little as possible in // order to include loc. Otherwise, nb is just a copy of b.
[ "Expand", "returns", "a", "new", "LocationBounds", "nb", ".", "If", "either", "of", "loc", "coordinates", "is", "outside", "of", "b", "nb", "is", "the", "dimensions", "of", "b", "expanded", "as", "little", "as", "possible", "in", "order", "to", "include", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/types/camtypes/search.go#L302-L345
31,618
perkeep/perkeep
internal/osutil/restart_windows.go
SelfPath
func SelfPath() (string, error) { kernel32, err := syscall.LoadDLL("kernel32.dll") if err != nil { return "", err } sysproc, err := kernel32.FindProc("GetModuleFileNameW") if err != nil { return "", err } b := make([]uint16, syscall.MAX_PATH) r, _, err := sysproc.Call(0, uintptr(unsafe.Pointer(&b[0])), uint...
go
func SelfPath() (string, error) { kernel32, err := syscall.LoadDLL("kernel32.dll") if err != nil { return "", err } sysproc, err := kernel32.FindProc("GetModuleFileNameW") if err != nil { return "", err } b := make([]uint16, syscall.MAX_PATH) r, _, err := sysproc.Call(0, uintptr(unsafe.Pointer(&b[0])), uint...
[ "func", "SelfPath", "(", ")", "(", "string", ",", "error", ")", "{", "kernel32", ",", "err", ":=", "syscall", ".", "LoadDLL", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "sysproc",...
// SelfPath returns the path of the executable for the currently running // process.
[ "SelfPath", "returns", "the", "path", "of", "the", "executable", "for", "the", "currently", "running", "process", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/osutil/restart_windows.go#L30-L46
31,619
perkeep/perkeep
cmd/pk/googinit.go
prompt
func prompt(promptText string) string { fmt.Fprint(cmdmain.Stdout, promptText) sc := bufio.NewScanner(cmdmain.Stdin) sc.Scan() return strings.TrimSpace(sc.Text()) }
go
func prompt(promptText string) string { fmt.Fprint(cmdmain.Stdout, promptText) sc := bufio.NewScanner(cmdmain.Stdin) sc.Scan() return strings.TrimSpace(sc.Text()) }
[ "func", "prompt", "(", "promptText", "string", ")", "string", "{", "fmt", ".", "Fprint", "(", "cmdmain", ".", "Stdout", ",", "promptText", ")", "\n", "sc", ":=", "bufio", ".", "NewScanner", "(", "cmdmain", ".", "Stdin", ")", "\n", "sc", ".", "Scan", ...
// Prompt the user for an input line. Return the given input.
[ "Prompt", "the", "user", "for", "an", "input", "line", ".", "Return", "the", "given", "input", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/cmd/pk/googinit.go#L116-L121
31,620
perkeep/perkeep
pkg/fs/xattr.go
load
func (x *xattr) load(p *search.DescribedPermanode) { x.mu.Lock() defer x.mu.Unlock() *x.xattrs = map[string][]byte{} for k, v := range p.Attr { if strings.HasPrefix(k, xattrPrefix) { name := k[len(xattrPrefix):] val, err := base64.StdEncoding.DecodeString(v[0]) if err != nil { Logger.Printf("Base64 ...
go
func (x *xattr) load(p *search.DescribedPermanode) { x.mu.Lock() defer x.mu.Unlock() *x.xattrs = map[string][]byte{} for k, v := range p.Attr { if strings.HasPrefix(k, xattrPrefix) { name := k[len(xattrPrefix):] val, err := base64.StdEncoding.DecodeString(v[0]) if err != nil { Logger.Printf("Base64 ...
[ "func", "(", "x", "*", "xattr", ")", "load", "(", "p", "*", "search", ".", "DescribedPermanode", ")", "{", "x", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "x", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "*", "x", ".", "xattrs", "=", "m...
// load is invoked after the creation of a fuse.Node that may contain extended // attributes. This creates the node's xattr map as well as fills it with any // extended attributes found in the permanode's claims.
[ "load", "is", "invoked", "after", "the", "creation", "of", "a", "fuse", ".", "Node", "that", "may", "contain", "extended", "attributes", ".", "This", "creates", "the", "node", "s", "xattr", "map", "as", "well", "as", "fills", "it", "with", "any", "extend...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/fs/xattr.go#L58-L74
31,621
perkeep/perkeep
pkg/blobserver/stat.go
StatBlob
func StatBlob(ctx context.Context, bs BlobStatter, br blob.Ref) (blob.SizedRef, error) { var ret blob.SizedRef err := bs.StatBlobs(ctx, []blob.Ref{br}, func(sb blob.SizedRef) error { ret = sb return nil }) if err == nil && !ret.Ref.Valid() { err = os.ErrNotExist } return ret, err }
go
func StatBlob(ctx context.Context, bs BlobStatter, br blob.Ref) (blob.SizedRef, error) { var ret blob.SizedRef err := bs.StatBlobs(ctx, []blob.Ref{br}, func(sb blob.SizedRef) error { ret = sb return nil }) if err == nil && !ret.Ref.Valid() { err = os.ErrNotExist } return ret, err }
[ "func", "StatBlob", "(", "ctx", "context", ".", "Context", ",", "bs", "BlobStatter", ",", "br", "blob", ".", "Ref", ")", "(", "blob", ".", "SizedRef", ",", "error", ")", "{", "var", "ret", "blob", ".", "SizedRef", "\n", "err", ":=", "bs", ".", "Sta...
// StatBlob calls bs.StatBlobs to stat a single blob. // If the blob is not found, the error is os.ErrNotExist.
[ "StatBlob", "calls", "bs", ".", "StatBlobs", "to", "stat", "a", "single", "blob", ".", "If", "the", "blob", "is", "not", "found", "the", "error", "is", "os", ".", "ErrNotExist", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/stat.go#L31-L41
31,622
perkeep/perkeep
pkg/blobserver/stat.go
StatBlobs
func StatBlobs(ctx context.Context, bs BlobStatter, blobs []blob.Ref) (map[blob.Ref]blob.SizedRef, error) { var m map[blob.Ref]blob.SizedRef err := bs.StatBlobs(ctx, blobs, func(sb blob.SizedRef) error { if m == nil { m = make(map[blob.Ref]blob.SizedRef) } m[sb.Ref] = sb return nil }) return m, err }
go
func StatBlobs(ctx context.Context, bs BlobStatter, blobs []blob.Ref) (map[blob.Ref]blob.SizedRef, error) { var m map[blob.Ref]blob.SizedRef err := bs.StatBlobs(ctx, blobs, func(sb blob.SizedRef) error { if m == nil { m = make(map[blob.Ref]blob.SizedRef) } m[sb.Ref] = sb return nil }) return m, err }
[ "func", "StatBlobs", "(", "ctx", "context", ".", "Context", ",", "bs", "BlobStatter", ",", "blobs", "[", "]", "blob", ".", "Ref", ")", "(", "map", "[", "blob", ".", "Ref", "]", "blob", ".", "SizedRef", ",", "error", ")", "{", "var", "m", "map", "...
// StatBlobs stats multiple blobs and returns a map // of the found refs to their sizes.
[ "StatBlobs", "stats", "multiple", "blobs", "and", "returns", "a", "map", "of", "the", "found", "refs", "to", "their", "sizes", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/stat.go#L45-L55
31,623
perkeep/perkeep
website/pk-web/contributors.go
add
func (a *author) add(src *author) { if src == nil { return } a.Emails = append(a.Emails, src.Emails...) a.Names = append(a.Names, src.Names...) a.Commits += src.Commits if src.Role != "" { a.Role = src.Role } if src.URL != "" { a.URL = src.URL } }
go
func (a *author) add(src *author) { if src == nil { return } a.Emails = append(a.Emails, src.Emails...) a.Names = append(a.Names, src.Names...) a.Commits += src.Commits if src.Role != "" { a.Role = src.Role } if src.URL != "" { a.URL = src.URL } }
[ "func", "(", "a", "*", "author", ")", "add", "(", "src", "*", "author", ")", "{", "if", "src", "==", "nil", "{", "return", "\n", "}", "\n", "a", ".", "Emails", "=", "append", "(", "a", ".", "Emails", ",", "src", ".", "Emails", "...", ")", "\n...
// add merges src's fields into a's.
[ "add", "merges", "src", "s", "fields", "into", "a", "s", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/website/pk-web/contributors.go#L45-L58
31,624
perkeep/perkeep
website/pk-web/contributors.go
contribHandler
func contribHandler() http.HandlerFunc { c, err := genContribPage() if err != nil { log.Printf("Couldn't generate contributors page: %v", err) log.Printf("Using static contributors page") return mainHandler } title := "" if m := h1TitlePattern.FindSubmatch(c); len(m) > 1 { title = string(m[1]) } return ...
go
func contribHandler() http.HandlerFunc { c, err := genContribPage() if err != nil { log.Printf("Couldn't generate contributors page: %v", err) log.Printf("Using static contributors page") return mainHandler } title := "" if m := h1TitlePattern.FindSubmatch(c); len(m) > 1 { title = string(m[1]) } return ...
[ "func", "contribHandler", "(", ")", "http", ".", "HandlerFunc", "{", "c", ",", "err", ":=", "genContribPage", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "log", ".", "Printf", "(", ...
// contribHandler returns a handler that serves the generated contributors page, // or the static file handler if it couldn't run git for any reason.
[ "contribHandler", "returns", "a", "handler", "that", "serves", "the", "generated", "contributors", "page", "or", "the", "static", "file", "handler", "if", "it", "couldn", "t", "run", "git", "for", "any", "reason", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/website/pk-web/contributors.go#L184-L202
31,625
perkeep/perkeep
pkg/schema/sign.go
SignJSON
func (s *Signer) SignJSON(ctx context.Context, json string, t time.Time) (string, error) { sr := s.baseSigReq sr.UnsignedJSON = json sr.SignatureTime = t return sr.Sign(ctx) }
go
func (s *Signer) SignJSON(ctx context.Context, json string, t time.Time) (string, error) { sr := s.baseSigReq sr.UnsignedJSON = json sr.SignatureTime = t return sr.Sign(ctx) }
[ "func", "(", "s", "*", "Signer", ")", "SignJSON", "(", "ctx", "context", ".", "Context", ",", "json", "string", ",", "t", "time", ".", "Time", ")", "(", "string", ",", "error", ")", "{", "sr", ":=", "s", ".", "baseSigReq", "\n", "sr", ".", "Unsig...
// SignJSON signs the provided json at the optional time t. // If t is the zero Time, the current time is used.
[ "SignJSON", "signs", "the", "provided", "json", "at", "the", "optional", "time", "t", ".", "If", "t", "is", "the", "zero", "Time", "the", "current", "time", "is", "used", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/sign.go#L120-L125
31,626
perkeep/perkeep
pkg/server/ui.go
InitHandler
func (ui *UIHandler) InitHandler(hl blobserver.FindHandlerByTyper) error { // InitHandler is called after all handlers have been setup, so the bootstrap // of the camliRoot node for publishers in dev-mode is already done. searchPrefix, _, err := hl.FindHandlerByType("search") if err != nil { return errors.New("No...
go
func (ui *UIHandler) InitHandler(hl blobserver.FindHandlerByTyper) error { // InitHandler is called after all handlers have been setup, so the bootstrap // of the camliRoot node for publishers in dev-mode is already done. searchPrefix, _, err := hl.FindHandlerByType("search") if err != nil { return errors.New("No...
[ "func", "(", "ui", "*", "UIHandler", ")", "InitHandler", "(", "hl", "blobserver", ".", "FindHandlerByTyper", ")", "error", "{", "// InitHandler is called after all handlers have been setup, so the bootstrap", "// of the camliRoot node for publishers in dev-mode is already done.", "...
// InitHandler goes through all the other configured handlers to discover // the publisher ones, and uses them to populate ui.publishRoots.
[ "InitHandler", "goes", "through", "all", "the", "other", "configured", "handlers", "to", "discover", "the", "publisher", "ones", "and", "uses", "them", "to", "populate", "ui", ".", "publishRoots", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/ui.go#L253-L322
31,627
perkeep/perkeep
pkg/server/ui.go
ServeStaticFile
func ServeStaticFile(rw http.ResponseWriter, req *http.Request, root http.FileSystem, file string) { f, err := root.Open("/" + file) if err != nil { http.NotFound(rw, req) log.Printf("Failed to open file %q from embedded resources: %v", file, err) return } defer f.Close() var modTime time.Time if fi, err :=...
go
func ServeStaticFile(rw http.ResponseWriter, req *http.Request, root http.FileSystem, file string) { f, err := root.Open("/" + file) if err != nil { http.NotFound(rw, req) log.Printf("Failed to open file %q from embedded resources: %v", file, err) return } defer f.Close() var modTime time.Time if fi, err :=...
[ "func", "ServeStaticFile", "(", "rw", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "root", "http", ".", "FileSystem", ",", "file", "string", ")", "{", "f", ",", "err", ":=", "root", ".", "Open", "(", "\"", "\"", "+", ...
// ServeStaticFile serves file from the root virtual filesystem.
[ "ServeStaticFile", "serves", "file", "from", "the", "root", "virtual", "filesystem", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/ui.go#L488-L506
31,628
perkeep/perkeep
pkg/server/ui.go
serveDepsJS
func serveDepsJS(rw http.ResponseWriter, req *http.Request, dir string) { var root http.FileSystem if dir == "" { root = uistatic.Files } else { root = http.Dir(dir) } b, err := closure.GenDeps(root) if err != nil { log.Print(err) http.Error(rw, "Server error", 500) return } rw.Header().Set("Content-...
go
func serveDepsJS(rw http.ResponseWriter, req *http.Request, dir string) { var root http.FileSystem if dir == "" { root = uistatic.Files } else { root = http.Dir(dir) } b, err := closure.GenDeps(root) if err != nil { log.Print(err) http.Error(rw, "Server error", 500) return } rw.Header().Set("Content-...
[ "func", "serveDepsJS", "(", "rw", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ",", "dir", "string", ")", "{", "var", "root", "http", ".", "FileSystem", "\n", "if", "dir", "==", "\"", "\"", "{", "root", "=", "uistatic", "."...
// serveDepsJS serves an auto-generated Closure deps.js file.
[ "serveDepsJS", "serves", "an", "auto", "-", "generated", "Closure", "deps", ".", "js", "file", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/server/ui.go#L672-L689
31,629
perkeep/perkeep
pkg/sorted/kvfile/kvfile.go
NewStorage
func NewStorage(file string) (sorted.KeyValue, error) { return newKeyValueFromJSONConfig(jsonconfig.Obj{"file": file}) }
go
func NewStorage(file string) (sorted.KeyValue, error) { return newKeyValueFromJSONConfig(jsonconfig.Obj{"file": file}) }
[ "func", "NewStorage", "(", "file", "string", ")", "(", "sorted", ".", "KeyValue", ",", "error", ")", "{", "return", "newKeyValueFromJSONConfig", "(", "jsonconfig", ".", "Obj", "{", "\"", "\"", ":", "file", "}", ")", "\n", "}" ]
// NewStorage is a convenience that calls newKeyValueFromJSONConfig // with file as the kv storage file.
[ "NewStorage", "is", "a", "convenience", "that", "calls", "newKeyValueFromJSONConfig", "with", "file", "as", "the", "kv", "storage", "file", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/sorted/kvfile/kvfile.go#L46-L48
31,630
perkeep/perkeep
pkg/client/upload.go
NewUploadHandleFromString
func NewUploadHandleFromString(data string) *UploadHandle { bref := blob.RefFromString(data) r := strings.NewReader(data) return &UploadHandle{BlobRef: bref, Size: uint32(len(data)), Contents: r} }
go
func NewUploadHandleFromString(data string) *UploadHandle { bref := blob.RefFromString(data) r := strings.NewReader(data) return &UploadHandle{BlobRef: bref, Size: uint32(len(data)), Contents: r} }
[ "func", "NewUploadHandleFromString", "(", "data", "string", ")", "*", "UploadHandle", "{", "bref", ":=", "blob", ".", "RefFromString", "(", "data", ")", "\n", "r", ":=", "strings", ".", "NewReader", "(", "data", ")", "\n", "return", "&", "UploadHandle", "{...
// NewUploadHandleFromString returns an upload handle
[ "NewUploadHandleFromString", "returns", "an", "upload", "handle" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/client/upload.go#L132-L136
31,631
perkeep/perkeep
pkg/client/upload.go
doStat
func (c *Client) doStat(ctx context.Context, blobs []blob.Ref, wait time.Duration, gated bool, fn func(blob.SizedRef) error) error { var buf bytes.Buffer fmt.Fprintf(&buf, "camliversion=1") if wait > 0 { secs := int(wait.Seconds()) if secs == 0 { secs = 1 } fmt.Fprintf(&buf, "&maxwaitsec=%d", secs) } fo...
go
func (c *Client) doStat(ctx context.Context, blobs []blob.Ref, wait time.Duration, gated bool, fn func(blob.SizedRef) error) error { var buf bytes.Buffer fmt.Fprintf(&buf, "camliversion=1") if wait > 0 { secs := int(wait.Seconds()) if secs == 0 { secs = 1 } fmt.Fprintf(&buf, "&maxwaitsec=%d", secs) } fo...
[ "func", "(", "c", "*", "Client", ")", "doStat", "(", "ctx", "context", ".", "Context", ",", "blobs", "[", "]", "blob", ".", "Ref", ",", "wait", "time", ".", "Duration", ",", "gated", "bool", ",", "fn", "func", "(", "blob", ".", "SizedRef", ")", "...
// doStat does an HTTP request for the stat. the number of blobs is used verbatim. No extra splitting // or batching is done at this layer. // The semantics are the same as blobserver.BlobStatter. // gate controls whether it uses httpGate to pause on requests.
[ "doStat", "does", "an", "HTTP", "request", "for", "the", "stat", ".", "the", "number", "of", "blobs", "is", "used", "verbatim", ".", "No", "extra", "splitting", "or", "batching", "is", "done", "at", "this", "layer", ".", "The", "semantics", "are", "the",...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/client/upload.go#L194-L242
31,632
perkeep/perkeep
pkg/client/upload.go
readerAndSize
func (h *UploadHandle) readerAndSize() (io.Reader, int64, error) { if h.Size > 0 { return h.Contents, int64(h.Size), nil } var b bytes.Buffer n, err := io.Copy(&b, h.Contents) if err != nil { return nil, 0, err } return &b, n, nil }
go
func (h *UploadHandle) readerAndSize() (io.Reader, int64, error) { if h.Size > 0 { return h.Contents, int64(h.Size), nil } var b bytes.Buffer n, err := io.Copy(&b, h.Contents) if err != nil { return nil, 0, err } return &b, n, nil }
[ "func", "(", "h", "*", "UploadHandle", ")", "readerAndSize", "(", ")", "(", "io", ".", "Reader", ",", "int64", ",", "error", ")", "{", "if", "h", ".", "Size", ">", "0", "{", "return", "h", ".", "Contents", ",", "int64", "(", "h", ".", "Size", "...
// Figure out the size of the contents. // If the size was provided, trust it.
[ "Figure", "out", "the", "size", "of", "the", "contents", ".", "If", "the", "size", "was", "provided", "trust", "it", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/client/upload.go#L246-L256
31,633
perkeep/perkeep
pkg/search/expr.go
readInternal
func (p *parser) readInternal() *token { for t := range p.tokens { return &t } return &token{tokenEOF, "", -1} }
go
func (p *parser) readInternal() *token { for t := range p.tokens { return &t } return &token{tokenEOF, "", -1} }
[ "func", "(", "p", "*", "parser", ")", "readInternal", "(", ")", "*", "token", "{", "for", "t", ":=", "range", "p", ".", "tokens", "{", "return", "&", "t", "\n", "}", "\n", "return", "&", "token", "{", "tokenEOF", ",", "\"", "\"", ",", "-", "1",...
// ReadInternal should not be called directly, use 'next' or 'peek'
[ "ReadInternal", "should", "not", "be", "called", "directly", "use", "next", "or", "peek" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/expr.go#L109-L114
31,634
perkeep/perkeep
pkg/search/expr.go
atomWords
func (p *parser) atomWords() (a atom, start int, err error) { i := p.peek() start = i.start a = atom{} switch i.typ { case tokenLiteral: err = newParseExpError(noLiteralSupport, *i) return case tokenQuotedLiteral: err = newParseExpError(noQuotedLiteralSupport, *i) return case tokenColon: err = newParse...
go
func (p *parser) atomWords() (a atom, start int, err error) { i := p.peek() start = i.start a = atom{} switch i.typ { case tokenLiteral: err = newParseExpError(noLiteralSupport, *i) return case tokenQuotedLiteral: err = newParseExpError(noQuotedLiteralSupport, *i) return case tokenColon: err = newParse...
[ "func", "(", "p", "*", "parser", ")", "atomWords", "(", ")", "(", "a", "atom", ",", "start", "int", ",", "err", "error", ")", "{", "i", ":=", "p", ".", "peek", "(", ")", "\n", "start", "=", "i", ".", "start", "\n", "a", "=", "atom", "{", "}...
// AtomWords returns the parsed atom, the starting position of this // atom and an error.
[ "AtomWords", "returns", "the", "parsed", "atom", "the", "starting", "position", "of", "this", "atom", "and", "an", "error", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/expr.go#L256-L295
31,635
perkeep/perkeep
pkg/blobserver/mongo/mongo.go
configFromJSON
func configFromJSON(cfg jsonconfig.Obj) (config, error) { conf := config{ server: cfg.OptionalString("host", "localhost"), database: cfg.RequiredString("database"), collection: cfg.OptionalString("collection", "blobs"), user: cfg.OptionalString("user", ""), password: cfg.OptionalString("passwor...
go
func configFromJSON(cfg jsonconfig.Obj) (config, error) { conf := config{ server: cfg.OptionalString("host", "localhost"), database: cfg.RequiredString("database"), collection: cfg.OptionalString("collection", "blobs"), user: cfg.OptionalString("user", ""), password: cfg.OptionalString("passwor...
[ "func", "configFromJSON", "(", "cfg", "jsonconfig", ".", "Obj", ")", "(", "config", ",", "error", ")", "{", "conf", ":=", "config", "{", "server", ":", "cfg", ".", "OptionalString", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "database", ":", "cfg", ...
// ConfigFromJSON populates Config from cfg, and validates // cfg. It returns an error if cfg fails to validate.
[ "ConfigFromJSON", "populates", "Config", "from", "cfg", "and", "validates", "cfg", ".", "It", "returns", "an", "error", "if", "cfg", "fails", "to", "validate", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/mongo/mongo.go#L119-L131
31,636
perkeep/perkeep
server/perkeepd/perkeepd.go
certHostname
func certHostname(listen, baseURL string) (string, error) { hostPort, err := netutil.HostPort(baseURL) if err != nil { hostPort = listen } hostname, _, err := net.SplitHostPort(hostPort) if err != nil { return "", fmt.Errorf("failed to find hostname for cert from address %q: %v", hostPort, err) } return host...
go
func certHostname(listen, baseURL string) (string, error) { hostPort, err := netutil.HostPort(baseURL) if err != nil { hostPort = listen } hostname, _, err := net.SplitHostPort(hostPort) if err != nil { return "", fmt.Errorf("failed to find hostname for cert from address %q: %v", hostPort, err) } return host...
[ "func", "certHostname", "(", "listen", ",", "baseURL", "string", ")", "(", "string", ",", "error", ")", "{", "hostPort", ",", "err", ":=", "netutil", ".", "HostPort", "(", "baseURL", ")", "\n", "if", "err", "!=", "nil", "{", "hostPort", "=", "listen", ...
// certHostname figures out the name to use for the TLS certificates, using baseURL // and falling back to the listen address if baseURL is empty or invalid.
[ "certHostname", "figures", "out", "the", "name", "to", "use", "for", "the", "TLS", "certificates", "using", "baseURL", "and", "falling", "back", "to", "the", "listen", "address", "if", "baseURL", "is", "empty", "or", "invalid", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/server/perkeepd/perkeepd.go#L352-L362
31,637
perkeep/perkeep
server/perkeepd/perkeepd.go
checkGeoKey
func checkGeoKey() error { if _, err := geocode.GetAPIKey(); err == nil { return nil } keyPath, err := geocode.GetAPIKeyPath() if err != nil { return fmt.Errorf("error getting Geocoding API key path: %v", err) } if env.OnGCE() { keyPath = strings.TrimPrefix(keyPath, "/gcs/") return fmt.Errorf("for locatio...
go
func checkGeoKey() error { if _, err := geocode.GetAPIKey(); err == nil { return nil } keyPath, err := geocode.GetAPIKeyPath() if err != nil { return fmt.Errorf("error getting Geocoding API key path: %v", err) } if env.OnGCE() { keyPath = strings.TrimPrefix(keyPath, "/gcs/") return fmt.Errorf("for locatio...
[ "func", "checkGeoKey", "(", ")", "error", "{", "if", "_", ",", "err", ":=", "geocode", ".", "GetAPIKey", "(", ")", ";", "err", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "keyPath", ",", "err", ":=", "geocode", ".", "GetAPIKeyPath", "(", ")...
// checkGeoKey returns nil if we have a Google Geocoding API key file stored // in the config dir. Otherwise it returns instruction about it as the error.
[ "checkGeoKey", "returns", "nil", "if", "we", "have", "a", "Google", "Geocoding", "API", "key", "file", "stored", "in", "the", "config", "dir", ".", "Otherwise", "it", "returns", "instruction", "about", "it", "as", "the", "error", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/server/perkeepd/perkeepd.go#L375-L388
31,638
perkeep/perkeep
pkg/index/util.go
Dup
func (s *dupSkipper) Dup(v string) bool { if s.m == nil { s.m = make(map[string]bool) } if s.m[v] { return true } s.m[v] = true return false }
go
func (s *dupSkipper) Dup(v string) bool { if s.m == nil { s.m = make(map[string]bool) } if s.m[v] { return true } s.m[v] = true return false }
[ "func", "(", "s", "*", "dupSkipper", ")", "Dup", "(", "v", "string", ")", "bool", "{", "if", "s", ".", "m", "==", "nil", "{", "s", ".", "m", "=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "}", "\n", "if", "s", ".", "m", "...
// not thread safe.
[ "not", "thread", "safe", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/util.go#L39-L48
31,639
perkeep/perkeep
pkg/index/util.go
claimPtrsAttrValue
func claimPtrsAttrValue(claims []*camtypes.Claim, attr string, at time.Time, signerFilter SignerRefSet) string { return claimsIntfAttrValue(claimPtrSlice(claims), attr, at, signerFilter) }
go
func claimPtrsAttrValue(claims []*camtypes.Claim, attr string, at time.Time, signerFilter SignerRefSet) string { return claimsIntfAttrValue(claimPtrSlice(claims), attr, at, signerFilter) }
[ "func", "claimPtrsAttrValue", "(", "claims", "[", "]", "*", "camtypes", ".", "Claim", ",", "attr", "string", ",", "at", "time", ".", "Time", ",", "signerFilter", "SignerRefSet", ")", "string", "{", "return", "claimsIntfAttrValue", "(", "claimPtrSlice", "(", ...
// claimPtrsAttrValue returns the value of attr from claims, // or the empty string if not found. // Claims should be sorted by claim.Date.
[ "claimPtrsAttrValue", "returns", "the", "value", "of", "attr", "from", "claims", "or", "the", "empty", "string", "if", "not", "found", ".", "Claims", "should", "be", "sorted", "by", "claim", ".", "Date", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/util.go#L53-L55
31,640
perkeep/perkeep
pkg/index/util.go
claimsIntfAttrValue
func claimsIntfAttrValue(claims claimsIntf, attr string, at time.Time, signerFilter SignerRefSet) string { if claims == nil { panic("nil claims argument in claimsIntfAttrValue") } if at.IsZero() { at = time.Now() } // use a small static buffer as it speeds up // search.BenchmarkQueryPermanodeLocation by 6-7...
go
func claimsIntfAttrValue(claims claimsIntf, attr string, at time.Time, signerFilter SignerRefSet) string { if claims == nil { panic("nil claims argument in claimsIntfAttrValue") } if at.IsZero() { at = time.Now() } // use a small static buffer as it speeds up // search.BenchmarkQueryPermanodeLocation by 6-7...
[ "func", "claimsIntfAttrValue", "(", "claims", "claimsIntf", ",", "attr", "string", ",", "at", "time", ".", "Time", ",", "signerFilter", "SignerRefSet", ")", "string", "{", "if", "claims", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n"...
// claimsIntfAttrValue finds the value of an attribute in a list of claims // or empty string if not found. claims must be non-nil. // If signerFilter contains any refs, a claim is only taken into account if it // has been signed by one of the given signer refs.
[ "claimsIntfAttrValue", "finds", "the", "value", "of", "an", "attribute", "in", "a", "list", "of", "claims", "or", "empty", "string", "if", "not", "found", ".", "claims", "must", "be", "non", "-", "nil", ".", "If", "signerFilter", "contains", "any", "refs",...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/util.go#L76-L127
31,641
perkeep/perkeep
pkg/blobserver/blobhub.go
GetHub
func GetHub(storage interface{}) BlobHub { if h, ok := getHub(storage); ok { return h } hubmu.Lock() defer hubmu.Unlock() h, ok := stohub[storage] if ok { return h } h = new(memHub) stohub[storage] = h return h }
go
func GetHub(storage interface{}) BlobHub { if h, ok := getHub(storage); ok { return h } hubmu.Lock() defer hubmu.Unlock() h, ok := stohub[storage] if ok { return h } h = new(memHub) stohub[storage] = h return h }
[ "func", "GetHub", "(", "storage", "interface", "{", "}", ")", "BlobHub", "{", "if", "h", ",", "ok", ":=", "getHub", "(", "storage", ")", ";", "ok", "{", "return", "h", "\n", "}", "\n", "hubmu", ".", "Lock", "(", ")", "\n", "defer", "hubmu", ".", ...
// GetHub return a BlobHub for the given storage implementation.
[ "GetHub", "return", "a", "BlobHub", "for", "the", "given", "storage", "implementation", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobhub.go#L59-L72
31,642
perkeep/perkeep
pkg/blobserver/blobhub.go
WaitForBlob
func WaitForBlob(storage interface{}, deadline time.Time, blobs []blob.Ref) { hub := GetHub(storage) ch := make(chan blob.Ref, 1) if len(blobs) == 0 { hub.RegisterListener(ch) defer hub.UnregisterListener(ch) } for _, br := range blobs { hub.RegisterBlobListener(br, ch) defer hub.UnregisterBlobListener(br,...
go
func WaitForBlob(storage interface{}, deadline time.Time, blobs []blob.Ref) { hub := GetHub(storage) ch := make(chan blob.Ref, 1) if len(blobs) == 0 { hub.RegisterListener(ch) defer hub.UnregisterListener(ch) } for _, br := range blobs { hub.RegisterBlobListener(br, ch) defer hub.UnregisterBlobListener(br,...
[ "func", "WaitForBlob", "(", "storage", "interface", "{", "}", ",", "deadline", "time", ".", "Time", ",", "blobs", "[", "]", "blob", ".", "Ref", ")", "{", "hub", ":=", "GetHub", "(", "storage", ")", "\n", "ch", ":=", "make", "(", "chan", "blob", "."...
// WaitForBlob waits until deadline for blobs to arrive. If blobs is empty, any // blobs are waited on. Otherwise, those specific blobs are waited on. // When WaitForBlob returns, nothing may have happened.
[ "WaitForBlob", "waits", "until", "deadline", "for", "blobs", "to", "arrive", ".", "If", "blobs", "is", "empty", "any", "blobs", "are", "waited", "on", ".", "Otherwise", "those", "specific", "blobs", "are", "waited", "on", ".", "When", "WaitForBlob", "returns...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/blobhub.go#L87-L111
31,643
perkeep/perkeep
pkg/index/receive.go
indexReadyBlobs
func (ix *Index) indexReadyBlobs(ctx context.Context) { defer ix.reindexWg.Done() ix.RLock() // For tests if ix.oooDisabled { ix.RUnlock() return } ix.RUnlock() failed := make(map[blob.Ref]bool) for { ix.Lock() if len(ix.readyReindex) == 0 { ix.Unlock() return } var br blob.Ref for br = rang...
go
func (ix *Index) indexReadyBlobs(ctx context.Context) { defer ix.reindexWg.Done() ix.RLock() // For tests if ix.oooDisabled { ix.RUnlock() return } ix.RUnlock() failed := make(map[blob.Ref]bool) for { ix.Lock() if len(ix.readyReindex) == 0 { ix.Unlock() return } var br blob.Ref for br = rang...
[ "func", "(", "ix", "*", "Index", ")", "indexReadyBlobs", "(", "ctx", "context", ".", "Context", ")", "{", "defer", "ix", ".", "reindexWg", ".", "Done", "(", ")", "\n", "ix", ".", "RLock", "(", ")", "\n", "// For tests", "if", "ix", ".", "oooDisabled"...
// indexReadyBlobs indexes blobs that have been recently marked as ready to be // reindexed, after the blobs they depend on eventually were indexed.
[ "indexReadyBlobs", "indexes", "blobs", "that", "have", "been", "recently", "marked", "as", "ready", "to", "be", "reindexed", "after", "the", "blobs", "they", "depend", "on", "eventually", "were", "indexed", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L132-L164
31,644
perkeep/perkeep
pkg/index/receive.go
noteBlobIndexed
func (ix *Index) noteBlobIndexed(br blob.Ref) { for _, needer := range ix.neededBy[br] { newNeeds := blobsFilteringOut(ix.needs[needer], br) if len(newNeeds) == 0 { ix.readyReindex[needer] = true delete(ix.needs, needer) ix.reindexWg.Add(1) go ix.indexReadyBlobs(context.Background()) } else { ix.n...
go
func (ix *Index) noteBlobIndexed(br blob.Ref) { for _, needer := range ix.neededBy[br] { newNeeds := blobsFilteringOut(ix.needs[needer], br) if len(newNeeds) == 0 { ix.readyReindex[needer] = true delete(ix.needs, needer) ix.reindexWg.Add(1) go ix.indexReadyBlobs(context.Background()) } else { ix.n...
[ "func", "(", "ix", "*", "Index", ")", "noteBlobIndexed", "(", "br", "blob", ".", "Ref", ")", "{", "for", "_", ",", "needer", ":=", "range", "ix", ".", "neededBy", "[", "br", "]", "{", "newNeeds", ":=", "blobsFilteringOut", "(", "ix", ".", "needs", ...
// noteBlobIndexed checks if the recent indexing of br now allows the blobs that // were depending on br, to be indexed in turn. If yes, they're reindexed // asynchronously by indexReadyBlobs.
[ "noteBlobIndexed", "checks", "if", "the", "recent", "indexing", "of", "br", "now", "allows", "the", "blobs", "that", "were", "depending", "on", "br", "to", "be", "indexed", "in", "turn", ".", "If", "yes", "they", "re", "reindexed", "asynchronously", "by", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L169-L182
31,645
perkeep/perkeep
pkg/index/receive.go
commit
func (ix *Index) commit(mm *mutationMap) error { // We want the update of the deletes cache to be atomic // with the transaction commit, so we lock here instead // of within updateDeletesCache. ix.deletes.Lock() defer ix.deletes.Unlock() bm := ix.s.BeginBatch() for k, v := range mm.kv { bm.Set(k, v) } err :=...
go
func (ix *Index) commit(mm *mutationMap) error { // We want the update of the deletes cache to be atomic // with the transaction commit, so we lock here instead // of within updateDeletesCache. ix.deletes.Lock() defer ix.deletes.Unlock() bm := ix.s.BeginBatch() for k, v := range mm.kv { bm.Set(k, v) } err :=...
[ "func", "(", "ix", "*", "Index", ")", "commit", "(", "mm", "*", "mutationMap", ")", "error", "{", "// We want the update of the deletes cache to be atomic", "// with the transaction commit, so we lock here instead", "// of within updateDeletesCache.", "ix", ".", "deletes", "....
// commit writes the contents of the mutationMap on a batch // mutation and commits that batch. It also updates the deletes // cache.
[ "commit", "writes", "the", "contents", "of", "the", "mutationMap", "on", "a", "batch", "mutation", "and", "commits", "that", "batch", ".", "It", "also", "updates", "the", "deletes", "cache", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L303-L323
31,646
perkeep/perkeep
pkg/index/receive.go
hasErrNotExist
func (tf *trackErrorsFetcher) hasErrNotExist() bool { tf.mu.RLock() defer tf.mu.RUnlock() if len(tf.errs) == 0 { return false } for _, v := range tf.errs { if v != os.ErrNotExist { return false } } return true }
go
func (tf *trackErrorsFetcher) hasErrNotExist() bool { tf.mu.RLock() defer tf.mu.RUnlock() if len(tf.errs) == 0 { return false } for _, v := range tf.errs { if v != os.ErrNotExist { return false } } return true }
[ "func", "(", "tf", "*", "trackErrorsFetcher", ")", "hasErrNotExist", "(", ")", "bool", "{", "tf", ".", "mu", ".", "RLock", "(", ")", "\n", "defer", "tf", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "len", "(", "tf", ".", "errs", ")", "==", ...
// hasErrNotExist reports whether tf recorded any error and if all of them are // os.ErrNotExist errors.
[ "hasErrNotExist", "reports", "whether", "tf", "recorded", "any", "error", "and", "if", "all", "of", "them", "are", "os", ".", "ErrNotExist", "errors", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L423-L435
31,647
perkeep/perkeep
pkg/index/receive.go
readPrefixOrFile
func readPrefixOrFile(prefix []byte, fetcher blob.Fetcher, b *schema.Blob, fn func(filePrefixReader) error) (err error) { pr := bytes.NewReader(prefix) err = fn(pr) if err == io.EOF || err == io.ErrUnexpectedEOF { var fr *schema.FileReader fr, err = b.NewFileReader(fetcher) if err == nil { err = fn(fr) f...
go
func readPrefixOrFile(prefix []byte, fetcher blob.Fetcher, b *schema.Blob, fn func(filePrefixReader) error) (err error) { pr := bytes.NewReader(prefix) err = fn(pr) if err == io.EOF || err == io.ErrUnexpectedEOF { var fr *schema.FileReader fr, err = b.NewFileReader(fetcher) if err == nil { err = fn(fr) f...
[ "func", "readPrefixOrFile", "(", "prefix", "[", "]", "byte", ",", "fetcher", "blob", ".", "Fetcher", ",", "b", "*", "schema", ".", "Blob", ",", "fn", "func", "(", "filePrefixReader", ")", "error", ")", "(", "err", "error", ")", "{", "pr", ":=", "byte...
// readPrefixOrFile executes a given func with a reader on the passed prefix and // falls back to passing a reader on the whole file if the func returns an error.
[ "readPrefixOrFile", "executes", "a", "given", "func", "with", "a", "reader", "on", "the", "passed", "prefix", "and", "falls", "back", "to", "passing", "a", "reader", "on", "the", "whole", "file", "if", "the", "func", "returns", "an", "error", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L445-L457
31,648
perkeep/perkeep
pkg/index/receive.go
indexMusic
func indexMusic(r readerutil.SizeReaderAt, wholeRef blob.Ref, mm *mutationMap) { tag, err := taglib.Decode(r, r.Size()) if err != nil { log.Print("index: error parsing tag: ", err) return } var footerLength int64 = 0 if hasTag, err := media.HasID3v1Tag(r); err != nil { log.Print("index: unable to check for ...
go
func indexMusic(r readerutil.SizeReaderAt, wholeRef blob.Ref, mm *mutationMap) { tag, err := taglib.Decode(r, r.Size()) if err != nil { log.Print("index: error parsing tag: ", err) return } var footerLength int64 = 0 if hasTag, err := media.HasID3v1Tag(r); err != nil { log.Print("index: unable to check for ...
[ "func", "indexMusic", "(", "r", "readerutil", ".", "SizeReaderAt", ",", "wholeRef", "blob", ".", "Ref", ",", "mm", "*", "mutationMap", ")", "{", "tag", ",", "err", ":=", "taglib", ".", "Decode", "(", "r", ",", "r", ".", "Size", "(", ")", ")", "\n",...
// indexMusic adds mutations to index the wholeRef by attached metadata and other properties.
[ "indexMusic", "adds", "mutations", "to", "index", "the", "wholeRef", "by", "attached", "metadata", "and", "other", "properties", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L707-L773
31,649
perkeep/perkeep
pkg/index/receive.go
populateDeleteClaim
func (ix *Index) populateDeleteClaim(ctx context.Context, cl schema.Claim, vr *jsonsign.VerifyRequest, mm *mutationMap) error { br := cl.Blob().BlobRef() target := cl.Target() if !target.Valid() { log.Print(fmt.Errorf("no valid target for delete claim %v", br)) return nil } meta, err := ix.GetBlobMeta(ctx, tar...
go
func (ix *Index) populateDeleteClaim(ctx context.Context, cl schema.Claim, vr *jsonsign.VerifyRequest, mm *mutationMap) error { br := cl.Blob().BlobRef() target := cl.Target() if !target.Valid() { log.Print(fmt.Errorf("no valid target for delete claim %v", br)) return nil } meta, err := ix.GetBlobMeta(ctx, tar...
[ "func", "(", "ix", "*", "Index", ")", "populateDeleteClaim", "(", "ctx", "context", ".", "Context", ",", "cl", "schema", ".", "Claim", ",", "vr", "*", "jsonsign", ".", "VerifyRequest", ",", "mm", "*", "mutationMap", ")", "error", "{", "br", ":=", "cl",...
// populateDeleteClaim adds to mm the entries resulting from the delete claim cl. // It is assumed cl is a valid claim, and vr has already been verified.
[ "populateDeleteClaim", "adds", "to", "mm", "the", "entries", "resulting", "from", "the", "delete", "claim", "cl", ".", "It", "is", "assumed", "cl", "is", "a", "valid", "claim", "and", "vr", "has", "already", "been", "verified", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L811-L846
31,650
perkeep/perkeep
pkg/index/receive.go
updateDeletesCache
func (ix *Index) updateDeletesCache(deleteClaim schema.Claim) error { target := deleteClaim.Target() deleter := deleteClaim.Blob() when, err := deleter.ClaimDate() if err != nil { return fmt.Errorf("Could not get date of delete claim %v: %v", deleteClaim, err) } targetDeletions := append(ix.deletes.m[target], ...
go
func (ix *Index) updateDeletesCache(deleteClaim schema.Claim) error { target := deleteClaim.Target() deleter := deleteClaim.Blob() when, err := deleter.ClaimDate() if err != nil { return fmt.Errorf("Could not get date of delete claim %v: %v", deleteClaim, err) } targetDeletions := append(ix.deletes.m[target], ...
[ "func", "(", "ix", "*", "Index", ")", "updateDeletesCache", "(", "deleteClaim", "schema", ".", "Claim", ")", "error", "{", "target", ":=", "deleteClaim", ".", "Target", "(", ")", "\n", "deleter", ":=", "deleteClaim", ".", "Blob", "(", ")", "\n", "when", ...
// updateDeletesCache updates the index deletes cache with the cl delete claim. // deleteClaim is trusted to be a valid delete Claim.
[ "updateDeletesCache", "updates", "the", "index", "deletes", "cache", "with", "the", "cl", "delete", "claim", ".", "deleteClaim", "is", "trusted", "to", "be", "a", "valid", "delete", "Claim", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/receive.go#L937-L952
31,651
perkeep/perkeep
cmd/pk-devimport/devimport.go
getCredentials
func getCredentials(sh search.QueryDescriber, importerType string) (string, string, error) { var clientID, clientSecret string res, err := sh.Query(context.TODO(), &search.SearchQuery{ Expression: "attr:camliNodeType:importer and attr:importerType:" + importerType, Describe: &search.DescribeRequest{ Depth: 1, ...
go
func getCredentials(sh search.QueryDescriber, importerType string) (string, string, error) { var clientID, clientSecret string res, err := sh.Query(context.TODO(), &search.SearchQuery{ Expression: "attr:camliNodeType:importer and attr:importerType:" + importerType, Describe: &search.DescribeRequest{ Depth: 1, ...
[ "func", "getCredentials", "(", "sh", "search", ".", "QueryDescriber", ",", "importerType", "string", ")", "(", "string", ",", "string", ",", "error", ")", "{", "var", "clientID", ",", "clientSecret", "string", "\n", "res", ",", "err", ":=", "sh", ".", "Q...
// getCredentials returns the OAuth clientID and clientSecret found in the // importer node of the given importerType.
[ "getCredentials", "returns", "the", "OAuth", "clientID", "and", "clientSecret", "found", "in", "the", "importer", "node", "of", "the", "given", "importerType", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/cmd/pk-devimport/devimport.go#L112-L154
31,652
perkeep/perkeep
pkg/schema/filewriter.go
WriteFileFromReaderWithModTime
func WriteFileFromReaderWithModTime(ctx context.Context, bs blobserver.StatReceiver, filename string, modTime time.Time, r io.Reader) (blob.Ref, error) { if strings.Contains(filename, "/") { return blob.Ref{}, fmt.Errorf("schema.WriteFileFromReader: filename %q shouldn't contain a slash", filename) } m := NewFile...
go
func WriteFileFromReaderWithModTime(ctx context.Context, bs blobserver.StatReceiver, filename string, modTime time.Time, r io.Reader) (blob.Ref, error) { if strings.Contains(filename, "/") { return blob.Ref{}, fmt.Errorf("schema.WriteFileFromReader: filename %q shouldn't contain a slash", filename) } m := NewFile...
[ "func", "WriteFileFromReaderWithModTime", "(", "ctx", "context", ".", "Context", ",", "bs", "blobserver", ".", "StatReceiver", ",", "filename", "string", ",", "modTime", "time", ".", "Time", ",", "r", "io", ".", "Reader", ")", "(", "blob", ".", "Ref", ",",...
// WriteFileFromReaderWithModTime creates and uploads a "file" JSON schema // composed of chunks of r, also uploading the chunks. The returned // BlobRef is of the JSON file schema blob. // Both filename and modTime are optional.
[ "WriteFileFromReaderWithModTime", "creates", "and", "uploads", "a", "file", "JSON", "schema", "composed", "of", "chunks", "of", "r", "also", "uploading", "the", "chunks", ".", "The", "returned", "BlobRef", "is", "of", "the", "JSON", "file", "schema", "blob", "...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/filewriter.go#L69-L79
31,653
perkeep/perkeep
pkg/schema/filewriter.go
WriteFileFromReader
func WriteFileFromReader(ctx context.Context, bs blobserver.StatReceiver, filename string, r io.Reader) (blob.Ref, error) { return WriteFileFromReaderWithModTime(ctx, bs, filename, time.Time{}, r) }
go
func WriteFileFromReader(ctx context.Context, bs blobserver.StatReceiver, filename string, r io.Reader) (blob.Ref, error) { return WriteFileFromReaderWithModTime(ctx, bs, filename, time.Time{}, r) }
[ "func", "WriteFileFromReader", "(", "ctx", "context", ".", "Context", ",", "bs", "blobserver", ".", "StatReceiver", ",", "filename", "string", ",", "r", "io", ".", "Reader", ")", "(", "blob", ".", "Ref", ",", "error", ")", "{", "return", "WriteFileFromRead...
// WriteFileFromReader creates and uploads a "file" JSON schema // composed of chunks of r, also uploading the chunks. The returned // BlobRef is of the JSON file schema blob. // The filename is optional.
[ "WriteFileFromReader", "creates", "and", "uploads", "a", "file", "JSON", "schema", "composed", "of", "chunks", "of", "r", "also", "uploading", "the", "chunks", ".", "The", "returned", "BlobRef", "is", "of", "the", "JSON", "file", "schema", "blob", ".", "The"...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/filewriter.go#L85-L87
31,654
perkeep/perkeep
pkg/schema/filewriter.go
WriteFileMap
func WriteFileMap(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) (blob.Ref, error) { return writeFileMapRolling(ctx, bs, file, r) }
go
func WriteFileMap(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) (blob.Ref, error) { return writeFileMapRolling(ctx, bs, file, r) }
[ "func", "WriteFileMap", "(", "ctx", "context", ".", "Context", ",", "bs", "blobserver", ".", "StatReceiver", ",", "file", "*", "Builder", ",", "r", "io", ".", "Reader", ")", "(", "blob", ".", "Ref", ",", "error", ")", "{", "return", "writeFileMapRolling"...
// WriteFileMap uploads chunks of r to bs while populating file and // finally uploading file's Blob. The returned blobref is of file's // JSON blob.
[ "WriteFileMap", "uploads", "chunks", "of", "r", "to", "bs", "while", "populating", "file", "and", "finally", "uploading", "file", "s", "Blob", ".", "The", "returned", "blobref", "is", "of", "file", "s", "JSON", "blob", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/filewriter.go#L92-L94
31,655
perkeep/perkeep
pkg/schema/filewriter.go
Get
func (f *uploadBytesFuture) Get() (blob.Ref, error) { for _, f := range f.children { if _, err := f.Get(); err != nil { return blob.Ref{}, err } } return f.br, <-f.errc }
go
func (f *uploadBytesFuture) Get() (blob.Ref, error) { for _, f := range f.children { if _, err := f.Get(); err != nil { return blob.Ref{}, err } } return f.br, <-f.errc }
[ "func", "(", "f", "*", "uploadBytesFuture", ")", "Get", "(", ")", "(", "blob", ".", "Ref", ",", "error", ")", "{", "for", "_", ",", "f", ":=", "range", "f", ".", "children", "{", "if", "_", ",", "err", ":=", "f", ".", "Get", "(", ")", ";", ...
// Get blocks for all children and returns any final error.
[ "Get", "blocks", "for", "all", "children", "and", "returns", "any", "final", "error", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/filewriter.go#L216-L223
31,656
perkeep/perkeep
pkg/schema/filewriter.go
writeFileMapRolling
func writeFileMapRolling(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) (blob.Ref, error) { n, spans, err := writeFileChunks(ctx, bs, file, r) if err != nil { return blob.Ref{}, err } // The top-level content parts return uploadBytes(ctx, bs, file, n, spans).Get() }
go
func writeFileMapRolling(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) (blob.Ref, error) { n, spans, err := writeFileChunks(ctx, bs, file, r) if err != nil { return blob.Ref{}, err } // The top-level content parts return uploadBytes(ctx, bs, file, n, spans).Get() }
[ "func", "writeFileMapRolling", "(", "ctx", "context", ".", "Context", ",", "bs", "blobserver", ".", "StatReceiver", ",", "file", "*", "Builder", ",", "r", "io", ".", "Reader", ")", "(", "blob", ".", "Ref", ",", "error", ")", "{", "n", ",", "spans", "...
// writeFileMap uploads chunks of r to bs while populating fileMap and // finally uploading fileMap. The returned blobref is of fileMap's // JSON blob. It uses rolling checksum for the chunks sizes.
[ "writeFileMap", "uploads", "chunks", "of", "r", "to", "bs", "while", "populating", "fileMap", "and", "finally", "uploading", "fileMap", ".", "The", "returned", "blobref", "is", "of", "fileMap", "s", "JSON", "blob", ".", "It", "uses", "rolling", "checksum", "...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/filewriter.go#L265-L272
31,657
perkeep/perkeep
pkg/schema/filewriter.go
WriteFileChunks
func WriteFileChunks(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) error { size, spans, err := writeFileChunks(ctx, bs, file, r) if err != nil { return err } parts := []BytesPart{} future := newUploadBytesFuture() addBytesParts(ctx, bs, &parts, spans, future) future.errc <- nil /...
go
func WriteFileChunks(ctx context.Context, bs blobserver.StatReceiver, file *Builder, r io.Reader) error { size, spans, err := writeFileChunks(ctx, bs, file, r) if err != nil { return err } parts := []BytesPart{} future := newUploadBytesFuture() addBytesParts(ctx, bs, &parts, spans, future) future.errc <- nil /...
[ "func", "WriteFileChunks", "(", "ctx", "context", ".", "Context", ",", "bs", "blobserver", ".", "StatReceiver", ",", "file", "*", "Builder", ",", "r", "io", ".", "Reader", ")", "error", "{", "size", ",", "spans", ",", "err", ":=", "writeFileChunks", "(",...
// WriteFileChunks uploads chunks of r to bs while populating file. // It does not upload file.
[ "WriteFileChunks", "uploads", "chunks", "of", "r", "to", "bs", "while", "populating", "file", ".", "It", "does", "not", "upload", "file", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/schema/filewriter.go#L276-L289
31,658
perkeep/perkeep
internal/pools/pools.go
BytesBuffer
func BytesBuffer() *bytes.Buffer { buf := bytesBuffer.Get().(*bytes.Buffer) buf.Reset() return buf }
go
func BytesBuffer() *bytes.Buffer { buf := bytesBuffer.Get().(*bytes.Buffer) buf.Reset() return buf }
[ "func", "BytesBuffer", "(", ")", "*", "bytes", ".", "Buffer", "{", "buf", ":=", "bytesBuffer", ".", "Get", "(", ")", ".", "(", "*", "bytes", ".", "Buffer", ")", "\n", "buf", ".", "Reset", "(", ")", "\n", "return", "buf", "\n", "}" ]
// BytesBuffer returns an empty bytes.Buffer. // It should be returned with PutBuffer.
[ "BytesBuffer", "returns", "an", "empty", "bytes", ".", "Buffer", ".", "It", "should", "be", "returned", "with", "PutBuffer", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/pools/pools.go#L32-L36
31,659
perkeep/perkeep
pkg/auth/auth.go
RegisterAuth
func RegisterAuth(name string, ctor AuthConfigParser) { if _, dup := authConstructor[name]; dup { panic("Dup registration of auth mode " + name) } authConstructor[name] = ctor }
go
func RegisterAuth(name string, ctor AuthConfigParser) { if _, dup := authConstructor[name]; dup { panic("Dup registration of auth mode " + name) } authConstructor[name] = ctor }
[ "func", "RegisterAuth", "(", "name", "string", ",", "ctor", "AuthConfigParser", ")", "{", "if", "_", ",", "dup", ":=", "authConstructor", "[", "name", "]", ";", "dup", "{", "panic", "(", "\"", "\"", "+", "name", ")", "\n", "}", "\n", "authConstructor",...
// RegisterAuth registers a new authentication scheme.
[ "RegisterAuth", "registers", "a", "new", "authentication", "scheme", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L100-L105
31,660
perkeep/perkeep
pkg/auth/auth.go
NewBasicAuth
func NewBasicAuth(username, password string) AuthMode { return &UserPass{ Username: username, Password: password, } }
go
func NewBasicAuth(username, password string) AuthMode { return &UserPass{ Username: username, Password: password, } }
[ "func", "NewBasicAuth", "(", "username", ",", "password", "string", ")", "AuthMode", "{", "return", "&", "UserPass", "{", "Username", ":", "username", ",", "Password", ":", "password", ",", "}", "\n", "}" ]
// NewBasicAuth returns a UserPass Authmode, adequate to support HTTP // basic authentication.
[ "NewBasicAuth", "returns", "a", "UserPass", "Authmode", "adequate", "to", "support", "HTTP", "basic", "authentication", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L157-L162
31,661
perkeep/perkeep
pkg/auth/auth.go
AllowedWithAuth
func AllowedWithAuth(am AuthMode, req *http.Request, op Operation) bool { if op&OpUpload != 0 { // upload (at least from pk-put) requires stat and get too op = op | OpVivify } return am.AllowedAccess(req)&op == op }
go
func AllowedWithAuth(am AuthMode, req *http.Request, op Operation) bool { if op&OpUpload != 0 { // upload (at least from pk-put) requires stat and get too op = op | OpVivify } return am.AllowedAccess(req)&op == op }
[ "func", "AllowedWithAuth", "(", "am", "AuthMode", ",", "req", "*", "http", ".", "Request", ",", "op", "Operation", ")", "bool", "{", "if", "op", "&", "OpUpload", "!=", "0", "{", "// upload (at least from pk-put) requires stat and get too", "op", "=", "op", "|"...
// AllowedWithAuth returns whether the given request // has access to perform all the operations in op // against am.
[ "AllowedWithAuth", "returns", "whether", "the", "given", "request", "has", "access", "to", "perform", "all", "the", "operations", "in", "op", "against", "am", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L341-L347
31,662
perkeep/perkeep
pkg/auth/auth.go
Allowed
func Allowed(req *http.Request, op Operation) bool { for _, m := range modes { if AllowedWithAuth(m, req, op) { return true } } return false }
go
func Allowed(req *http.Request, op Operation) bool { for _, m := range modes { if AllowedWithAuth(m, req, op) { return true } } return false }
[ "func", "Allowed", "(", "req", "*", "http", ".", "Request", ",", "op", "Operation", ")", "bool", "{", "for", "_", ",", "m", ":=", "range", "modes", "{", "if", "AllowedWithAuth", "(", "m", ",", "req", ",", "op", ")", "{", "return", "true", "\n", "...
// Allowed returns whether the given request // has access to perform all the operations in op.
[ "Allowed", "returns", "whether", "the", "given", "request", "has", "access", "to", "perform", "all", "the", "operations", "in", "op", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L351-L358
31,663
perkeep/perkeep
pkg/auth/auth.go
ServeHTTP
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.serveHTTPForOp(w, r, OpAll) }
go
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.serveHTTPForOp(w, r, OpAll) }
[ "func", "(", "h", "Handler", ")", "ServeHTTP", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ")", "{", "h", ".", "serveHTTPForOp", "(", "w", ",", "r", ",", "OpAll", ")", "\n", "}" ]
// ServeHTTP serves only if this request and auth mode are allowed all Operations.
[ "ServeHTTP", "serves", "only", "if", "this", "request", "and", "auth", "mode", "are", "allowed", "all", "Operations", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L418-L420
31,664
perkeep/perkeep
pkg/auth/auth.go
serveHTTPForOp
func (h Handler) serveHTTPForOp(w http.ResponseWriter, r *http.Request, op Operation) { if Allowed(r, op) { h.Handler.ServeHTTP(w, r) } else { SendUnauthorized(w, r) } }
go
func (h Handler) serveHTTPForOp(w http.ResponseWriter, r *http.Request, op Operation) { if Allowed(r, op) { h.Handler.ServeHTTP(w, r) } else { SendUnauthorized(w, r) } }
[ "func", "(", "h", "Handler", ")", "serveHTTPForOp", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "op", "Operation", ")", "{", "if", "Allowed", "(", "r", ",", "op", ")", "{", "h", ".", "Handler", ".", "ServeHT...
// serveHTTPForOp serves only if op is allowed for this request and auth mode.
[ "serveHTTPForOp", "serves", "only", "if", "op", "is", "allowed", "for", "this", "request", "and", "auth", "mode", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L423-L429
31,665
perkeep/perkeep
pkg/auth/auth.go
RequireAuth
func RequireAuth(h http.Handler, op Operation) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { if Allowed(req, op) { h.ServeHTTP(rw, req) } else { SendUnauthorized(rw, req) } }) }
go
func RequireAuth(h http.Handler, op Operation) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { if Allowed(req, op) { h.ServeHTTP(rw, req) } else { SendUnauthorized(rw, req) } }) }
[ "func", "RequireAuth", "(", "h", "http", ".", "Handler", ",", "op", "Operation", ")", "http", ".", "Handler", "{", "return", "http", ".", "HandlerFunc", "(", "func", "(", "rw", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")"...
// RequireAuth wraps a function with another function that enforces // HTTP Basic Auth and checks if the operations in op are all permitted.
[ "RequireAuth", "wraps", "a", "function", "with", "another", "function", "that", "enforces", "HTTP", "Basic", "Auth", "and", "checks", "if", "the", "operations", "in", "op", "are", "all", "permitted", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L433-L441
31,666
perkeep/perkeep
pkg/auth/auth.go
TokenOrNone
func TokenOrNone(token string) (AuthMode, error) { if token == OmitAuthToken { return None{}, nil } return NewTokenAuth(token) }
go
func TokenOrNone(token string) (AuthMode, error) { if token == OmitAuthToken { return None{}, nil } return NewTokenAuth(token) }
[ "func", "TokenOrNone", "(", "token", "string", ")", "(", "AuthMode", ",", "error", ")", "{", "if", "token", "==", "OmitAuthToken", "{", "return", "None", "{", "}", ",", "nil", "\n", "}", "\n", "return", "NewTokenAuth", "(", "token", ")", "\n", "}" ]
// TokenOrNone returns a token auth mode if token is not OmitAuthToken, and // otherwise a None auth mode.
[ "TokenOrNone", "returns", "a", "token", "auth", "mode", "if", "token", "is", "not", "OmitAuthToken", "and", "otherwise", "a", "None", "auth", "mode", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/auth/auth.go#L470-L475
31,667
perkeep/perkeep
pkg/index/corpus.go
blobMatches
func (srs SignerRefSet) blobMatches(br blob.Ref) bool { for _, v := range srs { if br.EqualString(v) { return true } } return false }
go
func (srs SignerRefSet) blobMatches(br blob.Ref) bool { for _, v := range srs { if br.EqualString(v) { return true } } return false }
[ "func", "(", "srs", "SignerRefSet", ")", "blobMatches", "(", "br", "blob", ".", "Ref", ")", "bool", "{", "for", "_", ",", "v", ":=", "range", "srs", "{", "if", "br", ".", "EqualString", "(", "v", ")", "{", "return", "true", "\n", "}", "\n", "}", ...
// blobMatches reports whether br is in the set.
[ "blobMatches", "reports", "whether", "br", "is", "in", "the", "set", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L127-L134
31,668
perkeep/perkeep
pkg/index/corpus.go
cacheAttrClaim
func (m attrValues) cacheAttrClaim(cl *camtypes.Claim) { switch cl.Type { case string(schema.SetAttributeClaim): m[cl.Attr] = []string{cl.Value} case string(schema.AddAttributeClaim): m[cl.Attr] = append(m[cl.Attr], cl.Value) case string(schema.DelAttributeClaim): if cl.Value == "" { delete(m, cl.Attr) }...
go
func (m attrValues) cacheAttrClaim(cl *camtypes.Claim) { switch cl.Type { case string(schema.SetAttributeClaim): m[cl.Attr] = []string{cl.Value} case string(schema.AddAttributeClaim): m[cl.Attr] = append(m[cl.Attr], cl.Value) case string(schema.DelAttributeClaim): if cl.Value == "" { delete(m, cl.Attr) }...
[ "func", "(", "m", "attrValues", ")", "cacheAttrClaim", "(", "cl", "*", "camtypes", ".", "Claim", ")", "{", "switch", "cl", ".", "Type", "{", "case", "string", "(", "schema", ".", "SetAttributeClaim", ")", ":", "m", "[", "cl", ".", "Attr", "]", "=", ...
// cacheAttrClaim applies attribute changes from cl.
[ "cacheAttrClaim", "applies", "attribute", "changes", "from", "cl", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L172-L192
31,669
perkeep/perkeep
pkg/index/corpus.go
restoreInvariants
func (pm *PermanodeMeta) restoreInvariants(signers signerFromBlobrefMap) error { sort.Sort(camtypes.ClaimPtrsByDate(pm.Claims)) pm.attr = make(attrValues) pm.signer = make(map[string]attrValues) for _, cl := range pm.Claims { if err := pm.appendAttrClaim(cl, signers); err != nil { return err } } return nil...
go
func (pm *PermanodeMeta) restoreInvariants(signers signerFromBlobrefMap) error { sort.Sort(camtypes.ClaimPtrsByDate(pm.Claims)) pm.attr = make(attrValues) pm.signer = make(map[string]attrValues) for _, cl := range pm.Claims { if err := pm.appendAttrClaim(cl, signers); err != nil { return err } } return nil...
[ "func", "(", "pm", "*", "PermanodeMeta", ")", "restoreInvariants", "(", "signers", "signerFromBlobrefMap", ")", "error", "{", "sort", ".", "Sort", "(", "camtypes", ".", "ClaimPtrsByDate", "(", "pm", ".", "Claims", ")", ")", "\n", "pm", ".", "attr", "=", ...
// restoreInvariants sorts claims by date and // recalculates latest attributes.
[ "restoreInvariants", "sorts", "claims", "by", "date", "and", "recalculates", "latest", "attributes", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L196-L206
31,670
perkeep/perkeep
pkg/index/corpus.go
fixupLastClaim
func (pm *PermanodeMeta) fixupLastClaim(signers signerFromBlobrefMap) error { if pm.attr != nil { n := len(pm.Claims) if n < 2 || camtypes.ClaimPtrsByDate(pm.Claims).Less(n-2, n-1) { // already sorted, update Attrs from new Claim return pm.appendAttrClaim(pm.Claims[n-1], signers) } } return pm.restoreInv...
go
func (pm *PermanodeMeta) fixupLastClaim(signers signerFromBlobrefMap) error { if pm.attr != nil { n := len(pm.Claims) if n < 2 || camtypes.ClaimPtrsByDate(pm.Claims).Less(n-2, n-1) { // already sorted, update Attrs from new Claim return pm.appendAttrClaim(pm.Claims[n-1], signers) } } return pm.restoreInv...
[ "func", "(", "pm", "*", "PermanodeMeta", ")", "fixupLastClaim", "(", "signers", "signerFromBlobrefMap", ")", "error", "{", "if", "pm", ".", "attr", "!=", "nil", "{", "n", ":=", "len", "(", "pm", ".", "Claims", ")", "\n", "if", "n", "<", "2", "||", ...
// fixupLastClaim fixes invariants on the assumption // that the all but the last element in Claims are sorted by date // and the last element is the only one not yet included in Attrs.
[ "fixupLastClaim", "fixes", "invariants", "on", "the", "assumption", "that", "the", "all", "but", "the", "last", "element", "in", "Claims", "are", "sorted", "by", "date", "and", "the", "last", "element", "is", "the", "only", "one", "not", "yet", "included", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L211-L220
31,671
perkeep/perkeep
pkg/index/corpus.go
initDeletes
func (c *Corpus) initDeletes(s sorted.KeyValue) (err error) { it := queryPrefix(s, keyDeleted) defer closeIterator(it, &err) for it.Next() { cl, ok := kvDeleted(it.Key()) if !ok { return fmt.Errorf("Bogus keyDeleted entry key: want |\"deleted\"|<deleted blobref>|<reverse claimdate>|<deleter claim>|, got %q", ...
go
func (c *Corpus) initDeletes(s sorted.KeyValue) (err error) { it := queryPrefix(s, keyDeleted) defer closeIterator(it, &err) for it.Next() { cl, ok := kvDeleted(it.Key()) if !ok { return fmt.Errorf("Bogus keyDeleted entry key: want |\"deleted\"|<deleted blobref>|<reverse claimdate>|<deleter claim>|, got %q", ...
[ "func", "(", "c", "*", "Corpus", ")", "initDeletes", "(", "s", "sorted", ".", "KeyValue", ")", "(", "err", "error", ")", "{", "it", ":=", "queryPrefix", "(", "s", ",", "keyDeleted", ")", "\n", "defer", "closeIterator", "(", "it", ",", "&", "err", "...
// initDeletes populates the corpus deletes from the delete entries in s.
[ "initDeletes", "populates", "the", "corpus", "deletes", "from", "the", "delete", "entries", "in", "s", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L528-L545
31,672
perkeep/perkeep
pkg/index/corpus.go
updateDeletes
func (c *Corpus) updateDeletes(deleteClaim schema.Claim) error { target := c.br(deleteClaim.Target()) deleter := deleteClaim.Blob() when, err := deleter.ClaimDate() if err != nil { return fmt.Errorf("Could not get date of delete claim %v: %v", deleteClaim, err) } del := deletion{ deleter: c.br(deleter.BlobRef...
go
func (c *Corpus) updateDeletes(deleteClaim schema.Claim) error { target := c.br(deleteClaim.Target()) deleter := deleteClaim.Blob() when, err := deleter.ClaimDate() if err != nil { return fmt.Errorf("Could not get date of delete claim %v: %v", deleteClaim, err) } del := deletion{ deleter: c.br(deleter.BlobRef...
[ "func", "(", "c", "*", "Corpus", ")", "updateDeletes", "(", "deleteClaim", "schema", ".", "Claim", ")", "error", "{", "target", ":=", "c", ".", "br", "(", "deleteClaim", ".", "Target", "(", ")", ")", "\n", "deleter", ":=", "deleteClaim", ".", "Blob", ...
// updateDeletes updates the corpus deletes with the delete claim deleteClaim. // deleteClaim is trusted to be a valid delete Claim.
[ "updateDeletes", "updates", "the", "corpus", "deletes", "with", "the", "delete", "claim", "deleteClaim", ".", "deleteClaim", "is", "trusted", "to", "be", "a", "valid", "delete", "Claim", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L644-L664
31,673
perkeep/perkeep
pkg/index/corpus.go
mergeWholeToFileRow
func (c *Corpus) mergeWholeToFileRow(k, v []byte) error { pair := k[len("wholetofile|"):] pipe := bytes.IndexByte(pair, '|') if pipe < 0 { return fmt.Errorf("bogus row %q = %q", k, v) } wholeRef, ok1 := blob.ParseBytes(pair[:pipe]) fileRef, ok2 := blob.ParseBytes(pair[pipe+1:]) if !ok1 || !ok2 { return fmt.E...
go
func (c *Corpus) mergeWholeToFileRow(k, v []byte) error { pair := k[len("wholetofile|"):] pipe := bytes.IndexByte(pair, '|') if pipe < 0 { return fmt.Errorf("bogus row %q = %q", k, v) } wholeRef, ok1 := blob.ParseBytes(pair[:pipe]) fileRef, ok2 := blob.ParseBytes(pair[pipe+1:]) if !ok1 || !ok2 { return fmt.E...
[ "func", "(", "c", "*", "Corpus", ")", "mergeWholeToFileRow", "(", "k", ",", "v", "[", "]", "byte", ")", "error", "{", "pair", ":=", "k", "[", "len", "(", "\"", "\"", ")", ":", "]", "\n", "pipe", ":=", "bytes", ".", "IndexByte", "(", "pair", ","...
// "wholetofile|sha1-17b53c7c3e664d3613dfdce50ef1f2a09e8f04b5|sha1-fb88f3eab3acfcf3cfc8cd77ae4366f6f975d227" -> "1"
[ "wholetofile|sha1", "-", "17b53c7c3e664d3613dfdce50ef1f2a09e8f04b5|sha1", "-", "fb88f3eab3acfcf3cfc8cd77ae4366f6f975d227", "-", ">", "1" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L854-L872
31,674
perkeep/perkeep
pkg/index/corpus.go
mergeMediaTag
func (c *Corpus) mergeMediaTag(k, v []byte) error { f := strings.Split(string(k), "|") if len(f) != 3 { return fmt.Errorf("unexpected key %q", k) } wholeRef, ok := blob.Parse(f[1]) if !ok { return fmt.Errorf("failed to parse wholeref from key %q", k) } tm, ok := c.mediaTags[wholeRef] if !ok { tm = make(ma...
go
func (c *Corpus) mergeMediaTag(k, v []byte) error { f := strings.Split(string(k), "|") if len(f) != 3 { return fmt.Errorf("unexpected key %q", k) } wholeRef, ok := blob.Parse(f[1]) if !ok { return fmt.Errorf("failed to parse wholeref from key %q", k) } tm, ok := c.mediaTags[wholeRef] if !ok { tm = make(ma...
[ "func", "(", "c", "*", "Corpus", ")", "mergeMediaTag", "(", "k", ",", "v", "[", "]", "byte", ")", "error", "{", "f", ":=", "strings", ".", "Split", "(", "string", "(", "k", ")", ",", "\"", "\"", ")", "\n", "if", "len", "(", "f", ")", "!=", ...
// "mediatag|sha1-2b219be9d9691b4f8090e7ee2690098097f59566|album" = "Some+Album+Name"
[ "mediatag|sha1", "-", "2b219be9d9691b4f8090e7ee2690098097f59566|album", "=", "Some", "+", "Album", "+", "Name" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L875-L891
31,675
perkeep/perkeep
pkg/index/corpus.go
mergeEXIFGPSRow
func (c *Corpus) mergeEXIFGPSRow(k, v []byte) error { wholeRef, ok := blob.ParseBytes(k[len("exifgps|"):]) pipe := bytes.IndexByte(v, '|') if pipe < 0 || !ok { return fmt.Errorf("bogus row %q = %q", k, v) } lat, err := strconv.ParseFloat(string(v[:pipe]), 64) long, err1 := strconv.ParseFloat(string(v[pipe+1:]),...
go
func (c *Corpus) mergeEXIFGPSRow(k, v []byte) error { wholeRef, ok := blob.ParseBytes(k[len("exifgps|"):]) pipe := bytes.IndexByte(v, '|') if pipe < 0 || !ok { return fmt.Errorf("bogus row %q = %q", k, v) } lat, err := strconv.ParseFloat(string(v[:pipe]), 64) long, err1 := strconv.ParseFloat(string(v[pipe+1:]),...
[ "func", "(", "c", "*", "Corpus", ")", "mergeEXIFGPSRow", "(", "k", ",", "v", "[", "]", "byte", ")", "error", "{", "wholeRef", ",", "ok", ":=", "blob", ".", "ParseBytes", "(", "k", "[", "len", "(", "\"", "\"", ")", ":", "]", ")", "\n", "pipe", ...
// "exifgps|sha1-17b53c7c3e664d3613dfdce50ef1f2a09e8f04b5" -> "-122.39897155555556|37.61952208333334"
[ "exifgps|sha1", "-", "17b53c7c3e664d3613dfdce50ef1f2a09e8f04b5", "-", ">", "-", "122", ".", "39897155555556|37", ".", "61952208333334" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L894-L912
31,676
perkeep/perkeep
pkg/index/corpus.go
str
func (c *Corpus) str(s string) string { if s == "" { return "" } if s, ok := c.strs[s]; ok { return s } if c.strs == nil { c.strs = make(map[string]string) } c.strs[s] = s return s }
go
func (c *Corpus) str(s string) string { if s == "" { return "" } if s, ok := c.strs[s]; ok { return s } if c.strs == nil { c.strs = make(map[string]string) } c.strs[s] = s return s }
[ "func", "(", "c", "*", "Corpus", ")", "str", "(", "s", "string", ")", "string", "{", "if", "s", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "s", ",", "ok", ":=", "c", ".", "strs", "[", "s", "]", ";", "ok", "{", "re...
// str returns s, interned.
[ "str", "returns", "s", "interned", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L933-L945
31,677
perkeep/perkeep
pkg/index/corpus.go
br
func (c *Corpus) br(br blob.Ref) blob.Ref { if bm, ok := c.blobs[br]; ok { c.brInterns++ return bm.Ref } return br }
go
func (c *Corpus) br(br blob.Ref) blob.Ref { if bm, ok := c.blobs[br]; ok { c.brInterns++ return bm.Ref } return br }
[ "func", "(", "c", "*", "Corpus", ")", "br", "(", "br", "blob", ".", "Ref", ")", "blob", ".", "Ref", "{", "if", "bm", ",", "ok", ":=", "c", ".", "blobs", "[", "br", "]", ";", "ok", "{", "c", ".", "brInterns", "++", "\n", "return", "bm", ".",...
// br returns br, interned.
[ "br", "returns", "br", "interned", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L948-L954
31,678
perkeep/perkeep
pkg/index/corpus.go
EnumerateBlobMeta
func (c *Corpus) EnumerateBlobMeta(fn func(camtypes.BlobMeta) bool) { for _, bm := range c.blobs { if !fn(*bm) { return } } }
go
func (c *Corpus) EnumerateBlobMeta(fn func(camtypes.BlobMeta) bool) { for _, bm := range c.blobs { if !fn(*bm) { return } } }
[ "func", "(", "c", "*", "Corpus", ")", "EnumerateBlobMeta", "(", "fn", "func", "(", "camtypes", ".", "BlobMeta", ")", "bool", ")", "{", "for", "_", ",", "bm", ":=", "range", "c", ".", "blobs", "{", "if", "!", "fn", "(", "*", "bm", ")", "{", "ret...
// EnumerateBlobMeta calls fn for all known meta blobs in an undefined // order. // If fn returns false, iteration ends.
[ "EnumerateBlobMeta", "calls", "fn", "for", "all", "known", "meta", "blobs", "in", "an", "undefined", "order", ".", "If", "fn", "returns", "false", "iteration", "ends", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L985-L991
31,679
perkeep/perkeep
pkg/index/corpus.go
EnumeratePermanodesLastModified
func (c *Corpus) EnumeratePermanodesLastModified(fn func(camtypes.BlobMeta) bool) { c.enumeratePermanodes(fn, c.permanodesByModtime.sorted(true)) }
go
func (c *Corpus) EnumeratePermanodesLastModified(fn func(camtypes.BlobMeta) bool) { c.enumeratePermanodes(fn, c.permanodesByModtime.sorted(true)) }
[ "func", "(", "c", "*", "Corpus", ")", "EnumeratePermanodesLastModified", "(", "fn", "func", "(", "camtypes", ".", "BlobMeta", ")", "bool", ")", "{", "c", ".", "enumeratePermanodes", "(", "fn", ",", "c", ".", "permanodesByModtime", ".", "sorted", "(", "true...
// EnumeratePermanodesLastModified calls fn for all permanodes, sorted by most recently modified first. // Iteration ends prematurely if fn returns false.
[ "EnumeratePermanodesLastModified", "calls", "fn", "for", "all", "permanodes", "sorted", "by", "most", "recently", "modified", "first", ".", "Iteration", "ends", "prematurely", "if", "fn", "returns", "false", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1094-L1096
31,680
perkeep/perkeep
pkg/index/corpus.go
EnumeratePermanodesCreated
func (c *Corpus) EnumeratePermanodesCreated(fn func(camtypes.BlobMeta) bool, newestFirst bool) { c.enumeratePermanodes(fn, c.permanodesByTime.sorted(newestFirst)) }
go
func (c *Corpus) EnumeratePermanodesCreated(fn func(camtypes.BlobMeta) bool, newestFirst bool) { c.enumeratePermanodes(fn, c.permanodesByTime.sorted(newestFirst)) }
[ "func", "(", "c", "*", "Corpus", ")", "EnumeratePermanodesCreated", "(", "fn", "func", "(", "camtypes", ".", "BlobMeta", ")", "bool", ",", "newestFirst", "bool", ")", "{", "c", ".", "enumeratePermanodes", "(", "fn", ",", "c", ".", "permanodesByTime", ".", ...
// EnumeratePermanodesCreated calls fn for all permanodes. // They are sorted using the contents creation date if any, the permanode modtime // otherwise, and in the order specified by newestFirst. // Iteration ends prematurely if fn returns false.
[ "EnumeratePermanodesCreated", "calls", "fn", "for", "all", "permanodes", ".", "They", "are", "sorted", "using", "the", "contents", "creation", "date", "if", "any", "the", "permanode", "modtime", "otherwise", "and", "in", "the", "order", "specified", "by", "newes...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1102-L1104
31,681
perkeep/perkeep
pkg/index/corpus.go
EnumerateSingleBlob
func (c *Corpus) EnumerateSingleBlob(fn func(camtypes.BlobMeta) bool, br blob.Ref) { if bm := c.blobs[br]; bm != nil { fn(*bm) } }
go
func (c *Corpus) EnumerateSingleBlob(fn func(camtypes.BlobMeta) bool, br blob.Ref) { if bm := c.blobs[br]; bm != nil { fn(*bm) } }
[ "func", "(", "c", "*", "Corpus", ")", "EnumerateSingleBlob", "(", "fn", "func", "(", "camtypes", ".", "BlobMeta", ")", "bool", ",", "br", "blob", ".", "Ref", ")", "{", "if", "bm", ":=", "c", ".", "blobs", "[", "br", "]", ";", "bm", "!=", "nil", ...
// EnumerateSingleBlob calls fn with br's BlobMeta if br exists in the corpus.
[ "EnumerateSingleBlob", "calls", "fn", "with", "br", "s", "BlobMeta", "if", "br", "exists", "in", "the", "corpus", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1107-L1111
31,682
perkeep/perkeep
pkg/index/corpus.go
EnumeratePermanodesByNodeTypes
func (c *Corpus) EnumeratePermanodesByNodeTypes(fn func(camtypes.BlobMeta) bool, camliNodeTypes []string) { for _, t := range camliNodeTypes { set := c.permanodesSetByNodeType[t] for br := range set { if bm := c.blobs[br]; bm != nil { if !fn(*bm) { return } } } } }
go
func (c *Corpus) EnumeratePermanodesByNodeTypes(fn func(camtypes.BlobMeta) bool, camliNodeTypes []string) { for _, t := range camliNodeTypes { set := c.permanodesSetByNodeType[t] for br := range set { if bm := c.blobs[br]; bm != nil { if !fn(*bm) { return } } } } }
[ "func", "(", "c", "*", "Corpus", ")", "EnumeratePermanodesByNodeTypes", "(", "fn", "func", "(", "camtypes", ".", "BlobMeta", ")", "bool", ",", "camliNodeTypes", "[", "]", "string", ")", "{", "for", "_", ",", "t", ":=", "range", "camliNodeTypes", "{", "se...
// EnumeratePermanodesByNodeTypes enumerates over all permanodes that might // have one of the provided camliNodeType values, calling fn for each. If fn returns false, // enumeration ends.
[ "EnumeratePermanodesByNodeTypes", "enumerates", "over", "all", "permanodes", "that", "might", "have", "one", "of", "the", "provided", "camliNodeType", "values", "calling", "fn", "for", "each", ".", "If", "fn", "returns", "false", "enumeration", "ends", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1116-L1127
31,683
perkeep/perkeep
pkg/index/corpus.go
PermanodeTime
func (c *Corpus) PermanodeTime(pn blob.Ref) (t time.Time, ok bool) { // TODO(bradfitz): keep this time property cached on the permanode / files // TODO(bradfitz): finish implmenting all these // Priorities: // -- Permanode explicit "camliTime" property // -- EXIF GPS time // -- Exif camera time - this one is act...
go
func (c *Corpus) PermanodeTime(pn blob.Ref) (t time.Time, ok bool) { // TODO(bradfitz): keep this time property cached on the permanode / files // TODO(bradfitz): finish implmenting all these // Priorities: // -- Permanode explicit "camliTime" property // -- EXIF GPS time // -- Exif camera time - this one is act...
[ "func", "(", "c", "*", "Corpus", ")", "PermanodeTime", "(", "pn", "blob", ".", "Ref", ")", "(", "t", "time", ".", "Time", ",", "ok", "bool", ")", "{", "// TODO(bradfitz): keep this time property cached on the permanode / files", "// TODO(bradfitz): finish implmenting ...
// PermanodeTime returns the time of the content in permanode.
[ "PermanodeTime", "returns", "the", "time", "of", "the", "content", "in", "permanode", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1154-L1199
31,684
perkeep/perkeep
pkg/index/corpus.go
PermanodeAnyTime
func (c *Corpus) PermanodeAnyTime(pn blob.Ref) (t time.Time, ok bool) { if t, ok := c.PermanodeTime(pn); ok { return t, ok } return c.PermanodeModtime(pn) }
go
func (c *Corpus) PermanodeAnyTime(pn blob.Ref) (t time.Time, ok bool) { if t, ok := c.PermanodeTime(pn); ok { return t, ok } return c.PermanodeModtime(pn) }
[ "func", "(", "c", "*", "Corpus", ")", "PermanodeAnyTime", "(", "pn", "blob", ".", "Ref", ")", "(", "t", "time", ".", "Time", ",", "ok", "bool", ")", "{", "if", "t", ",", "ok", ":=", "c", ".", "PermanodeTime", "(", "pn", ")", ";", "ok", "{", "...
// PermanodeAnyTime returns the time that best qualifies the permanode. // It tries content-specific times first, the permanode modtime otherwise.
[ "PermanodeAnyTime", "returns", "the", "time", "that", "best", "qualifies", "the", "permanode", ".", "It", "tries", "content", "-", "specific", "times", "first", "the", "permanode", "modtime", "otherwise", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1203-L1208
31,685
perkeep/perkeep
pkg/index/corpus.go
PermanodeModtime
func (c *Corpus) PermanodeModtime(pn blob.Ref) (t time.Time, ok bool) { pm, ok := c.permanodes[pn] if !ok { return } // Note: We intentionally don't try to derive any information // (except the owner, elsewhere) from the permanode blob // itself. Even though the permanode blob sometimes has the // GPG signatu...
go
func (c *Corpus) PermanodeModtime(pn blob.Ref) (t time.Time, ok bool) { pm, ok := c.permanodes[pn] if !ok { return } // Note: We intentionally don't try to derive any information // (except the owner, elsewhere) from the permanode blob // itself. Even though the permanode blob sometimes has the // GPG signatu...
[ "func", "(", "c", "*", "Corpus", ")", "PermanodeModtime", "(", "pn", "blob", ".", "Ref", ")", "(", "t", "time", ".", "Time", ",", "ok", "bool", ")", "{", "pm", ",", "ok", ":=", "c", ".", "permanodes", "[", "pn", "]", "\n", "if", "!", "ok", "{...
// PermanodeModtime returns the latest modification time of the given // permanode. // // The ok value is true only if the permanode is known and has any // non-deleted claims. A deleted claim is ignored and neither its // claim date nor the date of the delete claim affect the modtime of // the permanode.
[ "PermanodeModtime", "returns", "the", "latest", "modification", "time", "of", "the", "given", "permanode", ".", "The", "ok", "value", "is", "true", "only", "if", "the", "permanode", "is", "known", "and", "has", "any", "non", "-", "deleted", "claims", ".", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1241-L1260
31,686
perkeep/perkeep
pkg/index/corpus.go
ForeachClaim
func (c *Corpus) ForeachClaim(permaNode blob.Ref, at time.Time, fn func(*camtypes.Claim) bool) { pm, ok := c.permanodes[permaNode] if !ok { return } for _, cl := range pm.Claims { if !at.IsZero() && cl.Date.After(at) { continue } if !fn(cl) { return } } }
go
func (c *Corpus) ForeachClaim(permaNode blob.Ref, at time.Time, fn func(*camtypes.Claim) bool) { pm, ok := c.permanodes[permaNode] if !ok { return } for _, cl := range pm.Claims { if !at.IsZero() && cl.Date.After(at) { continue } if !fn(cl) { return } } }
[ "func", "(", "c", "*", "Corpus", ")", "ForeachClaim", "(", "permaNode", "blob", ".", "Ref", ",", "at", "time", ".", "Time", ",", "fn", "func", "(", "*", "camtypes", ".", "Claim", ")", "bool", ")", "{", "pm", ",", "ok", ":=", "c", ".", "permanodes...
// ForeachClaim calls fn for each claim of permaNode. // If at is zero, all claims are yielded. // If at is non-zero, claims after that point are skipped. // If fn returns false, iteration ends. // Iteration is in an undefined order.
[ "ForeachClaim", "calls", "fn", "for", "each", "claim", "of", "permaNode", ".", "If", "at", "is", "zero", "all", "claims", "are", "yielded", ".", "If", "at", "is", "non", "-", "zero", "claims", "after", "that", "point", "are", "skipped", ".", "If", "fn"...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1495-L1508
31,687
perkeep/perkeep
pkg/index/corpus.go
ForeachClaimBack
func (c *Corpus) ForeachClaimBack(value blob.Ref, at time.Time, fn func(*camtypes.Claim) bool) { for _, cl := range c.claimBack[value] { if !at.IsZero() && cl.Date.After(at) { continue } if !fn(cl) { return } } }
go
func (c *Corpus) ForeachClaimBack(value blob.Ref, at time.Time, fn func(*camtypes.Claim) bool) { for _, cl := range c.claimBack[value] { if !at.IsZero() && cl.Date.After(at) { continue } if !fn(cl) { return } } }
[ "func", "(", "c", "*", "Corpus", ")", "ForeachClaimBack", "(", "value", "blob", ".", "Ref", ",", "at", "time", ".", "Time", ",", "fn", "func", "(", "*", "camtypes", ".", "Claim", ")", "bool", ")", "{", "for", "_", ",", "cl", ":=", "range", "c", ...
// ForeachClaimBack calls fn for each claim with a value referencing br. // If at is zero, all claims are yielded. // If at is non-zero, claims after that point are skipped. // If fn returns false, iteration ends. // Iteration is in an undefined order.
[ "ForeachClaimBack", "calls", "fn", "for", "each", "claim", "with", "a", "value", "referencing", "br", ".", "If", "at", "is", "zero", "all", "claims", "are", "yielded", ".", "If", "at", "is", "non", "-", "zero", "claims", "after", "that", "point", "are", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/index/corpus.go#L1515-L1524
31,688
perkeep/perkeep
pkg/blobserver/local/generation.go
ResetStorageGeneration
func (g Generationer) ResetStorageGeneration() error { var buf bytes.Buffer if _, err := io.CopyN(&buf, rand.Reader, 20); err != nil { return err } hex := fmt.Sprintf("%x", buf.Bytes()) buf.Reset() buf.WriteString(hex) buf.WriteString(` This file's random string on the first line is an optimization and parano...
go
func (g Generationer) ResetStorageGeneration() error { var buf bytes.Buffer if _, err := io.CopyN(&buf, rand.Reader, 20); err != nil { return err } hex := fmt.Sprintf("%x", buf.Bytes()) buf.Reset() buf.WriteString(hex) buf.WriteString(` This file's random string on the first line is an optimization and parano...
[ "func", "(", "g", "Generationer", ")", "ResetStorageGeneration", "(", ")", "error", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "if", "_", ",", "err", ":=", "io", ".", "CopyN", "(", "&", "buf", ",", "rand", ".", "Reader", ",", "20", ")", ";", ...
// ResetStorageGeneration reinitializes the generation by recreating the // GENERATION.dat file with a new random string
[ "ResetStorageGeneration", "reinitializes", "the", "generation", "by", "recreating", "the", "GENERATION", ".", "dat", "file", "with", "a", "new", "random", "string" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/blobserver/local/generation.go#L78-L105
31,689
perkeep/perkeep
internal/gpgagent/gpgagent.go
NewConn
func NewConn() (*Conn, error) { sp := strings.SplitN(os.Getenv("GPG_AGENT_INFO"), ":", 3) if len(sp) == 0 || len(sp[0]) == 0 { return nil, ErrNoAgent } addr := &net.UnixAddr{Net: "unix", Name: sp[0]} uc, err := net.DialUnix("unix", nil, addr) if err != nil { return nil, err } br := bufio.NewReader(uc) line...
go
func NewConn() (*Conn, error) { sp := strings.SplitN(os.Getenv("GPG_AGENT_INFO"), ":", 3) if len(sp) == 0 || len(sp[0]) == 0 { return nil, ErrNoAgent } addr := &net.UnixAddr{Net: "unix", Name: sp[0]} uc, err := net.DialUnix("unix", nil, addr) if err != nil { return nil, err } br := bufio.NewReader(uc) line...
[ "func", "NewConn", "(", ")", "(", "*", "Conn", ",", "error", ")", "{", "sp", ":=", "strings", ".", "SplitN", "(", "os", ".", "Getenv", "(", "\"", "\"", ")", ",", "\"", "\"", ",", "3", ")", "\n", "if", "len", "(", "sp", ")", "==", "0", "||",...
// NewConn connects to the GPG Agent as described in the // GPG_AGENT_INFO environment variable.
[ "NewConn", "connects", "to", "the", "GPG", "Agent", "as", "described", "in", "the", "GPG_AGENT_INFO", "environment", "variable", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/internal/gpgagent/gpgagent.go#L49-L69
31,690
perkeep/perkeep
pkg/search/describe.go
Describe
func (sh *Handler) Describe(ctx context.Context, dr *DescribeRequest) (dres *DescribeResponse, err error) { sh.index.RLock() defer sh.index.RUnlock() return sh.DescribeLocked(ctx, dr) }
go
func (sh *Handler) Describe(ctx context.Context, dr *DescribeRequest) (dres *DescribeResponse, err error) { sh.index.RLock() defer sh.index.RUnlock() return sh.DescribeLocked(ctx, dr) }
[ "func", "(", "sh", "*", "Handler", ")", "Describe", "(", "ctx", "context", ".", "Context", ",", "dr", "*", "DescribeRequest", ")", "(", "dres", "*", "DescribeResponse", ",", "err", "error", ")", "{", "sh", ".", "index", ".", "RLock", "(", ")", "\n", ...
// Describe returns a response for the given describe request. It acquires RLock // on the Handler's index.
[ "Describe", "returns", "a", "response", "for", "the", "given", "describe", "request", ".", "It", "acquires", "RLock", "on", "the", "Handler", "s", "index", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L58-L63
31,691
perkeep/perkeep
pkg/search/describe.go
DescribeLocked
func (sh *Handler) DescribeLocked(ctx context.Context, dr *DescribeRequest) (dres *DescribeResponse, err error) { if verboseDescribe { t0 := time.Now() defer func() { td := time.Since(t0) var num int if dres != nil { num = len(dres.Meta) } log.Printf("Described %d blobs in %v", num, td) }() }...
go
func (sh *Handler) DescribeLocked(ctx context.Context, dr *DescribeRequest) (dres *DescribeResponse, err error) { if verboseDescribe { t0 := time.Now() defer func() { td := time.Since(t0) var num int if dres != nil { num = len(dres.Meta) } log.Printf("Described %d blobs in %v", num, td) }() }...
[ "func", "(", "sh", "*", "Handler", ")", "DescribeLocked", "(", "ctx", "context", ".", "Context", ",", "dr", "*", "DescribeRequest", ")", "(", "dres", "*", "DescribeResponse", ",", "err", "error", ")", "{", "if", "verboseDescribe", "{", "t0", ":=", "time"...
// DescribeLocked returns a response for the given describe request. It is the // caller's responsibility to lock the search handler's index.
[ "DescribeLocked", "returns", "a", "response", "for", "the", "given", "describe", "request", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "lock", "the", "search", "handler", "s", "index", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L67-L94
31,692
perkeep/perkeep
pkg/search/describe.go
flatRules
func (dr *DescribeRequest) flatRules() []*DescribeRule { if dr.flatRuleCache == nil { dr.flatRuleCache = make([]*DescribeRule, 0) for _, rule := range dr.Rules { rule.appendToFlatCache(dr) } } return dr.flatRuleCache }
go
func (dr *DescribeRequest) flatRules() []*DescribeRule { if dr.flatRuleCache == nil { dr.flatRuleCache = make([]*DescribeRule, 0) for _, rule := range dr.Rules { rule.appendToFlatCache(dr) } } return dr.flatRuleCache }
[ "func", "(", "dr", "*", "DescribeRequest", ")", "flatRules", "(", ")", "[", "]", "*", "DescribeRule", "{", "if", "dr", ".", "flatRuleCache", "==", "nil", "{", "dr", ".", "flatRuleCache", "=", "make", "(", "[", "]", "*", "DescribeRule", ",", "0", ")",...
// Requires dr.mu is held
[ "Requires", "dr", ".", "mu", "is", "held" ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L146-L154
31,693
perkeep/perkeep
pkg/search/describe.go
URLSuffix
func (dr *DescribeRequest) URLSuffix() string { var buf bytes.Buffer fmt.Fprintf(&buf, "camli/search/describe?depth=%d&maxdirchildren=%d", dr.depth(), dr.maxDirChildren()) for _, br := range dr.BlobRefs { buf.WriteString("&blobref=") buf.WriteString(br.String()) } if len(dr.BlobRefs) == 0 && dr.BlobRef.Valid...
go
func (dr *DescribeRequest) URLSuffix() string { var buf bytes.Buffer fmt.Fprintf(&buf, "camli/search/describe?depth=%d&maxdirchildren=%d", dr.depth(), dr.maxDirChildren()) for _, br := range dr.BlobRefs { buf.WriteString("&blobref=") buf.WriteString(br.String()) } if len(dr.BlobRefs) == 0 && dr.BlobRef.Valid...
[ "func", "(", "dr", "*", "DescribeRequest", ")", "URLSuffix", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "dr", ".", "depth", "(", ")", ",", "dr", ".", "maxDirC...
// URLSuffix returns the URL suffix for GET requests. // This is deprecated.
[ "URLSuffix", "returns", "the", "URL", "suffix", "for", "GET", "requests", ".", "This", "is", "deprecated", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L279-L296
31,694
perkeep/perkeep
pkg/search/describe.go
PermanodeFile
func (b *DescribedBlob) PermanodeFile() (path []blob.Ref, fi *camtypes.FileInfo, ok bool) { if b == nil || b.Permanode == nil { return } if contentRef := b.Permanode.Attr.Get("camliContent"); contentRef != "" { if cdes := b.Request.DescribedBlobStr(contentRef); cdes != nil && cdes.File != nil { return []blob....
go
func (b *DescribedBlob) PermanodeFile() (path []blob.Ref, fi *camtypes.FileInfo, ok bool) { if b == nil || b.Permanode == nil { return } if contentRef := b.Permanode.Attr.Get("camliContent"); contentRef != "" { if cdes := b.Request.DescribedBlobStr(contentRef); cdes != nil && cdes.File != nil { return []blob....
[ "func", "(", "b", "*", "DescribedBlob", ")", "PermanodeFile", "(", ")", "(", "path", "[", "]", "blob", ".", "Ref", ",", "fi", "*", "camtypes", ".", "FileInfo", ",", "ok", "bool", ")", "{", "if", "b", "==", "nil", "||", "b", ".", "Permanode", "=="...
// PermanodeFile returns in path the blobref of the described permanode // and the blobref of its File camliContent. // If b isn't a permanode, or doesn't have a camliContent that // is a file blob, ok is false.
[ "PermanodeFile", "returns", "in", "path", "the", "blobref", "of", "the", "described", "permanode", "and", "the", "blobref", "of", "its", "File", "camliContent", ".", "If", "b", "isn", "t", "a", "permanode", "or", "doesn", "t", "have", "a", "camliContent", ...
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L339-L349
31,695
perkeep/perkeep
pkg/search/describe.go
DescribedBlobStr
func (dr *DescribeRequest) DescribedBlobStr(blobstr string) *DescribedBlob { if dr == nil { return nil } dr.mu.Lock() defer dr.mu.Unlock() return dr.m[blobstr] }
go
func (dr *DescribeRequest) DescribedBlobStr(blobstr string) *DescribedBlob { if dr == nil { return nil } dr.mu.Lock() defer dr.mu.Unlock() return dr.m[blobstr] }
[ "func", "(", "dr", "*", "DescribeRequest", ")", "DescribedBlobStr", "(", "blobstr", "string", ")", "*", "DescribedBlob", "{", "if", "dr", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "dr", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "dr",...
// DescribedBlobStr when given a blobref string returns a Description // or nil. dr may be nil itself.
[ "DescribedBlobStr", "when", "given", "a", "blobref", "string", "returns", "a", "Description", "or", "nil", ".", "dr", "may", "be", "nil", "itself", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L452-L459
31,696
perkeep/perkeep
pkg/search/describe.go
peerBlob
func (b *DescribedBlob) peerBlob(br blob.Ref) *DescribedBlob { if peer, ok := b.Request.m[br.String()]; ok { return peer } return &DescribedBlob{Request: b.Request, BlobRef: br, Stub: true} }
go
func (b *DescribedBlob) peerBlob(br blob.Ref) *DescribedBlob { if peer, ok := b.Request.m[br.String()]; ok { return peer } return &DescribedBlob{Request: b.Request, BlobRef: br, Stub: true} }
[ "func", "(", "b", "*", "DescribedBlob", ")", "peerBlob", "(", "br", "blob", ".", "Ref", ")", "*", "DescribedBlob", "{", "if", "peer", ",", "ok", ":=", "b", ".", "Request", ".", "m", "[", "br", ".", "String", "(", ")", "]", ";", "ok", "{", "retu...
// version of PeerBlob when b.Request.mu is already held.
[ "version", "of", "PeerBlob", "when", "b", ".", "Request", ".", "mu", "is", "already", "held", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L478-L483
31,697
perkeep/perkeep
pkg/search/describe.go
NewDescribeRequest
func (sh *Handler) NewDescribeRequest() *DescribeRequest { dr := new(DescribeRequest) sh.initDescribeRequest(dr) return dr }
go
func (sh *Handler) NewDescribeRequest() *DescribeRequest { dr := new(DescribeRequest) sh.initDescribeRequest(dr) return dr }
[ "func", "(", "sh", "*", "Handler", ")", "NewDescribeRequest", "(", ")", "*", "DescribeRequest", "{", "dr", ":=", "new", "(", "DescribeRequest", ")", "\n", "sh", ".", "initDescribeRequest", "(", "dr", ")", "\n", "return", "dr", "\n", "}" ]
// NewDescribeRequest returns a new DescribeRequest holding the state // of blobs and their summarized descriptions. Use DescribeBlob // one or more times before calling Result.
[ "NewDescribeRequest", "returns", "a", "new", "DescribeRequest", "holding", "the", "state", "of", "blobs", "and", "their", "summarized", "descriptions", ".", "Use", "DescribeBlob", "one", "or", "more", "times", "before", "calling", "Result", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L507-L511
31,698
perkeep/perkeep
pkg/search/describe.go
StartDescribe
func (dr *DescribeRequest) StartDescribe(ctx context.Context, br blob.Ref, depth int) { if depth <= 0 { return } dr.mu.Lock() defer dr.mu.Unlock() if dr.blobDesLock == nil { dr.blobDesLock = make(map[blob.Ref]*sync.Mutex) } desBlobMu, ok := dr.blobDesLock[br] if !ok { desBlobMu = new(sync.Mutex) dr.blob...
go
func (dr *DescribeRequest) StartDescribe(ctx context.Context, br blob.Ref, depth int) { if depth <= 0 { return } dr.mu.Lock() defer dr.mu.Unlock() if dr.blobDesLock == nil { dr.blobDesLock = make(map[blob.Ref]*sync.Mutex) } desBlobMu, ok := dr.blobDesLock[br] if !ok { desBlobMu = new(sync.Mutex) dr.blob...
[ "func", "(", "dr", "*", "DescribeRequest", ")", "StartDescribe", "(", "ctx", "context", ".", "Context", ",", "br", "blob", ".", "Ref", ",", "depth", "int", ")", "{", "if", "depth", "<=", "0", "{", "return", "\n", "}", "\n", "dr", ".", "mu", ".", ...
// StartDescribe starts a lookup of br, down to the provided depth. // It returns immediately. One should call Result to wait for the description to // be completed.
[ "StartDescribe", "starts", "a", "lookup", "of", "br", "down", "to", "the", "provided", "depth", ".", "It", "returns", "immediately", ".", "One", "should", "call", "Result", "to", "wait", "for", "the", "description", "to", "be", "completed", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L597-L626
31,699
perkeep/perkeep
pkg/search/describe.go
newMatches
func (r *DescribeRule) newMatches(br blob.Ref, dr *DescribeRequest) (brs []blob.Ref) { if r.IfResultRoot { if !dr.blobInitiallyRequested(br) { return nil } } if r.parentRule != nil { if _, ok := dr.resFromRule[r.parentRule][br]; !ok { return nil } } db, ok := dr.m[br.String()] if !ok || db.Permanode...
go
func (r *DescribeRule) newMatches(br blob.Ref, dr *DescribeRequest) (brs []blob.Ref) { if r.IfResultRoot { if !dr.blobInitiallyRequested(br) { return nil } } if r.parentRule != nil { if _, ok := dr.resFromRule[r.parentRule][br]; !ok { return nil } } db, ok := dr.m[br.String()] if !ok || db.Permanode...
[ "func", "(", "r", "*", "DescribeRule", ")", "newMatches", "(", "br", "blob", ".", "Ref", ",", "dr", "*", "DescribeRequest", ")", "(", "brs", "[", "]", "blob", ".", "Ref", ")", "{", "if", "r", ".", "IfResultRoot", "{", "if", "!", "dr", ".", "blobI...
// requires dr.mu be held.
[ "requires", "dr", ".", "mu", "be", "held", "." ]
e28bbbd1588d64df8ab7a82393afd39d64c061f7
https://github.com/perkeep/perkeep/blob/e28bbbd1588d64df8ab7a82393afd39d64c061f7/pkg/search/describe.go#L629-L672