// SimpleFSSyncStatus - Get sync status.
434756
func (s *SimpleFSHandler) SimpleFSSyncStatus(ctx context.Context, filter keybase1.ListFilter) (keybase1.FSSyncStatus, error) {
	ctx, cancel := s.wrapContextWithTimeout(ctx)
	defer cancel()
	cli, err := s.client()
	if err != nil {
		return keybase1.FSSyncStatus{}, err
	}
	return cli.SimpleFSSyncStatus(ctx, filter)
}
264826
func (r *ReporterKBPKI) NotifySyncStatus(ctx context.Context,
	status *keybase1.FSPathSyncStatus) {
	select {
	case r.notifySyncBuffer <- status:
	default:
		r.vlog.CLogf(
			ctx, libkb.VLog1, "ReporterKBPKI: notify sync buffer full, "+
				"dropping %+v", status)
	}
}
141104
func (tlf *TLF) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) {
	dir := tlf.getStoredDir()
	if dir == nil {
		// The directory hasn't been loaded yet, so there's nothing to do.
		return nil
	}

	return dir.Fsync(ctx, req)
}
1158044
func (dc *DeploymentController) syncDeploymentStatus(allRSs []*apps.ReplicaSet, newRS *apps.ReplicaSet, d *apps.Deployment) error {
	newStatus := calculateStatus(allRSs, newRS, d)

	if reflect.DeepEqual(d.Status, newStatus) {
		return nil
	}

	newDeployment := d
	newDeployment.Status = newStatus
	_, err := dc.client.AppsV1().Deployments(newDeployment.Namespace).UpdateStatus(newDeployment)
	return err
}
725293
func (k *SimpleFS) SimpleFSFolderSyncConfigAndStatus(
	ctx context.Context, path keybase1.Path) (
	keybase1.FolderSyncConfigAndStatus, error) {
	ctx = k.makeContext(ctx)
	_, config, err := k.getSyncConfig(ctx, path)
	if err != nil {
		return keybase1.FolderSyncConfigAndStatus{}, err
	}
	res := keybase1.FolderSyncConfigAndStatus{Config: config}

	if config.Mode != keybase1.FolderSyncMode_DISABLED {
		fs, finalElem, err := k.getFSIfExists(ctx, path)
		if err != nil {
			return res, err
		}
		// Use LStat so we don't follow symlinks.
		fi, err := fs.Lstat(finalElem)
		if err != nil {
			return res, err
		}

		if kmg, ok := fi.Sys().(libfs.KBFSMetadataForSimpleFSGetter); ok {
			metadata, err := kmg.KBFSMetadataForSimpleFS()
			if err != nil {
				return keybase1.FolderSyncConfigAndStatus{}, err
			}
			res.Status.PrefetchStatus = metadata.PrefetchStatus
			res.Status.PrefetchProgress =
				metadata.PrefetchProgress.ToProtocolProgress(k.config.Clock())

			dbc := k.config.DiskBlockCache()
			libfs, ok := fs.(*libfs.FS)
			if dbc != nil && ok {
				size, err := dbc.GetTlfSize(
					ctx, libfs.RootNode().GetFolderBranch().Tlf,
					libkbfs.DiskBlockSyncCache)
				if err != nil {
					return res, err
				}
				res.Status.StoredBytesTotal = int64(size)
			}
		} else {
			k.log.CDebugf(ctx,
				"Could not get prefetch status from filesys: %T", fi.Sys())
		}
	}

	res.Status.LocalDiskBytesAvailable, res.Status.LocalDiskBytesTotal =
		k.getLocalDiskStats(ctx)
	return res, err
}
69267
func (exp *explorerUI) SyncStatusAPIIntercept(next http.Handler) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		if exp.ShowingSyncStatusPage() {
			exp.HandleApiRequestsOnSync(w, r)
			return
		}
		// Otherwise, proceed to the next http handler.
		next.ServeHTTP(w, r)
	})
}
939260
func (d *RsyncDriver) Status() (volume.Status, error) {
	glog.V(2).Info("rsync.Status()")

	outBytes, err := runcmd("df", "--output=source,size,used,avail", "-B1", d.root)
	glog.V(2).Infof("Result of running df command: (%q,%q)", outBytes, err)

	dfResult, err2 := parseDFCommand(d.root, outBytes)
	if err2 != nil {
		return nil, err2
	}

	response := &volume.SimpleStatus{
		Driver:     volume.DriverTypeRsync,
		UsageData:  dfResult,
		DriverData: map[string]string{"DataFile": d.root},
	}

	return response, nil
}
1175665
func (sa *StorageAuthority) GetCertificateStatus(_ context.Context, serial string) (core.CertificateStatus, error) {
	// Serial ee == 238.crt
	if serial == "0000000000000000000000000000000000ee" {
		return core.CertificateStatus{
			Status: core.OCSPStatusGood,
		}, nil
	} else if serial == "0000000000000000000000000000000000b2" {
		return core.CertificateStatus{
			Status: core.OCSPStatusRevoked,
		}, nil
	} else {
		return core.CertificateStatus{}, errors.New("No cert status")
	}
}
739440
func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) {
	ctx = f.folder.fs.config.MaybeStartTrace(
		ctx, "File.Fsync", f.node.GetBasename())
	defer func() { f.folder.fs.config.MaybeFinishTrace(ctx, err) }()

	f.folder.fs.vlog.CLogf(ctx, libkb.VLog1, "File Fsync")
	defer func() { err = f.folder.processError(ctx, libkbfs.WriteMode, err) }()

	// This fits in situation 1 as described in libkbfs/delayed_cancellation.go
	err = libcontext.EnableDelayedCancellationWithGracePeriod(
		ctx, f.folder.fs.config.DelayedCancellationGracePeriod())
	if err != nil {
		return err
	}

	return f.sync(ctx)
}
400334
func (c SimpleFSClient) SimpleFSClearConflictState(ctx context.Context, path Path) (err error) {
	__arg := SimpleFSClearConflictStateArg{Path: path}
	err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSClearConflictState", []interface{}{__arg}, nil)
	return
}
1315370
func (s *SimpleFSHandler) SimpleFSStat(ctx context.Context, arg keybase1.SimpleFSStatArg) (keybase1.Dirent, error) {
	ctx, cancel := s.wrapContextWithTimeout(ctx)
	defer cancel()
	cli, err := s.client()
	if err != nil {
		return keybase1.Dirent{}, err
	}
	return cli.SimpleFSStat(ctx, arg)
}
292174
func (exp *explorerUI) ShowingSyncStatusPage() bool {
	display, ok := exp.displaySyncStatusPage.Load().(bool)
	return ok && display
}
1019472
func (c KbfsClient) FSOverallSyncEvent(ctx context.Context, status FolderSyncStatus) (err error) {
	__arg := FSOverallSyncEventArg{Status: status}
	err = c.Cli.Call(ctx, "keybase.1.kbfs.FSOverallSyncEvent", []interface{}{__arg}, nil)
	return
}
1053864
func (ssa *SQLStorageAuthority) GetCertificateStatus(ctx context.Context, serial string) (core.CertificateStatus, error) {
	if !core.ValidSerial(serial) {
		err := fmt.Errorf("Invalid certificate serial %s", serial)
		return core.CertificateStatus{}, err
	}

	var status core.CertificateStatus
	statusObj, err := ssa.dbMap.WithContext(ctx).Get(certStatusModel{}, serial)
	if err != nil {
		return status, err
	}
	if statusObj == nil {
		return status, nil
	}
	statusModel := statusObj.(*certStatusModel)
	status = core.CertificateStatus{
		Serial:                statusModel.Serial,
		Status:                statusModel.Status,
		OCSPLastUpdated:       statusModel.OCSPLastUpdated,
		RevokedDate:           statusModel.RevokedDate,
		RevokedReason:         statusModel.RevokedReason,
		LastExpirationNagSent: statusModel.LastExpirationNagSent,
		OCSPResponse:          statusModel.OCSPResponse,
		NotAfter:              statusModel.NotAfter,
		IsExpired:             statusModel.IsExpired,
	}

	return status, nil
}
210703
func (a *ACL) ReplicationStatus(args *structs.DCSpecificRequest,
	reply *structs.ACLReplicationStatus) error {
	// This must be sent to the leader, so we fix the args since we are
	// re-using a structure where we don't support all the options.
	args.RequireConsistent = true
	args.AllowStale = false
	if done, err := a.srv.forward("ACL.ReplicationStatus", args, args, reply); done {
		return err
	}

	// There's no ACL token required here since this doesn't leak any
	// sensitive information, and we don't want people to have to use
	// management tokens if they are querying this via a health check.

	// Poll the latest status.
	a.srv.aclReplicationStatusLock.RLock()
	*reply = a.srv.aclReplicationStatus
	a.srv.aclReplicationStatusLock.RUnlock()
	return nil
}
1135997
func (s *SimpleFSHandler) SimpleFSSyncConfigAndStatus(
	ctx context.Context) (keybase1.SyncConfigAndStatusRes, error) {
	ctx, cancel := s.wrapContextWithTimeout(ctx)
	defer cancel()
	cli, err := s.client()
	if err != nil {
		return keybase1.SyncConfigAndStatusRes{}, err
	}
	return cli.SimpleFSSyncConfigAndStatus(ctx)
}
941015
func checkSCPStatus(r *bufio.Reader) error {
	code, err := r.ReadByte()
	if err != nil {
		return err
	}

	if code != 0 {
		// Treat any non-zero (really 1 and 2) as fatal errors
		message, _, err := r.ReadLine()
		if err != nil {
			return errwrap.Wrapf("error reading error message: {{err}}", err)
		}

		return errors.New(string(message))
	}

	return nil
}