// NewLockingMap returns a new instance of LockingMap
435994
func NewLockingMap(options LockingMapOptions) LockingMap {
	return &lockingMap{
		lock:      &sync.RWMutex{},
		keyLocker: New(options.LockStoreOptions),
		data:      make(map[string]interface{}),
		checkFunc: options.ValueCheckFunc,
	}
}
1285171
func (s *GetPlanInput) SetMapping(v []*MappingEntry) *GetPlanInput {
	s.Mapping = v
	return s
}
1163985
func (e *Endpoint) DeleteMapsLocked() []error {
	var errors []error

	maps := map[string]string{
		"config": e.BPFConfigMapPath(),
		"policy": e.PolicyMapPathLocked(),
		"calls":  e.CallsMapPathLocked(),
		"egress": e.BPFIpvlanMapPath(),
	}
	for name, path := range maps {
		if err := os.RemoveAll(path); err != nil {
			errors = append(errors, fmt.Errorf("unable to remove %s map file %s: %s", name, path, err))
		}
	}

	if e.ConntrackLocalLocked() {
		// Remove local connection tracking maps
		for _, m := range ctmap.LocalMaps(e, option.Config.EnableIPv4, option.Config.EnableIPv6) {
			ctPath, err := m.Path()
			if err == nil {
				err = os.RemoveAll(ctPath)
			}
			if err != nil {
				errors = append(errors, fmt.Errorf("unable to remove CT map %s: %s", ctPath, err))
			}
		}
	}

	// Remove handle_policy() tail call entry for EP
	if err := policymap.RemoveGlobalMapping(uint32(e.ID)); err != nil {
		errors = append(errors, fmt.Errorf("unable to remove endpoint from global policy map: %s", err))
	}

	return errors
}
181667
func (s *RecordColumn) SetMapping(v string) *RecordColumn {
	s.Mapping = &v
	return s
}
1363360
func NewMap() Map {
	m := Map{
		jobs: make(map[int64]*Package),
		lock: new(sync.RWMutex),
	}

	return m
}
298399
func (s *IndicesRolloverService) AddMapping(typ string, mapping interface{}) *IndicesRolloverService {
	s.mappings[typ] = mapping
	return s
}
666227
func NewWithLockerOptions(client *etcd3.Client, opts LockerOptions) (*Etcd3Locker, error) {
	locksMap := map[string]*etcd3Lock{}
	return &Etcd3Locker{Client: client, prefix: opts.Prefix(), sessionTtl: opts.Ttl(), locks: locksMap, mutex: sync.Mutex{}}, nil
}
401526
func (n *nsLockMap) NewNSLock(volume, path string) RWLocker {
	opsID := mustGetUUID()
	if n.isDistXL {
		return &distLockInstance{dsync.NewDRWMutex(pathJoin(volume, path), globalDsync), volume, path, opsID}
	}
	return &localLockInstance{n, volume, path, opsID}
}
1045543
func createEndpointBindingsOp(st *State, key string, givenMap map[string]string, meta *charm.Meta) (txn.Op, error) {

	// No existing map to merge, just use the defaults.
	initialMap, _, err := mergeBindings(givenMap, nil, meta)
	if err != nil {
		return txn.Op{}, errors.Trace(err)
	}

	// Validate the bindings before inserting.
	if err := validateEndpointBindingsForCharm(st, initialMap, meta); err != nil {
		return txn.Op{}, errors.Trace(err)
	}

	return txn.Op{
		C:      endpointBindingsC,
		Id:     key,
		Assert: txn.DocMissing,
		Insert: endpointBindingsDoc{
			Bindings: initialMap,
		},
	}, nil
}
1270522
func newLock(action string) *Lock {
	l := &Lock{
		Action:   action,
		HostName: "unknown",
		UserName: "unknown",
		Time:     time.Now().Format(time.RFC3339),
		Status:   "Running",
	}
	if h, err := os.Hostname(); err == nil {
		l.HostName = h
	}
	if u, err := user.Current(); err == nil {
		l.UserName = u.Username
	}
	return l
}
908545
func NewDbMap(db *sql.DB, dialect Dialect) *DbMap {
	return &DbMap{
		Db:      db,
		Dialect: dialect,
		Dbx:     sqlx.NewDb(db, dialect.DriverName()),
		mapper:  reflectx.NewMapperFunc("db", sqlx.NameMapper),
	}
}
1108187
func (s *MockStore) NewLock(key string, options *store.LockOptions) (store.Locker, error) {
	return nil, ErrNotImplemented
}
295751
func New() ConcurrentMap {
	m := make(ConcurrentMap, SHARD_COUNT)
	for i := 0; i < SHARD_COUNT; i++ {
		m[i] = &ConcurrentMapShared{items: make(map[string]interface{})}
	}
	return m
}
257130
func (c *Client) NewLunMap(opts *NewLunMapOptions) (NewLunMapResult, error) {
	req := xms.PostLunMapsReq(*opts)
	return c.api.PostLunMaps(&req)
}
436418
func NewMap(name string, mapType MapType, keySize int, valueSize int, maxEntries int, flags uint32, innerID uint32, dumpParser DumpParser) *Map {
	m := &Map{
		MapInfo: MapInfo{
			MapType:       mapType,
			KeySize:       uint32(keySize),
			ValueSize:     uint32(valueSize),
			MaxEntries:    uint32(maxEntries),
			Flags:         flags,
			InnerID:       innerID,
			OwnerProgType: ProgTypeUnspec,
		},
		name:       path.Base(name),
		dumpParser: dumpParser,
	}
	return m
}
295894
func NewIntMap() *SkipList {
	return NewCustomMap(func(l, r interface{}) bool {
		return l.(int) < r.(int)
	})
}
948256
func New(options LockStoreOptions) LockStore {
	testTryLockCallback := options.testTryLockCallback
	if testTryLockCallback == nil {
		testTryLockCallback = func() {}
	}

	lock := _LockStoreImp{
		granularity:         options.Granularity,
		testTryLockCallback: testTryLockCallback,
	}

	switch options.Granularity {
	case PerKeyGranularity:
		lock.perKeyLocks = make(map[string]*_LockImp)
	case ShardedGranularity:
		lock.shardedLocks = make([]*sync.RWMutex, options.LockCount)
		for i := range lock.shardedLocks {
			lock.shardedLocks[i] = &sync.RWMutex{}
		}
	}

	return &lock
}