id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c177600 |
}
creds.VaultRole, err = readSecretFile("/amazon-vault-role")
if err != nil && !os.IsNotExist(err) {
return nil, err
}
creds.VaultToken, err = readSecretFile("/amazon-vault-token")
if err != nil && !os.IsNotExist(err) {
return nil, err
}
// Get Cloudfront distribution (not required, though we can log a warning)
distribution, err := readSecretFile("/amazon-distribution")
return NewAmazonClient(region, bucket, &creds, distribution, reversed...)
} | |
c177601 | = os.LookupEnv(AmazonVaultAddrEnvVar)
creds.VaultRole, _ = os.LookupEnv(AmazonVaultRoleEnvVar)
creds.VaultToken, _ = os.LookupEnv(AmazonVaultTokenEnvVar)
distribution, _ := os.LookupEnv(AmazonDistributionEnvVar)
return NewAmazonClient(region, bucket, &creds, distribution)
} | |
c177602 | err = NewLocalClient("/" + url.Bucket)
}
switch {
case err != nil:
return nil, err
case c != nil:
return TracingObjClient(url.Store, c), nil
default:
return nil, fmt.Errorf("unrecognized object store: %s", url.Bucket)
}
} | |
c177603 | 1 {
return nil, fmt.Errorf("malformed Azure URI: %v", urlStr)
}
return &ObjectStoreURL{
Store: url.Scheme,
Bucket: parts[0],
Object: strings.Trim(path.Join(parts[1:]...), "/"),
}, nil
}
return nil, fmt.Errorf("unrecognized object store: %s", url.Scheme)
} | |
c177604 | Google:
c, err = NewGoogleClientFromEnv()
case Microsoft:
c, err = NewMicrosoftClientFromEnv()
case Minio:
c, err = NewMinioClientFromEnv()
case Local:
c, err = NewLocalClient(storageRoot)
}
switch {
case err != nil:
return nil, err
case c != nil:
return TracingObjClient(storageBackend, c), nil
default:
return nil, fmt.Errorf("unrecognized storage backend: %s", storageBackend)
}
} | |
c177605 |
config.InitialInterval = 1 * time.Second
config.Multiplier = 2
config.MaxInterval = 15 * time.Minute
return config
} | |
c177606 | defer tracing.FinishAnySpan(span)
return b.reader.Close()
} | |
c177607 | err := b.writer.Close()
if b.client.IsIgnorable(err) {
return nil
}
return err
} | |
c177608 | isNetRetryable(err) || client.IsRetryable(err)
} | |
c177609 | RunIO(IO{Stdin: stdin}, args...)
} | |
c177610 | != nil && len(data) > 0 {
return fmt.Errorf("%s: %s\n%s", strings.Join(args, " "), err.Error(), string(data))
}
return fmt.Errorf("%s: %s", strings.Join(args, " "), err.Error())
}
return nil
} | |
c177611 | &authclient.Groups{},
nil,
nil,
),
groups: col.NewCollection(
env.GetEtcdClient(),
path.Join(etcdPrefix, groupsPrefix),
nil,
&authclient.Users{},
nil,
nil,
),
authConfig: col.NewCollection(
env.GetEtcdClient(),
path.Join(etcdPrefix, configKey),
nil,
&authclient.AuthConfig{},
nil,
nil,
),
public: public,
}
go s.retrieveOrGeneratePPSToken()
go s.watchAdmins(path.Join(etcdPrefix, adminsPrefix))
if public {
// start SAML service (won't respond to
// anything until config is set)
go s.serveSAML()
}
// Watch for new auth config options
go s.watchConfig()
return s, nil
} | |
c177612 | a.isAdmin(ctx, username)
if err != nil {
return err
}
if state != enterpriseclient.State_ACTIVE && !isAdmin {
return errors.New("Pachyderm Enterprise is not active in this " +
"cluster (until Pachyderm Enterprise is re-activated or Pachyderm " +
"auth is deactivated, only cluster admins can perform any operations)")
}
return nil
} | |
c177613 | store new OTP
code = "auth_code:" + uuid.NewWithoutDashes()
if _, err = col.NewSTM(ctx, a.env.GetEtcdClient(), func(stm col.STM) error {
return a.authenticationCodes.ReadWrite(stm).PutTTL(hashToken(code),
otpInfo, defaultAuthCodeTTLSecs)
}); err != nil {
return "", err
}
return code, nil
} | |
c177614 |
return fmt.Sprintf("%x", sum)
} | |
c177615 | len(md[authclient.ContextTokenKey]) == 0 {
return "", authclient.ErrNotSignedIn
}
return md[authclient.ContextTokenKey][0], nil
} | |
c177616 |
return err
}
canonicalizedSubjects[i] = subject
return nil
})
}
if err := eg.Wait(); err != nil {
return nil, err
}
return canonicalizedSubjects, nil
} | |
c177617 | if !r.MatchString(actual) {
fatal(tb, msgAndArgs, "Actual string (%v) does not match pattern (%v)", actual, expectedMatch)
}
} | |
c177618 | {
if r.MatchString(actual) {
return
}
}
fatal(tb, msgAndArgs, "None of actual strings (%v) match pattern (%v)", actuals, expectedMatch)
} | |
c177619 | }
if !reflect.DeepEqual(expected, actual) {
fatal(
tb,
msgAndArgs,
"Not equal: %#v (expected)\n"+
" != %#v (actual)", expected, actual)
}
} | |
c177620 | if reflect.DeepEqual(expected, actual) {
fatal(
tb,
msgAndArgs,
"Equal: %#v (expected)\n"+
" == %#v (actual)", expected, actual)
}
} | |
c177621 | 0; i < sl.Len(); i++ {
if !arePtrs && reflect.DeepEqual(e.Interface(), sl.Index(i).Interface()) {
return true, nil
} else if arePtrs && reflect.DeepEqual(e.Elem().Interface(), sl.Index(i).Elem().Interface()) {
return true, nil
}
}
return false, nil
} | |
c177622 | {
fatal(tb, msgAndArgs,
"Equal : %#v (expected)\n == one of %#v (actuals)", expected, actuals)
}
} | |
c177623 | msgAndArgs, "No error is expected but got %s", err.Error())
}
} | |
c177624 | fatal(tb, msgAndArgs, "No error is expected but got %s", err.Error())
}
case <-time.After(t):
fatal(tb, msgAndArgs, "operation did not finish within %s", t.String())
}
} | |
c177625 | }
}()
select {
case <-doneCh:
case <-time.After(t):
timeout = true
fatal(tb, msgAndArgs, "operation did not finish within %s - last error: %v", t.String(), err)
}
} | |
c177626 |
fatal(tb, msgAndArgs, "Error is expected but got %v", err)
}
} | |
c177627 | <= reflect.Slice && value.IsNil() {
success = false
}
}
if !success {
fatal(tb, msgAndArgs, "Expected value not to be nil.")
}
} | |
c177628 | && kind <= reflect.Slice && value.IsNil() {
return
}
fatal(tb, msgAndArgs, "Expected value to be nil, but was %v", object)
} | |
c177629 | fatal(tb, msgAndArgs, "Should be false.")
}
} | |
c177630 |
return newSTMSerializable(ctx, c, apply, false)
} | |
c177631 | error) error {
_, err := newSTMSerializable(ctx, c, apply, true)
return err
} | |
c177632 | getOpts: []v3.OpOption{v3.WithSerializable()}}
return runSTM(s, apply, false)
} | |
c177633 |
prefetch: make(map[string]*v3.GetResponse),
}
return runSTM(s, apply, dryrun)
} | |
c177634 | getOpts: []v3.OpOption{v3.WithSerializable()}}}
return runSTM(s, apply, true)
} | |
c177635 | nil
return s.stm.commit()
} | |
c177636 | path.Join(etcdPrefix, pipelinesPrefix),
nil,
&pps.EtcdPipelineInfo{},
nil,
nil,
)
} | |
c177637 | []*col.Index{JobsPipelineIndex, JobsOutputIndex},
&pps.EtcdJobInfo{},
nil,
nil,
)
} | |
c177638 |
stop: make(chan struct{}),
}
go t.run()
runtime.SetFinalizer(t, (*Ticker).Stop)
return t
} | |
c177639 | = node.Value
return true
}
return false
}
changed := false
for _, node := range node.Nodes {
changed = nodeToMap(node, out) || changed
}
return changed
} | |
c177640 | },
ObjectMeta: objectMeta(ServiceAccountName, labels(""), nil, opts.Namespace),
}
} | |
c177641 | objectMeta(roleName, labels(""), nil, opts.Namespace),
Rules: rolePolicyRules,
}
} | |
c177642 | "ServiceAccount",
Name: ServiceAccountName,
Namespace: opts.Namespace,
}},
RoleRef: rbacv1.RoleRef{
Kind: "Role",
Name: roleName,
},
}
} | |
c177643 | range obj.EnvVarToSecretKey {
envVars = append(envVars, v1.EnvVar{
Name: envVar,
ValueFrom: &v1.EnvVarSource{
SecretKeyRef: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Name: client.StorageSecretName,
},
Key: secretKey,
Optional: &trueVal,
},
},
})
}
return envVars
} | |
c177644 | {
Port: 600, // also set in cmd/pachd/main.go
Name: "s3gateway-port",
NodePort: 30600,
},
{
Port: 650, // also set in cmd/pachd/main.go
Name: "api-grpc-port",
NodePort: 30650,
},
{
Port: 651, // also set in cmd/pachd/main.go
Name: "trace-port",
NodePort: 30651,
},
{
Port: 652, // also set in cmd/pachd/main.go
Name: "api-http-port",
NodePort: 30652,
},
{
Port: auth.SamlPort,
Name: "saml-port",
NodePort: 30000 + auth.SamlPort,
},
{
Port: githook.GitHookPort,
Name: "api-git-port",
NodePort: githook.NodePort(),
},
},
},
}
} | |
c177645 | "app": pachdName,
},
Ports: []v1.ServicePort{
{
TargetPort: intstr.FromInt(githook.GitHookPort),
Name: "api-git-port",
Port: githook.ExternalPort(),
},
},
},
}
} | |
c177646 | since it's from quay
// not docker hub.
image := etcdImage
if opts.Registry != "" {
image = AddRegistry(opts.Registry, etcdImage)
}
return &apps.Deployment{
TypeMeta: metav1.TypeMeta{
Kind: "Deployment",
APIVersion: "apps/v1beta1",
},
ObjectMeta: objectMeta(etcdName, labels(etcdName), nil, opts.Namespace),
Spec: apps.DeploymentSpec{
Replicas: replicas(1),
Selector: &metav1.LabelSelector{
MatchLabels: labels(etcdName),
},
Template: v1.PodTemplateSpec{
ObjectMeta: objectMeta(etcdName, labels(etcdName), nil, opts.Namespace),
Spec: v1.PodSpec{
Containers: []v1.Container{
{
Name: etcdName,
Image: image,
//TODO figure out how to get a cluster of these to talk to each other
Command: etcdCmd,
Ports: []v1.ContainerPort{
{
ContainerPort: 2379,
Name: "client-port",
},
{
ContainerPort: 2380,
Name: "peer-port",
},
},
VolumeMounts: []v1.VolumeMount{
{
Name: "etcd-storage",
MountPath: "/var/data/etcd",
},
},
ImagePullPolicy: "IfNotPresent",
Resources: resourceRequirements,
},
},
Volumes: volumes,
ImagePullSecrets: imagePullSecrets(opts),
},
},
},
}
} | |
c177647 | "type": "pd-ssd",
}
case amazonBackend:
sc["provisioner"] = "kubernetes.io/aws-ebs"
sc["parameters"] = map[string]string{
"type": "gp2",
}
default:
return nil, nil
}
return sc, nil
} | |
c177648 | name
split := strings.Split(name, "/")
diskName := split[len(split)-1]
spec.Spec.PersistentVolumeSource = v1.PersistentVolumeSource{
AzureDisk: &v1.AzureDiskVolumeSource{
DiskName: diskName,
DataDiskURI: dataDiskURI,
},
}
case minioBackend:
fallthrough
case localBackend:
spec.Spec.PersistentVolumeSource = v1.PersistentVolumeSource{
HostPath: &v1.HostPathVolumeSource{
Path: filepath.Join(hostPath, "etcd"),
},
}
default:
return nil, fmt.Errorf("cannot generate volume spec for unknown backend \"%v\"", persistentDiskBackend)
}
return spec, nil
} | |
c177649 | v1.ServiceTypeNodePort,
Selector: map[string]string{
"app": etcdName,
},
Ports: []v1.ServicePort{
{
Port: 2379,
Name: "client-port",
NodePort: clientNodePort,
},
},
},
}
} | |
c177650 | nil, opts.Namespace),
Spec: v1.ServiceSpec{
Selector: map[string]string{
"app": etcdName,
},
ClusterIP: "None",
Ports: []v1.ServicePort{
{
Name: "peer-port",
Port: 2380,
},
},
},
}
} | |
c177651 | map[string]interface{}{
"imagePullSecrets": imagePullSecrets,
"containers": []interface{}{
map[string]interface{}{
"name": etcdName,
"image": image,
"command": []string{"/bin/sh", "-c"},
"args": []string{strings.Join(etcdCmd, " ")},
// Use the downward API to pass the pod name to etcd. This sets
// the etcd-internal name of each node to its pod name.
"env": []map[string]interface{}{{
"name": "ETCD_NAME",
"valueFrom": map[string]interface{}{
"fieldRef": map[string]interface{}{
"apiVersion": "v1",
"fieldPath": "metadata.name",
},
},
}, {
"name": "NAMESPACE",
"valueFrom": map[string]interface{}{
"fieldRef": map[string]interface{}{
"apiVersion": "v1",
"fieldPath": "metadata.namespace",
},
},
}},
"ports": []interface{}{
map[string]interface{}{
"containerPort": 2379,
"name": "client-port",
},
map[string]interface{}{
"containerPort": 2380,
"name": "peer-port",
},
},
"volumeMounts": []interface{}{
map[string]interface{}{
"name": etcdVolumeClaimName,
"mountPath": "/var/data/etcd",
},
},
"imagePullPolicy": "IfNotPresent",
"resources": map[string]interface{}{
"requests": map[string]interface{}{
string(v1.ResourceCPU): cpu.String(),
string(v1.ResourceMemory): mem.String(),
},
},
},
},
},
},
"volumeClaimTemplates": pvcTemplates,
},
}
} | |
c177652 | Containers: []v1.Container{
{
Name: dashName,
Image: AddRegistry(opts.Registry, opts.DashImage),
Ports: []v1.ContainerPort{
{
ContainerPort: 8080,
Name: "dash-http",
},
},
ImagePullPolicy: "IfNotPresent",
},
{
Name: grpcProxyName,
Image: AddRegistry(opts.Registry, grpcProxyImage),
Ports: []v1.ContainerPort{
{
ContainerPort: 8081,
Name: "grpc-proxy-http",
},
},
ImagePullPolicy: "IfNotPresent",
},
},
ImagePullSecrets: imagePullSecrets(opts),
},
},
},
}
} | |
c177653 | 8080,
Name: "dash-http",
NodePort: 30080,
},
{
Port: 8081,
Name: "grpc-proxy-http",
NodePort: 30081,
},
},
},
}
} | |
c177654 | },
ObjectMeta: objectMeta(client.StorageSecretName, labels(client.StorageSecretName), nil, opts.Namespace),
Data: data,
}
return encoder.Encode(secret)
} | |
c177655 | "google-bucket": []byte(bucket),
"google-cred": []byte(cred),
}
} | |
c177656 | := encoder.Encode(DashService(opts)); err != nil {
return err
}
return encoder.Encode(DashDeployment(opts))
} | |
c177657 | }
if secretErr := WriteSecret(encoder, LocalSecret(), opts); secretErr != nil {
return secretErr
}
return nil
} | |
c177658 | opts, minioBackend, microsoftBackend, volumeSize, ""); err != nil {
return err
}
default:
return fmt.Errorf("Did not recognize the choice of persistent-disk")
}
return WriteSecret(encoder, MinioSecret(args[2], args[3], args[4], args[5], secure, isS3V2), opts)
default:
return fmt.Errorf("Did not recognize the choice of object-store")
}
} | |
c177659 | != "" {
secret = AmazonSecret(region, bucket, creds.ID, creds.Secret, creds.Token, cloudfrontDistro)
} else if creds.VaultAddress != "" {
secret = AmazonVaultSecret(region, bucket, creds.VaultAddress, creds.VaultRole, creds.VaultToken, cloudfrontDistro)
}
return WriteSecret(encoder, secret, opts)
} | |
c177660 | nil {
return err
}
return WriteSecret(encoder, GoogleSecret(bucket, cred), opts)
} | |
c177661 | != nil {
return err
}
return WriteSecret(encoder, MicrosoftSecret(container, id, secret), opts)
} | |
c177662 |
etcdImage,
grpcProxyImage,
pauseImage,
versionedPachdImage(opts),
opts.DashImage,
}
} | |
c177663 | len(parts) == 3 {
parts = parts[1:]
}
return path.Join(registry, parts[0], parts[1])
} | |
c177664 | } else if b.RandomizationFactor > 1 {
b.RandomizationFactor = 1
}
return b
} | |
c177665 | = b.InitialInterval
b.startTime = b.Clock.Now()
} | |
c177666 | b.currentInterval = b.MaxInterval
} else {
b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier)
}
} | |
c177667 |
return blockAPIServer, nil
case MicrosoftBackendEnvVar:
blockAPIServer, err := newMicrosoftBlockAPIServer(dir, cacheBytes, etcdAddress)
if err != nil {
return nil, err
}
return blockAPIServer, nil
case LocalBackendEnvVar:
fallthrough
default:
blockAPIServer, err := newLocalBlockAPIServer(dir, cacheBytes, etcdAddress)
if err != nil {
return nil, err
}
return blockAPIServer, nil
}
} | |
c177668 | err)
objC, err := obj.NewLocalClient(wd)
require.NoError(tb, err)
return objC, NewStorage(objC, Prefix)
} | |
c177669 |
if pipelinePtr.JobCounts[int32(jobPtr.State)] != 0 {
pipelinePtr.JobCounts[int32(jobPtr.State)]--
}
return nil
}); err != nil {
return err
}
return a.jobs.ReadWrite(stm).Delete(jobPtr.Job.ID)
} | |
c177670 | a message since a response has already been partially
// written
requestLogger(r).Errorf("could not encode xml response: %v", err)
}
} | |
c177671 |
}
return default1_7HashtreeRoot(pathlib.Clean(p))
} | |
c177672 | addr: addr,
caCerts: settings.caCerts,
limiter: limit.New(settings.maxConcurrentStreams),
}
if err := c.connect(settings.dialTimeout); err != nil {
return nil, err
}
return c, nil
} | |
c177673 | from global config if possible
if cfg != nil && cfg.V1 != nil && cfg.V1.PachdAddress != "" {
// Also get cert info from config (if set)
if cfg.V1.ServerCAs != "" {
pemBytes, err := base64.StdEncoding.DecodeString(cfg.V1.ServerCAs)
if err != nil {
return "", nil, fmt.Errorf("could not decode server CA certs in config: %v", err)
}
return cfg.V1.PachdAddress, []Option{WithAdditionalRootCAs(pemBytes)}, nil
}
return cfg.V1.PachdAddress, nil, nil
}
// 3) Use default address (broadcast) if nothing else works
options, err := getCertOptionsFromEnv()
if err != nil {
return "", nil, err
}
return "", options, nil
} | |
c177674 | set")
}
port, ok := os.LookupEnv("PACHD_SERVICE_PORT")
if !ok {
return nil, fmt.Errorf("PACHD_SERVICE_PORT not set")
}
// create new pachctl client
return NewFromAddress(fmt.Sprintf("%s:%s", host, port), options...)
} | |
c177675 | }
if c.portForwarder != nil {
c.portForwarder.Close()
}
return nil
} | |
c177676 | nil {
return grpcutil.ScrubGRPC(err)
}
if _, err := c.PfsAPIClient.DeleteAll(
c.Ctx(),
&types.Empty{},
); err != nil {
return grpcutil.ScrubGRPC(err)
}
return nil
} | |
c177677 | int) {
c.limiter = limit.New(n)
} | |
c177678 | *APIClient {
result := *c // copy c
result.ctx = ctx
return &result
} | |
c177679 | DLock {
return &etcdImpl{
client: client,
prefix: prefix,
}
} | |
c177680 | hash.Write(d.FileInfo.Hash)
}
// InputFileID is a single string id for the data from this input, it's used in logs and in
// the statsTree
return hex.EncodeToString(hash.Sum(nil))
} | |
c177681 | }
cmd.Dir = a.pipelineInfo.Transform.WorkingDir
err := cmd.Start()
if err != nil {
return fmt.Errorf("error cmd.Start: %v", err)
}
// A context w a deadline will successfully cancel/kill
// the running process (minus zombies)
state, err := cmd.Process.Wait()
if err != nil {
return fmt.Errorf("error cmd.Wait: %v", err)
}
if isDone(ctx) {
if err = ctx.Err(); err != nil {
return err
}
}
// Because of this issue: https://github.com/golang/go/issues/18874
// We forked os/exec so that we can call just the part of cmd.Wait() that
// happens after blocking on the process. Unfortunately calling
// cmd.Process.Wait() then cmd.Wait() will produce an error. So instead we
// close the IO using this helper
err = cmd.WaitIO(state, err)
// We ignore broken pipe errors, these occur very occasionally if a user
// specifies Stdin but their process doesn't actually read everything from
// Stdin. This is a fairly common thing to do, bash by default ignores
// broken pipe errors.
if err != nil && !strings.Contains(err.Error(), "broken pipe") {
// (if err is an acceptable return code, don't return err)
if exiterr, ok := err.(*exec.ExitError); ok {
if status, ok := exiterr.Sys().(syscall.WaitStatus); ok {
for _, returnCode := range a.pipelineInfo.Transform.AcceptReturnCode {
if int(returnCode) == status.ExitStatus() {
return nil
}
}
}
}
return fmt.Errorf("error cmd.WaitIO: %v", err)
}
return nil
} | |
c177682 |
hash.Write([]byte(pipelineName))
hash.Write([]byte(pipelineSalt))
return client.DatumTagPrefix(pipelineSalt) + hex.EncodeToString(hash.Sum(nil))
} | |
c177683 | hash.Write(bytes)
hash.Write([]byte(pipelineInfo.Pipeline.Name))
hash.Write([]byte(pipelineInfo.ID))
hash.Write([]byte(strconv.Itoa(int(pipelineInfo.Version))))
// Note in 1.5.0 this function was called HashPipelineID, it's now called
// HashPipelineName but it has the same implementation.
return client.DatumTagPrefix(pipelineInfo.ID) + hex.EncodeToString(hash.Sum(nil)), nil
} | |
c177684 | JobID: a.jobID,
WorkerID: a.workerName,
Started: started,
Data: a.datum(),
QueueSize: atomic.LoadInt64(&a.queueSize),
}
return result, nil
} | |
c177685 | a.cancel()
// clear the status since we're no longer processing this datum
a.jobID = ""
a.data = nil
a.started = time.Time{}
a.cancel = nil
return &CancelResponse{Success: true}, nil
} | |
c177686 | = plusDuration(x.UploadTime, y.UploadTime); err != nil {
return err
}
x.DownloadBytes += y.DownloadBytes
x.UploadBytes += y.UploadBytes
return nil
} | |
c177687 | }
}
if err := a.chunkCache.Put(high, buf); err != nil {
return err
}
if a.pipelineInfo.EnableStats {
buf.Reset()
if err := a.datumStatsCache.Merge(hashtree.NewWriter(buf), nil, nil); err != nil {
return err
}
return a.chunkStatsCache.Put(high, buf)
}
return nil
} | |
c177688 |
return false
}
return commitNotFoundRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | |
c177689 |
return false
}
return commitDeletedRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | |
c177690 |
return false
}
return commitFinishedRe.MatchString(grpcutil.ScrubGRPC(err).Error())
} | |
c177691 | return repoNotFoundRe.MatchString(err.Error())
} | |
c177692 | return branchNotFoundRe.MatchString(err.Error())
} | |
c177693 | return fileNotFoundRe.MatchString(err.Error())
} | |
c177694 | return "", grpcutil.ScrubGRPC(err)
}
return version.PrettyPrintVersion(v), nil
} | |
c177695 | (%v) invalid: only alphanumeric characters, underscores, and dashes are allowed", name)
}
return nil
} | |
c177696 | return pfsdb.Commits(etcdClient, etcdPrefix, repo)
},
branches: func(repo string) col.Collection {
return pfsdb.Branches(etcdClient, etcdPrefix, repo)
},
openCommits: pfsdb.OpenCommits(etcdClient, etcdPrefix),
treeCache: treeCache,
storageRoot: storageRoot,
// Allow up to a third of the requested memory to be used for memory intensive operations
memoryLimiter: semaphore.NewWeighted(memoryRequest / 3),
}
// Create spec repo (default repo)
repo := client.NewRepo(ppsconsts.SpecRepo)
repoInfo := &pfs.RepoInfo{
Repo: repo,
Created: now(),
}
if _, err := col.NewSTM(context.Background(), etcdClient, func(stm col.STM) error {
repos := d.repos.ReadWrite(stm)
return repos.Create(repo.Name, repoInfo)
}); err != nil && !col.IsErrExists(err) {
return nil, err
}
return d, nil
} | |
c177697 |
return err
}
defer commitInfoWatcher.Close()
for {
var commitID string
_commitInfo := new(pfs.CommitInfo)
event := <-commitInfoWatcher.Watch()
switch event.Type {
case watch.EventError:
return event.Err
case watch.EventPut:
if err := event.Unmarshal(&commitID, _commitInfo); err != nil {
return fmt.Errorf("Unmarshal: %v", err)
}
case watch.EventDelete:
return pfsserver.ErrCommitDeleted{commit}
}
if _commitInfo.Finished != nil {
commitInfo = _commitInfo
break
}
}
return nil
}(); err != nil {
return nil, err
}
}
return commitInfo, nil
} | |
c177698 | is changed, filepathFromEtcdPath will also
// need to change.
return path.Join(commit.Repo.Name, commit.ID)
} | |
c177699 | path.Join(d.scratchCommitPrefix(file.Commit), file.Path), nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.