// New constructs a new kvdb.Kvdb.
776442
func New(
	domain string,
	machines []string,
	options map[string]string,
	fatalErrorCb kvdb.FatalErrorCB,
) (kvdb.Kvdb, error) {
	if domain != "" && !strings.HasSuffix(domain, "/") {
		domain = domain + "/"
	}

	mem := &memKV{
		BaseKvdb:   common.BaseKvdb{FatalCb: fatalErrorCb},
		m:          make(map[string]*memKVPair),
		dist:       NewWatchDistributor(),
		domain:     domain,
		Controller: kvdb.ControllerNotSupported,
		locks:      make(map[string]chan int),
	}

	var noByte bool
	if _, noByte = options[KvUseInterface]; noByte {
		mem.noByte = true
	}
	if _, ok := options[KvSnap]; ok && !noByte {
		return &snapMem{memKV: mem}, nil
	} else if ok && noByte {
		return nil, ErrSnapWithInterfaceNotSupported
	}
	return mem, nil
}
1204458
func New(accessKey string, secretKey string) *Ivona {
	return &Ivona{AccessKey: accessKey, SecretKey: secretKey}
}
436316
func New(db *gorm.DB) i18n.Backend {
	db.AutoMigrate(&Translation{})
	if err := db.Model(&Translation{}).AddUniqueIndex("idx_translations_key_with_locale", "locale", "key").Error; err != nil {
		fmt.Printf("Failed to create unique index for translations key & locale, got: %v\n", err.Error())
	}
	return &Backend{DB: db}
}
1270942
func New(dataDir string, optionalParameters ...DBConfiguration) (ret *CyclePDB, err error) {
	ret = &CyclePDB{
		blobs:               &syncblobs{dbs: make([]*blob, 0)},
		dataDir:             dataDir,
		diskTimeOut:         time.Second,
		bucketTimesIn:       []byte("data"),
		metaBucket:          []byte("m"),
		minNumOldBuckets:    2,
		maxBatchSize:        1000,
		readMovementBacklog: 10000,
		initdb:              true,
	}

	for i, config := range optionalParameters {
		if err = config(ret); err != nil {
			return nil, errors.Annotatef(err, "Cannot execute config parameter %d", i)
		}
	}

	if err = ret.blobs.init(ret); err != nil {
		return nil, errors.Annotatef(err, "Cannot locate or open boltdbs at %s", dataDir)
	}

	if ret.initdb {
		err = ret.init()
	}
	if err == nil {
		ret.wg.Add(1)
		ret.readMovements = make(chan readToLocation, ret.readMovementBacklog)
		go ret.readMovementLoop()
	}
	return ret, err
}
813412
func New(c *client.Client, prefix string) *Record {
	return &Record{c, prefix}
}
24518
func new(err error, skip int) *Error {
	return &Error{
		Err:        err,
		stackTrace: stacktrace(err, skip+1),
		info:       map[string]interface{}{},
	}
}
1189853
func New(params *stripe.BankAccountParams) (*stripe.BankAccount, error) {
	return getC().New(params)
}
449240
func New(chanDB *channeldb.DB) *ChannelNotifier {
	return &ChannelNotifier{
		ntfnServer: subscribe.NewServer(),
		chanDB:     chanDB,
	}
}
342585
func New() (interface{}, error) {
	db := new()
	dbType := dbplugin.NewDatabaseErrorSanitizerMiddleware(db, db.secretValues)

	return dbType, nil
}
808707
func New() db.FileSystem {
	return &fileSystem{
		root: &node{
			children: make(map[string]*node),
			isDir:    true,
		},
	}
}
864824
func New(name string, ra io.ReaderAt, size, offset int64, flags Flag) *Entry {
	return &Entry{
		Name:   name,
		Size:   size,
		Offset: offset,
		Flags:  flags,

		r: ra,
	}
}
1046916
func New(pluginName string, networkClient networkclient.Interface, kClient kubernetes.Interface,
	networkInformers networkinformers.SharedInformerFactory) (*OsdnProxy, error) {
	return &OsdnProxy{
		kClient:          kClient,
		networkClient:    networkClient,
		networkInformers: networkInformers,
		ids:              make(map[string]uint32),
		egressDNS:        common.NewEgressDNS(),
		firewall:         make(map[string]*proxyFirewallItem),
		allEndpoints:     make(map[ktypes.UID]*proxyEndpoints),
	}, nil
}
460897
func New(t *testing.T) *DB {
	// Pick a path for our socket.
	socketDir, err := ioutil.TempDir("", "fakesqldb")
	if err != nil {
		t.Fatalf("ioutil.TempDir failed: %v", err)
	}
	socketFile := path.Join(socketDir, "fakesqldb.sock")

	// Create our DB.
	db := &DB{
		t:            t,
		socketFile:   socketFile,
		name:         "fakesqldb",
		data:         make(map[string]*ExpectedResult),
		rejectedData: make(map[string]error),
		queryCalled:  make(map[string]int),
		connections:  make(map[uint32]*mysql.Conn),
	}

	db.Handler = db

	authServer := &mysql.AuthServerNone{}

	// Start listening.
	db.listener, err = mysql.NewListener("unix", socketFile, authServer, db, 0, 0)
	if err != nil {
		t.Fatalf("NewListener failed: %v", err)
	}

	db.acceptWG.Add(1)
	go func() {
		defer db.acceptWG.Done()
		db.listener.Accept()
	}()

	// Return the db.
	return db
}
51346
func New(cnf *config.Config, host, password, socketPath string, db int) iface.Backend {
	return &Backend{
		Backend:    common.NewBackend(cnf),
		host:       host,
		db:         db,
		password:   password,
		socketPath: socketPath,
	}
}
491202
func (db *DB) New(name []byte) (*Bucket, error) {
	err := db.Update(func(tx *bolt.Tx) error {
		_, err := tx.CreateBucketIfNotExists(name)
		if err != nil {
			return err
		}
		return nil
	})
	if err != nil {
		return nil, err
	}
	return &Bucket{db, name}, nil
}
1364374
func New(connection dal.Connection, database string, collection string, maxAge int,
	ensureTTL bool, keyPairs ...[]byte) nSessions.Store {
	if ensureTTL {
		conn := connection.Clone()
		defer conn.Close()
		db := conn.DB(database)
		c := db.C(collection)
		c.EnsureIndex(dal.Index{
			Key:         []string{"modified"},
			Background:  true,
			Sparse:      true,
			ExpireAfter: time.Duration(maxAge) * time.Second,
		})
	}
	return &dalStore{
		Codecs:     securecookie.CodecsFromPairs(keyPairs...),
		Token:      nSessions.NewCookieToken(),
		connection: connection,
		database:   database,
		collection: collection,
		options: &gSessions.Options{
			MaxAge: maxAge,
		},
	}
}
278548
func New() Store {
	s := Store{m: make(map[string]KVPair)}
	s.FuncMap = map[string]interface{}{
		"exists": s.Exists,
		"ls":     s.List,
		"lsdir":  s.ListDir,
		"get":    s.Get,
		"gets":   s.GetAll,
		"getv":   s.GetValue,
		"getvs":  s.GetAllValues,
	}
	return s
}