// SetStore will set the implementation of the Store interface
// used to provide message persistence in cases where QoS levels
// QoS_ONE or QoS_TWO are used. If no store is provided, then the
// client will use MemoryStore by default.
774977
func (o *ClientOptions) SetStore(s Store) *ClientOptions {
	o.Store = s
	return o
}
1158562
func NewMemoryStore(proposer state.Proposer) *MemoryStore {
	memDB, err := memdb.NewMemDB(schema)
	if err != nil {
		// This shouldn't fail
		panic(err)
	}

	return &MemoryStore{
		memDB:    memDB,
		queue:    watch.NewQueue(),
		proposer: proposer,
	}
}
300456
func (m *Map) LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) {
	if value, ok := m.m[key]; ok {
		return value, true
	}
	if m.m == nil {
		m.m = make(map[interface{}]interface{})
	}
	m.m[key] = value
	return value, false
}
776446
func (cs cachedStore) Set(key, value string) error {
	// check if record already exists
	ctx := context.Background()
	dk := datastore.NewKey(ctx, "camnetdns", key, 0, nil)
	var oldValue dsValue
	if err := cs.dsClient.Get(ctx, dk, &oldValue); err != nil {
		if err != datastore.ErrNoSuchEntity {
			return fmt.Errorf("error checking if record exists for %q from datastore: %v", key, err)
		}
		// record does not exist, write it.
		return cs.put(ctx, key, value)
	}
	// record already exists
	if oldValue.Record != value {
		// new record is different, overwrite old one.
		return cs.put(ctx, key, value)
	}
	// record is the same as before
	if oldValue.Updated.Add(staleRecord).After(time.Now()) {
		// record is still fresh, nothing to do.
		return nil
	}
	// record is older than 30 days, so we rewrite it, for analytics.
	return cs.put(ctx, key, value)
}
593548
func (s *LogGroup) SetStoredBytes(v int64) *LogGroup {
	s.StoredBytes = &v
	return s
}
831850
func (s *DatastoreSummary) SetDatastoreName(v string) *DatastoreSummary {
	s.DatastoreName = &v
	return s
}
909793
func (c *Client) Store(seqset *imap.SeqSet, item imap.StoreItem, value interface{}, ch chan *imap.Message) error {
	return c.store(false, seqset, item, value, ch)
}
444935
func (c *Cluster) StopStore(storeID uint64) {
	c.Lock()
	defer c.Unlock()

	if store := c.stores[storeID]; store != nil {
		store.meta.State = metapb.StoreState_Offline
	}
}
1093439
func (s *ObjectVersion) SetStorageClass(v string) *ObjectVersion {
	s.StorageClass = &v
	return s
}
460523
func (c *Cluster) GetStore(storeID uint64) *metapb.Store {
	c.RLock()
	defer c.RUnlock()

	if store := c.stores[storeID]; store != nil {
		return proto.Clone(store.meta).(*metapb.Store)
	}
	return nil
}
925819
func (c *Context) getStore() Store {
	store, ok := c.Request.Context().Value(Key).(Store)
	if !ok {
		panic("invalid request context")
	}
	return store
}
1268702
func (s *UpdateCustomKeyStoreInput) SetKeyStorePassword(v string) *UpdateCustomKeyStoreInput {
	s.KeyStorePassword = &v
	return s
}
1317879
func (s *PipelineActivity) SetDatastore(v *DatastoreActivity) *PipelineActivity {
	s.Datastore = v
	return s
}
1236355
func (c *Cluster) RemoveStore(storeID uint64) {
	c.Lock()
	defer c.Unlock()

	delete(c.stores, storeID)
}
767068
func (c *Client) SUnionStore(destination string, key ...string) (int64, error) {
	var ret int64

	args := make([][]byte, len(key)+2)
	args[0] = []byte("SUNIONSTORE")
	args[1] = []byte(destination)

	for i := range key {
		args[2+i] = []byte(key[i])
	}

	err := c.command(&ret, args...)

	return ret, err
}
1372979
func NewStore() *Store {
	return &Store{
		plugins:  make(map[string]*v2.Plugin),
		specOpts: make(map[string][]SpecOpt),
		handlers: make(map[string][]func(string, *plugins.Client)),
	}
}
447752
func (s *CreateDatastoreOutput) SetDatastoreName(v string) *CreateDatastoreOutput {
	s.DatastoreName = &v
	return s
}