// ReplicationStat returns the statistics of repliaciton.
176680
func (l *Ledis) ReplicationStat() (*rpl.Stat, error) {
	if !l.ReplicationUsed() {
		return nil, ErrRplNotSupport
	}

	return l.r.Stat()
}
1089729
func SlaveStatusToProto(s SlaveStatus) *replicationdatapb.Status {
	return &replicationdatapb.Status{
		Position:            EncodePosition(s.Position),
		SlaveIoRunning:      s.SlaveIORunning,
		SlaveSqlRunning:     s.SlaveSQLRunning,
		SecondsBehindMaster: uint32(s.SecondsBehindMaster),
		MasterHost:          s.MasterHost,
		MasterPort:          int32(s.MasterPort),
		MasterConnectRetry:  int32(s.MasterConnectRetry),
	}
}
249100
func (k *SimpleFS) SimpleFSSetStat(ctx context.Context, arg keybase1.SimpleFSSetStatArg) (err error) {
	ctx, err = k.startSyncOp(ctx, "SetStat", arg)
	if err != nil {
		return err
	}
	defer func() { k.doneSyncOp(ctx, err) }()

	fs, finalElem, err := k.getFS(ctx, arg.Dest)
	if err != nil {
		return err
	}
	fi, err := fs.Stat(finalElem)
	if err != nil {
		return err
	}

	mode := fi.Mode()
	const exec = 0100
	switch arg.Flag {
	case keybase1.DirentType_EXEC:
		mode |= 0100
	case keybase1.DirentType_FILE:
		mode &= 0677
	default:
		return nil
	}

	changeFS, ok := fs.(billy.Change)
	if !ok {
		panic(fmt.Sprintf("Unexpected non-Change FS: %T", fs))
	}

	return changeFS.Chmod(finalElem, mode)
}
546881
func (sr *ServicedStatsReporter) updateStats() {
	// Stats for host.
	sr.updateHostStats()
	// Stats for the containers.
	states, err := zkservice.GetHostStates(sr.conn, "", sr.hostID)
	if err != nil {
		plog.WithFields(logrus.Fields{
			"conn":   sr.conn,
			"hostID": sr.hostID,
		}).WithError(err).Error("Could not get host states from Zookeeper")
	}

	for _, rs := range states {
		if rs.ContainerID != "" {

			containerRegistry := sr.getOrCreateContainerRegistry(rs.ServiceID, rs.InstanceID)
			stats, err := sr.docker.GetContainerStats(rs.ContainerID, 30*time.Second)
			if err != nil || stats == nil { //stats may be nil if service is shutting down
				plog.WithFields(logrus.Fields{
					"serviceID":  rs.ServiceID,
					"instanceID": rs.InstanceID,
				}).WithError(err).Warn("Couldn't get stats from docker")
				continue
			}

			// Check to see if we have the previous stats for this running instance
			usePreviousStats := true
			key := rs.ContainerID
			if _, found := sr.previousStats[key]; !found {
				sr.previousStats[key] = make(map[string]uint64)
				usePreviousStats = false
			}

			// CPU Stats
			// TODO: Consolidate this into a single object that both ISVCS and non-ISVCS can use
			var (
				kernelCPUPercent float64
				userCPUPercent   float64
				totalCPUChange   uint64
			)

			kernelCPU := stats.CPUStats.CPUUsage.UsageInKernelmode
			userCPU := stats.CPUStats.CPUUsage.UsageInUsermode
			totalCPU := stats.CPUStats.SystemCPUUsage

			// Total CPU Cycles
			previousTotalCPU, found := sr.previousStats[key]["totalCPU"]
			if found {
				if totalCPU <= previousTotalCPU {
					plog.WithFields(logrus.Fields{
						"totalCPU":         totalCPU,
						"previousTotalCPU": previousTotalCPU,
					}).Debug("Change in total CPU usage was nonpositive, skipping CPU stats update")
					usePreviousStats = false
				} else {
					totalCPUChange = totalCPU - previousTotalCPU
				}
			} else {
				usePreviousStats = false
			}
			sr.previousStats[key]["totalCPU"] = totalCPU

			// CPU Cycles in Kernel mode
			if previousKernelCPU, found := sr.previousStats[key]["kernelCPU"]; found && usePreviousStats {
				kernelCPUChange := kernelCPU - previousKernelCPU
				kernelCPUPercent = (float64(kernelCPUChange) / float64(totalCPUChange)) * float64(len(stats.CPUStats.CPUUsage.PercpuUsage)) * 100.0
			} else {
				usePreviousStats = false
			}
			sr.previousStats[key]["kernelCPU"] = kernelCPU

			// CPU Cycles in User mode
			if previousUserCPU, found := sr.previousStats[key]["userCPU"]; found && usePreviousStats {
				userCPUChange := userCPU - previousUserCPU
				userCPUPercent = (float64(userCPUChange) / float64(totalCPUChange)) * float64(len(stats.CPUStats.CPUUsage.PercpuUsage)) * 100.0
			} else {
				usePreviousStats = false
			}
			sr.previousStats[key]["userCPU"] = userCPU

			// Update CPU metrics
			if usePreviousStats {
				metrics.GetOrRegisterGaugeFloat64("docker.usageinkernelmode", containerRegistry).Update(kernelCPUPercent)
				metrics.GetOrRegisterGaugeFloat64("docker.usageinusermode", containerRegistry).Update(userCPUPercent)
			} else {
				plog.WithFields(logrus.Fields{
					"serviceID":  rs.ServiceID,
					"instanceID": rs.InstanceID,
				}).Debug("Skipping CPU stats, no previous values to compare to")
			}

			// Memory Stats
			pgFault := int64(stats.MemoryStats.Stats.Pgfault)
			totalRSS := int64(stats.MemoryStats.Stats.TotalRss)
			cache := int64(stats.MemoryStats.Stats.Cache)
			if pgFault < 0 || totalRSS < 0 || cache < 0 {
				plog.WithFields(logrus.Fields{
					"serviceID":  rs.ServiceID,
					"instanceID": rs.InstanceID,
				}).Debug("Memory metric value too big for int64")
			}
			metrics.GetOrRegisterGauge("cgroup.memory.pgmajfault", containerRegistry).Update(pgFault)
			metrics.GetOrRegisterGauge("cgroup.memory.totalrss", containerRegistry).Update(totalRSS)
			metrics.GetOrRegisterGauge("cgroup.memory.cache", containerRegistry).Update(cache)

		} else {
			plog.WithFields(logrus.Fields{
				"serviceID":  rs.ServiceID,
				"instanceID": rs.InstanceID,
			}).Debug("Skipping stats update, no container ID exists")
		}
	}
	// Clean out old container registries
	sr.removeStaleRegistries(states)
}
528036
func (a *HorizontalController) computeStatusForObjectMetric(currentReplicas int32, metricSpec autoscalingv2.MetricSpec, hpa *autoscalingv2.HorizontalPodAutoscaler, selector labels.Selector, status *autoscalingv2.MetricStatus, metricSelector labels.Selector) (int32, time.Time, string, error) {
	if metricSpec.Object.Target.Type == autoscalingv2.ValueMetricType {
		replicaCountProposal, utilizationProposal, timestampProposal, err := a.replicaCalc.GetObjectMetricReplicas(currentReplicas, metricSpec.Object.Target.Value.MilliValue(), metricSpec.Object.Metric.Name, hpa.Namespace, &metricSpec.Object.DescribedObject, selector, metricSelector)
		if err != nil {
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetObjectMetric", err.Error())
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetObjectMetric", "the HPA was unable to compute the replica count: %v", err)
			return 0, timestampProposal, "", err
		}
		*status = autoscalingv2.MetricStatus{
			Type: autoscalingv2.ObjectMetricSourceType,
			Object: &autoscalingv2.ObjectMetricStatus{
				DescribedObject: metricSpec.Object.DescribedObject,
				Metric: autoscalingv2.MetricIdentifier{
					Name:     metricSpec.Object.Metric.Name,
					Selector: metricSpec.Object.Metric.Selector,
				},
				Current: autoscalingv2.MetricValueStatus{
					Value: resource.NewMilliQuantity(utilizationProposal, resource.DecimalSI),
				},
			},
		}
		return replicaCountProposal, timestampProposal, fmt.Sprintf("%s metric %s", metricSpec.Object.DescribedObject.Kind, metricSpec.Object.Metric.Name), nil
	} else if metricSpec.Object.Target.Type == autoscalingv2.AverageValueMetricType {
		replicaCountProposal, utilizationProposal, timestampProposal, err := a.replicaCalc.GetObjectPerPodMetricReplicas(currentReplicas, metricSpec.Object.Target.AverageValue.MilliValue(), metricSpec.Object.Metric.Name, hpa.Namespace, &metricSpec.Object.DescribedObject, metricSelector)
		if err != nil {
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetObjectMetric", err.Error())
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetObjectMetric", "the HPA was unable to compute the replica count: %v", err)
			return 0, time.Time{}, "", fmt.Errorf("failed to get %s object metric: %v", metricSpec.Object.Metric.Name, err)
		}
		*status = autoscalingv2.MetricStatus{
			Type: autoscalingv2.ObjectMetricSourceType,
			Object: &autoscalingv2.ObjectMetricStatus{
				Metric: autoscalingv2.MetricIdentifier{
					Name:     metricSpec.Object.Metric.Name,
					Selector: metricSpec.Object.Metric.Selector,
				},
				Current: autoscalingv2.MetricValueStatus{
					AverageValue: resource.NewMilliQuantity(utilizationProposal, resource.DecimalSI),
				},
			},
		}
		return replicaCountProposal, timestampProposal, fmt.Sprintf("external metric %s(%+v)", metricSpec.Object.Metric.Name, metricSpec.Object.Metric.Selector), nil
	}
	errMsg := "invalid object metric source: neither a value target nor an average value target was set"
	a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetObjectMetric", errMsg)
	setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetObjectMetric", "the HPA was unable to compute the replica count: %s", errMsg)
	return 0, time.Time{}, "", fmt.Errorf(errMsg)
}
642793
func ValidateReplicationControllerStatusUpdate(controller, oldController *api.ReplicationController) validation.ErrorList {
	allErrs := validation.ErrorList{}
	allErrs = append(allErrs, ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta, validation.NewFieldPath("metadata"))...)
	statusPath := validation.NewFieldPath("status")
	allErrs = append(allErrs, ValidatePositiveField(int64(controller.Status.Replicas), statusPath.Child("replicas"))...)
	allErrs = append(allErrs, ValidatePositiveField(int64(controller.Status.ObservedGeneration), statusPath.Child("observedGeneration"))...)
	return allErrs
}
90400
func (t *Store) ReplicationTokenAndSource() (string, TokenSource) {
	t.l.RLock()
	defer t.l.RUnlock()

	return t.replicationToken, t.replicationTokenSource
}
215067
func (n *BuilderNode) ReplicaPartitions(replica int) []int {
	n.builder.ring.FillReplicaToNodeToPartitions()
	partitions := make([]int, len(n.builder.ring.ReplicaToNodeToPartitions[replica][n.index]))
	for i, partition := range n.builder.ring.ReplicaToNodeToPartitions[replica][n.index] {
		partitions[i] = int(partition)
	}
	return partitions
}
475074
func GetSlaveStatus(endpoint string) (SlaveStatus, error) {
	var (
		dataSet []map[string]string
		result  SlaveStatus
		err     error
	)
	if dataSet, err = readDataSet(endpoint, "SHOW SLAVE STATUS"); err != nil {
		return result, err
	}
	// There's at most one row in the resultset of "SHOW SLAVE STATUS"
	if len(dataSet) == 1 {
		result.SlaveIOState = dataSet[0]["Slave_IO_State"]
		result.MasterHost = dataSet[0]["Master_Host"]
		result.MasterUser = dataSet[0]["Master_User"]
		result.MasterPort = getInt(dataSet[0]["Master_Port"])
		result.ConnectRetry = dataSet[0]["Connect_Retry"]
		result.MasterLogFile = dataSet[0]["Master_Log_File"]
		result.ReadMasterLogPos = getInt(dataSet[0]["Read_Master_Log_Pos"])
		result.RelayLogFile = dataSet[0]["Relay_Log_File"]
		result.RelayLogPos = getInt(dataSet[0]["Relay_Log_Pos"])
		result.RelayMasterLogFile = dataSet[0]["Relay_Master_Log_File"]
		result.SlaveIORunning = dataSet[0]["Slave_IO_Running"]
		result.SlaveSQLRunning = dataSet[0]["Slave_SQL_Running"]
		result.ReplicateDoDB = dataSet[0]["Replicate_Do_DB"]
		result.ReplicateIgnoreDB = dataSet[0]["Replicate_Ignore_DB"]
		result.ReplicateDoTable = dataSet[0]["Replicate_Do_Table"]
		result.ReplicateIgnoreTable = dataSet[0]["Replicate_Ignore_Table"]
		result.ReplicateWildDoTable = dataSet[0]["Replicate_Wild_Do_Table"]
		result.ReplicateWildIgnoreTable = dataSet[0]["Replicate_Wild_Ignore_Table"]
		result.LastErrno = getInt(dataSet[0]["Last_Errno"])
		result.LastError = dataSet[0]["Last_Error"]
		result.SkipCounter = getInt(dataSet[0]["Skip_Counter"])
		result.ExecMasterLogPos = getInt(dataSet[0]["Exec_Master_Log_Pos"])
		result.RelayLogSpace = getInt(dataSet[0]["Relay_Log_Space"])
		result.UntilCondition = dataSet[0]["Until_Condition"]
		result.UntilLogFile = dataSet[0]["Until_Log_File"]
		result.UntilLogPos = getInt(dataSet[0]["Until_Log_Pos"])
		result.MasterSSLAllowed = dataSet[0]["Master_SSL_Allowed"]
		result.MasterSSLCAFile = dataSet[0]["Master_SSL_CA_File"]
		result.MasterSSLCAPath = dataSet[0]["Master_SSL_CA_Path"]
		result.MasterSSLCert = dataSet[0]["Master_SSL_Cert"]
		result.MasterSSLCipher = dataSet[0]["Master_SSL_Cipher"]
		result.MasterSSLKey = dataSet[0]["Master_SSL_Key"]
		result.SecondsBehindMaster = getInt(dataSet[0]["Seconds_Behind_Master"])
		result.MasterSSLVerifyServerCert = dataSet[0]["Master_SSL_Verify_Server_Cert"]
		result.LastIOErrno = getInt(dataSet[0]["Last_IO_Errno"])
		result.LastIOError = dataSet[0]["Last_IO_Error"]
		result.LastSQLErrno = getInt(dataSet[0]["Last_SQL_Errno"])
		result.LastSQLError = dataSet[0]["Last_SQL_Error"]
		result.ReplicateIgnoreServerIds = dataSet[0]["Replicate_Ignore_Server_Ids"]
		result.MasterServerID = getInt(dataSet[0]["Master_Server_Id"])
		result.MasterUUID = dataSet[0]["Master_UUID"]
		result.MasterInfoFile = dataSet[0]["Master_Info_File"]
		result.SQLDelay = getInt(dataSet[0]["SQL_Delay"])
		result.SQLRemainingDelay = dataSet[0]["SQL_Remaining_Delay"]
		result.SlaveSQLRunningState = dataSet[0]["Slave_SQL_Running_State"]
		result.MasterRetryCount = getInt(dataSet[0]["Master_Retry_Count"])
		result.MasterBind = dataSet[0]["Master_Bind"]
		result.LastIOErrorTimestamp = dataSet[0]["Last_IO_Error_Timestamp"]
		result.LastSQLErrorTimestamp = dataSet[0]["Last_SQL_Error_Timestamp"]
		result.MasterSSLCrl = dataSet[0]["Master_SSL_Crl"]
		result.MasterSSLCrlpath = dataSet[0]["Master_SSL_Crlpath"]
		result.RetrievedGtidSet = dataSet[0]["Retrieved_Gtid_Set"]
		result.ExecutedGtidSet = dataSet[0]["Executed_Gtid_Set"]
		result.AutoPosition = getBool(dataSet[0]["Auto_Position"])
	}
	return result, nil
}
383494
func (a *HorizontalController) computeStatusForPodsMetric(currentReplicas int32, metricSpec autoscalingv2.MetricSpec, hpa *autoscalingv2.HorizontalPodAutoscaler, selector labels.Selector, status *autoscalingv2.MetricStatus, metricSelector labels.Selector) (int32, time.Time, string, error) {
	replicaCountProposal, utilizationProposal, timestampProposal, err := a.replicaCalc.GetMetricReplicas(currentReplicas, metricSpec.Pods.Target.AverageValue.MilliValue(), metricSpec.Pods.Metric.Name, hpa.Namespace, selector, metricSelector)
	if err != nil {
		a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetPodsMetric", err.Error())
		setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetPodsMetric", "the HPA was unable to compute the replica count: %v", err)
		return 0, timestampProposal, "", err
	}
	*status = autoscalingv2.MetricStatus{
		Type: autoscalingv2.PodsMetricSourceType,
		Pods: &autoscalingv2.PodsMetricStatus{
			Metric: autoscalingv2.MetricIdentifier{
				Name:     metricSpec.Pods.Metric.Name,
				Selector: metricSpec.Pods.Metric.Selector,
			},
			Current: autoscalingv2.MetricValueStatus{
				AverageValue: resource.NewMilliQuantity(utilizationProposal, resource.DecimalSI),
			},
		},
	}

	return replicaCountProposal, timestampProposal, fmt.Sprintf("pods metric %s", metricSpec.Pods.Metric.Name), nil
}
1126702
func (m *MockCoreV1Interface) ReplicationControllers(arg0 string) v11.ReplicationControllerInterface {
	ret := m.ctrl.Call(m, "ReplicationControllers", arg0)
	ret0, _ := ret[0].(v11.ReplicationControllerInterface)
	return ret0
}
177327
func (a *HorizontalController) computeStatusForExternalMetric(currentReplicas int32, metricSpec autoscalingv2.MetricSpec, hpa *autoscalingv2.HorizontalPodAutoscaler, selector labels.Selector, status *autoscalingv2.MetricStatus) (int32, time.Time, string, error) {
	if metricSpec.External.Target.AverageValue != nil {
		replicaCountProposal, utilizationProposal, timestampProposal, err := a.replicaCalc.GetExternalPerPodMetricReplicas(currentReplicas, metricSpec.External.Target.AverageValue.MilliValue(), metricSpec.External.Metric.Name, hpa.Namespace, metricSpec.External.Metric.Selector)
		if err != nil {
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetExternalMetric", err.Error())
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetExternalMetric", "the HPA was unable to compute the replica count: %v", err)
			return 0, time.Time{}, "", fmt.Errorf("failed to get %s external metric: %v", metricSpec.External.Metric.Name, err)
		}
		*status = autoscalingv2.MetricStatus{
			Type: autoscalingv2.ExternalMetricSourceType,
			External: &autoscalingv2.ExternalMetricStatus{
				Metric: autoscalingv2.MetricIdentifier{
					Name:     metricSpec.External.Metric.Name,
					Selector: metricSpec.External.Metric.Selector,
				},
				Current: autoscalingv2.MetricValueStatus{
					AverageValue: resource.NewMilliQuantity(utilizationProposal, resource.DecimalSI),
				},
			},
		}
		return replicaCountProposal, timestampProposal, fmt.Sprintf("external metric %s(%+v)", metricSpec.External.Metric.Name, metricSpec.External.Metric.Selector), nil
	}
	if metricSpec.External.Target.Value != nil {
		replicaCountProposal, utilizationProposal, timestampProposal, err := a.replicaCalc.GetExternalMetricReplicas(currentReplicas, metricSpec.External.Target.Value.MilliValue(), metricSpec.External.Metric.Name, hpa.Namespace, metricSpec.External.Metric.Selector, selector)
		if err != nil {
			a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetExternalMetric", err.Error())
			setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetExternalMetric", "the HPA was unable to compute the replica count: %v", err)
			return 0, time.Time{}, "", fmt.Errorf("failed to get external metric %s: %v", metricSpec.External.Metric.Name, err)
		}
		*status = autoscalingv2.MetricStatus{
			Type: autoscalingv2.ExternalMetricSourceType,
			External: &autoscalingv2.ExternalMetricStatus{
				Metric: autoscalingv2.MetricIdentifier{
					Name:     metricSpec.External.Metric.Name,
					Selector: metricSpec.External.Metric.Selector,
				},
				Current: autoscalingv2.MetricValueStatus{
					Value: resource.NewMilliQuantity(utilizationProposal, resource.DecimalSI),
				},
			},
		}
		return replicaCountProposal, timestampProposal, fmt.Sprintf("external metric %s(%+v)", metricSpec.External.Metric.Name, metricSpec.External.Metric.Selector), nil
	}
	errMsg := "invalid external metric source: neither a value target nor an average value target was set"
	a.eventRecorder.Event(hpa, v1.EventTypeWarning, "FailedGetExternalMetric", errMsg)
	setCondition(hpa, autoscalingv2.ScalingActive, v1.ConditionFalse, "FailedGetExternalMetric", "the HPA was unable to compute the replica count: %s", errMsg)
	return 0, time.Time{}, "", fmt.Errorf(errMsg)
}
484131
func ValidateReplicaSetStatusUpdate(rs, oldRs *apps.ReplicaSet) field.ErrorList {
	allErrs := field.ErrorList{}
	allErrs = append(allErrs, apivalidation.ValidateObjectMetaUpdate(&rs.ObjectMeta, &oldRs.ObjectMeta, field.NewPath("metadata"))...)
	allErrs = append(allErrs, ValidateReplicaSetStatus(rs.Status, field.NewPath("status"))...)
	return allErrs
}
899757
func (m *MockConnector) ConnectionStats() go_nats.Statistics {
	ret := m.ctrl.Call(m, "ConnectionStats")
	ret0, _ := ret[0].(go_nats.Statistics)
	return ret0
}
1114909
func GetReplicaCountForReplicaSets(replicaSets []*extensions.ReplicaSet) int {
	totalReplicaCount := 0
	for _, rs := range replicaSets {
		totalReplicaCount += rs.Spec.Replicas
	}
	return totalReplicaCount
}
885502
func GetReadyReplicaCountForReplicationControllers(replicationControllers []*v1.ReplicationController) int32 {
	totalReadyReplicas := int32(0)
	for _, rc := range replicationControllers {
		if rc != nil {
			totalReadyReplicas += rc.Status.ReadyReplicas
		}
	}
	return totalReadyReplicas
}
1268576
func (k *SimpleFS) SimpleFSStat(ctx context.Context, arg keybase1.SimpleFSStatArg) (de keybase1.Dirent, err error) {
	if arg.IdentifyBehavior != nil {
		ctx, err = tlfhandle.MakeExtendedIdentify(ctx, *arg.IdentifyBehavior)
		if err != nil {
			return keybase1.Dirent{}, err
		}
	}
	ctx, err = k.startSyncOp(ctx, "Stat", arg.Path)
	if err != nil {
		return keybase1.Dirent{}, err
	}
	defer func() { k.doneSyncOp(ctx, err) }()

	fs, finalElem, err := k.getFSIfExists(ctx, arg.Path)
	switch errors.Cause(err).(type) {
	case nil:
	case libfs.TlfDoesNotExist:
		if finalElem != "" && finalElem != "." {
			return keybase1.Dirent{}, err
		}

		// TLF doesn't exist yet; just return an empty result.
		return keybase1.Dirent{
			DirentType: keybase1.DirentType_DIR,
			Writable:   false,
		}, nil
	default:
		return keybase1.Dirent{}, err
	}

	if arg.RefreshSubscription {
		err = k.refreshSubscription(ctx, arg.Path)
		if err != nil {
			return keybase1.Dirent{}, err
		}
	}

	// Use LStat so we don't follow symlinks.
	fi, err := fs.Lstat(finalElem)
	if err != nil {
		return keybase1.Dirent{}, err
	}

	err = k.setStat(&de, fi)
	return de, err
}