// SecretProgress returns the number of keys provided so far
553788
func (c *Core) SecretProgress() (int, string) {
	c.stateLock.RLock()
	defer c.stateLock.RUnlock()
	switch c.unlockInfo {
	case nil:
		return 0, ""
	default:
		return len(c.unlockInfo.Parts), c.unlockInfo.Nonce
	}
}
1011948
func SecretUpdate(info *model.ConfigUpdateInfo) error {
	return mgr.Do(func(ctx context.Context, cli *client.Client) (err error) {
		var secret swarm.Secret
		secret, _, err = cli.SecretInspectWithRaw(ctx, info.ID)
		if err != nil {
			return err
		}

		spec := secret.Spec
		// only the Labels field can be updated on API 1.30
		//spec.Name = info.Name
		//spec.Data = []byte(info.Data)
		spec.Labels = info.Labels.ToMap()
		return cli.SecretUpdate(ctx, info.ID, version(info.Version), spec)
	})
}
817802
func SecretList(name string, pageIndex, pageSize int) (secrets []swarm.Secret, totalCount int, err error) {
	err = mgr.Do(func(ctx context.Context, cli *client.Client) (err error) {
		opts := types.SecretListOptions{}
		if name != "" {
			opts.Filters = filters.NewArgs()
			opts.Filters.Add("name", name)
		}
		secrets, err = cli.SecretList(ctx, opts)
		if err == nil {
			sort.Slice(secrets, func(i, j int) bool {
				return secrets[i].Spec.Name < secrets[j].Spec.Name
			})
			totalCount = len(secrets)
			start, end := misc.Page(totalCount, pageIndex, pageSize)
			secrets = secrets[start:end]
		}
		return
	})
	return
}
1266837
func Secret() (c *SecretController) {
	return &SecretController{
		List:   secretList,
		Delete: secretDelete,
		New:    secretNew,
		Create: secretCreate,
		Edit:   secretEdit,
		Update: secretUpdate,
	}
}
1348594
func (c *ChatRPC) ChatAttachmentUploadProgress(
	_ context.Context, _ chat1.ChatAttachmentUploadProgressArg) error {
	return nil
}
800278
func (k SecretKey) Precompute(peer saltpack.BoxPublicKey) saltpack.BoxPrecomputedSharedKey {
	var res PrecomputedSharedKey
	box.Precompute((*[32]byte)(&res), (*[32]byte)(peer.ToRawBoxKeyPointer()), (*[32]byte)(&k.sec))
	return res
}
1075135
func (_class SecretClass) Create(sessionID SessionRef, args SecretRecord) (_retval SecretRef, _err error) {
	_method := "secret.create"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_argsArg, _err := convertSecretRecordToXen(fmt.Sprintf("%s(%s)", _method, "args"), args)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _argsArg)
	if _err != nil {
		return
	}
	_retval, _err = convertSecretRefToGo(_method + " -> ", _result.Value)
	return
}
514232
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,
	})
}
598889
func (*NoopProgressTracker) TrackProgress(_ string, _, _ int64, stream io.ReadCloser) io.ReadCloser {
	return stream
}
1264538
func (c *ProgressBar) SetProgress(p int) {
	if (p <= c.total || c.allowOverflow) || (p >= 0 || c.allowUnderflow) {
		c.progress = p
	}
}
898298
func (c *BitcoindClient) onRescanProgress(hash *chainhash.Hash, height int32,
	timestamp time.Time) {

	select {
	case c.notificationQueue.ChanIn() <- &RescanProgress{
		Hash:   hash,
		Height: height,
		Time:   timestamp,
	}:
	case <-c.quit:
	}
}
977620
func (b *Backend) Secret(k string) *Secret {
	for _, s := range b.Secrets {
		if s.Type == k {
			return s
		}
	}

	return nil
}
994919
func (cli *Client) SecretList(ctx context.Context, options types.SecretListOptions) ([]swarm.Secret, error) {
	if err := cli.NewVersionError("1.25", "secret list"); err != nil {
		return nil, err
	}
	query := url.Values{}

	if options.Filters.Len() > 0 {
		filterJSON, err := filters.ToJSON(options.Filters)
		if err != nil {
			return nil, err
		}

		query.Set("filters", filterJSON)
	}

	resp, err := cli.get(ctx, "/secrets", query, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		return nil, err
	}

	var secrets []swarm.Secret
	err = json.NewDecoder(resp.body).Decode(&secrets)
	return secrets, err
}
1355002
func packProgressCallback(stage C.int, current, total C.uint, data unsafe.Pointer) int {
	callbacks, _ := pointerHandles.Get(data).(*RemoteCallbacks)

	if callbacks.PackProgressCallback == nil {
		return 0
	}

	return int(callbacks.PackProgressCallback(int32(stage), uint32(current), uint32(total)))
}
102849
func (c *ClusterManager) SecretLogin(secretType string, secretConfig map[string]string) error {
	return c.secretsManager.SecretLogin(secretType, secretConfig)
}
1217108
func (nd *Node) MigrationInProgress() (bool, error) {
	values, err := nd.RequestStats(&nd.cluster.infoPolicy)
	if err != nil {
		return false, err
	}

	// if the migrate_partitions_remaining exists and is not `0`, then migration is in progress
	if migration, exists := values["migrate_partitions_remaining"]; exists && migration != "0" {
		return true, nil
	}

	// migration not in progress
	return false, nil
}
1284100
func (g *Guard) Secret(v []byte) (*Secret, error) {
	g.lock.Lock()
	defer g.lock.Unlock()

	b, err := memguard.NewMutableFromBytes(v)
	if err != nil {
		return nil, err
	}

	s := Secret{
		buffer: b,
		guard:  g,
	}

	g.secrets = append(g.secrets, &s)
	return &s, nil
}