當前位置: 首頁>>代碼示例>>Golang>>正文


Golang core.New函數代碼示例

本文整理匯總了Golang中github.com/emccode/rexray/core.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewWithConfigReader

// NewWithConfigReader creates a new REX-Ray instance and configures it with a
// custom configuration stream.
func NewWithConfigReader(in io.Reader) (*core.RexRay, error) {
	c := gofig.New()
	if err := c.ReadConfig(in); err != nil {
		return nil, err
	}
	return core.New(c), nil
}
開發者ID:bottkars,項目名稱:rexray,代碼行數:9,代碼來源:rexray.go

示例2: NewWithConfigFile

// NewWithConfigFile creates a new REX-Ray instance and configures it with a
// custom configuration file.
func NewWithConfigFile(path string) (*core.RexRay, error) {
	c := gofig.New()
	if err := c.ReadConfigFile(path); err != nil {
		return nil, err
	}
	return core.New(c), nil
}
開發者ID:bottkars,項目名稱:rexray,代碼行數:9,代碼來源:rexray.go

示例3: TestNewWithBadVolumeDriver

func TestNewWithBadVolumeDriver(t *testing.T) {
	r := core.New(nil)
	r.Config.OSDrivers = []string{mock.MockOSDriverName}
	r.Config.VolumeDrivers = []string{mock.BadMockVolDriverName}
	r.Config.StorageDrivers = []string{mock.MockStorDriverName}
	if err := r.InitDrivers(); err != errors.ErrNoVolumeDrivers {
		t.Fatal(err)
	}
}
開發者ID:moypray,項目名稱:rexray,代碼行數:9,代碼來源:bad_mock_drivers_test.go

示例4: newModule

func newModule(id int32, cfg *module.Config) (module.Module, error) {
	return &mod{
		id:   id,
		r:    core.New(cfg.Config),
		name: modName,
		desc: modDescription,
		addr: cfg.Address,
	}, nil
}
開發者ID:luk5,項目名稱:rexray,代碼行數:9,代碼來源:remvoldriver.go

示例5: getRexRayNoDrivers

func getRexRayNoDrivers() (*core.RexRay, error) {
	c := gofig.New()
	c.Set("rexray.osDrivers", []string{""})
	c.Set("rexray.volumeDrivers", []string{""})
	c.Set("rexray.storageDrivers", []string{""})
	r := core.New(c)
	r.InitDrivers()
	return r, nil
}
開發者ID:lucmichalski,項目名稱:rexray,代碼行數:9,代碼來源:test_test.go

示例6: getRexRayNoDrivers

func getRexRayNoDrivers() (*core.RexRay, error) {
	c := config.New()
	c.OSDrivers = []string{""}
	c.VolumeDrivers = []string{""}
	c.StorageDrivers = []string{""}
	r := core.New(c)
	r.InitDrivers()
	return r, nil
}
開發者ID:moypray,項目名稱:rexray,代碼行數:9,代碼來源:test_test.go

示例7: TestNewWithBadStorageDriver

func TestNewWithBadStorageDriver(t *testing.T) {
	r := core.New(nil)
	r.Config.Set("osDrivers", []string{mock.MockOSDriverName})
	r.Config.Set("volumeDrivers", []string{mock.MockVolDriverName})
	r.Config.Set("storageDrivers", []string{mock.BadMockStorDriverName})
	if err := r.InitDrivers(); err != errors.ErrNoStorageDrivers {
		t.Fatal(err)
	}
}
開發者ID:nutmegdevelopment,項目名稱:rexray,代碼行數:9,代碼來源:bad_mock_drivers_test.go

示例8: TestNewNoVolumeDrivers

func TestNewNoVolumeDrivers(t *testing.T) {
	c := gofig.New()
	c.Set("rexray.osDrivers", []string{mock.MockOSDriverName})
	c.Set("rexray.volumeDrivers", []string{})
	c.Set("rexray.storageDrivers", []string{mock.MockStorDriverName})
	r := core.New(c)
	if err := r.InitDrivers(); err != errors.ErrNoVolumeDrivers {
		t.Fatal(err)
	}
}
開發者ID:lucmichalski,項目名稱:rexray,代碼行數:10,代碼來源:test_test.go

示例9: TestNewNoStorageDrivers

func TestNewNoStorageDrivers(t *testing.T) {
	c := config.New()
	c.Set("osDrivers", []string{mock.MockOSDriverName})
	c.Set("volumeDrivers", []string{mock.MockVolDriverName})
	c.Set("storageDrivers", []string{})
	r := core.New(c)
	if err := r.InitDrivers(); err != errors.ErrNoStorageDrivers {
		t.Fatal(err)
	}
}
開發者ID:nutmegdevelopment,項目名稱:rexray,代碼行數:10,代碼來源:test_test.go

示例10: TestNewNoVolumeDrivers

func TestNewNoVolumeDrivers(t *testing.T) {
	c := config.New()
	c.OSDrivers = []string{mock.MockOSDriverName}
	c.VolumeDrivers = []string{}
	c.StorageDrivers = []string{mock.MockStorDriverName}
	r := core.New(c)
	if err := r.InitDrivers(); err != errors.ErrNoVolumeDrivers {
		t.Fatal(err)
	}
}
開發者ID:moypray,項目名稱:rexray,代碼行數:10,代碼來源:test_test.go

示例11: TestNewWithNilConfig

func TestNewWithNilConfig(t *testing.T) {
	r := core.New(nil)
	r.Config.Set("rexray.osDrivers", []string{mock.MockOSDriverName})
	r.Config.Set("rexray.volumeDrivers", []string{mock.MockVolDriverName})
	r.Config.Set("rexray.storageDrivers", []string{mock.MockStorDriverName})

	if err := r.InitDrivers(); err != nil {
		t.Fatal(err)
	}

	assertDriverNames(t, r)
}
開發者ID:lucmichalski,項目名稱:rexray,代碼行數:12,代碼來源:test_test.go

示例12: TestNewWithNilConfig

func TestNewWithNilConfig(t *testing.T) {
	r := core.New(nil)
	r.Config.OSDrivers = []string{mock.MockOSDriverName}
	r.Config.VolumeDrivers = []string{mock.MockVolDriverName}
	r.Config.StorageDrivers = []string{mock.MockStorDriverName}

	if err := r.InitDrivers(); err != nil {
		t.Fatal(err)
	}

	assertDriverNames(t, r)
}
開發者ID:moypray,項目名稱:rexray,代碼行數:12,代碼來源:test_test.go

示例13: getRexRay

func getRexRay() (*core.RexRay, error) {
	c := gofig.New()
	c.Set("rexray.osDrivers", []string{mock.MockOSDriverName})
	c.Set("rexray.volumeDrivers", []string{mock.MockVolDriverName})
	c.Set("rexray.storageDrivers", []string{mock.MockStorDriverName})
	r := core.New(c)

	if err := r.InitDrivers(); err != nil {
		return nil, err
	}

	return r, nil
}
開發者ID:lucmichalski,項目名稱:rexray,代碼行數:13,代碼來源:test_test.go

示例14: getRexRay

func getRexRay() (*core.RexRay, error) {
	c := config.New()
	c.OSDrivers = []string{mock.MockOSDriverName}
	c.VolumeDrivers = []string{mock.MockVolDriverName}
	c.StorageDrivers = []string{mock.MockStorDriverName}
	r := core.New(c)

	if err := r.InitDrivers(); err != nil {
		return nil, err
	}

	return r, nil
}
開發者ID:moypray,項目名稱:rexray,代碼行數:13,代碼來源:test_test.go

示例15: newModule

func newModule(c *module.Config) (module.Module, error) {

	host := strings.Trim(c.Address, " ")

	if host == "" {
		if c.Name == "default-docker" {
			host = "unix:///run/docker/plugins/rexray.sock"
		} else {
			fname := cleanName(c.Name)
			host = fmt.Sprintf("unix:///run/docker/plugins/%s.sock", fname)
		}
	}

	c.Address = host

	return &mod{
		r:    core.New(c.Config),
		name: c.Name,
		desc: c.Description,
		addr: host,
	}, nil
}
開發者ID:luk5,項目名稱:rexray,代碼行數:22,代碼來源:voldriver.go


注:本文中的github.com/emccode/rexray/core.New函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。