// WithNoNewKeyring causes tasks not to be created with a new keyring for secret storage.
// There is an upper limit on the number of keyrings in a linux system
174276
func WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error {
	if CheckRuntime(ti.Runtime(), "io.containerd.runc") {
		if ti.Options == nil {
			ti.Options = &options.Options{}
		}
		opts, ok := ti.Options.(*options.Options)
		if !ok {
			return errors.New("invalid v2 shim create options format")
		}
		opts.NoNewKeyring = true
	} else {
		if ti.Options == nil {
			ti.Options = &runctypes.CreateOptions{}
		}
		opts, ok := ti.Options.(*runctypes.CreateOptions)
		if !ok {
			return errors.New("could not cast TaskInfo Options to CreateOptions")
		}
		opts.NoNewKeyring = true
	}
	return nil
}
761059
func KeyRangeString(k *topodatapb.KeyRange) string {
	if k == nil {
		return "-"
	}
	return hex.EncodeToString(k.Start) + "-" + hex.EncodeToString(k.End)
}
1238377
func (c *Client) WithNonceGenerator(ng NonceGeneratorFcn) *Client {
	c.Lock()
	defer c.Unlock()
	c.nonceGen = ng
	return c
}
839250
func (builder *FetchCounterCommandBuilder) WithKey(key string) *FetchCounterCommandBuilder {
	builder.protobuf.Key = []byte(key)
	return builder
}
986253
func (builder *TsFetchRowCommandBuilder) WithKey(key []TsCell) *TsFetchRowCommandBuilder {
	tsKey := make([]*riak_ts.TsCell, len(key))

	for i, v := range key {
		tsKey[i] = v.cell
	}

	builder.protobuf.Key = tsKey

	return builder
}
819491
func WithKeyGetter(KeyGetter KeyGetter) Option {
	return option(func(middleware *Middleware) {
		middleware.KeyGetter = KeyGetter
	})
}
505010
func (builder *StoreValueCommandBuilder) WithIfNoneMatch(ifNoneMatch bool) *StoreValueCommandBuilder {
	builder.protobuf.IfNoneMatch = &ifNoneMatch
	return builder
}
1281956
func WithNewline(ctx context.Context, nl bool) context.Context {
	return context.WithValue(ctx, ctxKeyNewline, nl)
}
1110784
func WithReturnNew(parent context.Context, result interface{}) context.Context {
	return context.WithValue(contextOrBackground(parent), keyReturnNew, result)
}
931967
func WithKeyword(keyword uint64) EventOpt {
	return func(options *eventOptions) {
		options.descriptor.keyword |= keyword
	}
}
373398
func KeyIdFromRing(secRing string) (keyID string, err error) {
	f, err := wkfs.Open(secRing)
	if err != nil {
		return "", fmt.Errorf("Could not open secret ring file %v: %v", secRing, err)
	}
	defer f.Close()
	el, err := openpgp.ReadKeyRing(f)
	if err != nil {
		return "", fmt.Errorf("Could not read secret ring file %s: %v", secRing, err)
	}
	if len(el) != 1 {
		return "", fmt.Errorf("Secret ring file %v contained %d identities; expected 1", secRing, len(el))
	}
	ent := el[0]
	return ent.PrimaryKey.KeyIdString(), nil
}
259645
func GenerateNewSecRing(secRing string) (keyID string, err error) {
	ent, err := NewEntity()
	if err != nil {
		return "", fmt.Errorf("generating new identity: %v", err)
	}
	if err := os.MkdirAll(filepath.Dir(secRing), 0700); err != nil {
		return "", err
	}
	f, err := wkfs.OpenFile(secRing, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
	if err != nil {
		return "", err
	}
	err = WriteKeyRing(f, openpgp.EntityList([]*openpgp.Entity{ent}))
	if err != nil {
		f.Close()
		return "", fmt.Errorf("Could not write new key ring to %s: %v", secRing, err)
	}
	if err := f.Close(); err != nil {
		return "", fmt.Errorf("Could not close %v: %v", secRing, err)
	}
	return ent.PrimaryKey.KeyIdString(), nil
}
1235625
func WithKeyID(keyID int) ProviderOpts {
	return func(p *Provider) error {
		p.KeyID = keyID
		return nil
	}
}
777310
func NewKeyring(orgID, projectID *identity.ID, pathExp *pathexp.PathExp) *Keyring {
	return &Keyring{
		BaseKeyring: BaseKeyring{
			Created:   time.Now().UTC(),
			OrgID:     orgID,
			PathExp:   pathExp,
			ProjectID: projectID,

			// This is the first instance of the keyring, so version is 1,
			// and there is no previous instance.
			Previous:       nil,
			KeyringVersion: 1,
		},
	}
}
875724
func (options *Options) FnWith(ctx interface{}) string {
	return options.evalBlock(ctx, nil, nil)
}
205756
func WithNoColor(ctx context.Context, bv bool) context.Context {
	return context.WithValue(ctx, ctxKeyNoColor, bv)
}
149045
func WithEntry(k string, v interface{}) Entry {
	return &generic{key: k, value: v}
}