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


Golang uuid.NewGenerator函數代碼示例

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


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

示例1: NewProvider

func NewProvider(
	platform boshplatform.Platform,
	dirProvider boshdir.DirectoriesProvider,
) (p Provider) {
	p.uuidGen = boshuuid.NewGenerator()
	p.platform = platform
	p.dirProvider = dirProvider
	return
}
開發者ID:Jane4PKU,項目名稱:bosh,代碼行數:9,代碼來源:provider.go

示例2: basicDeps

func basicDeps() (boshlog.Logger, boshsys.FileSystem, boshsys.CmdRunner, boshuuid.Generator) {
	logger := boshlog.NewWriterLogger(boshlog.LevelDebug, os.Stderr, os.Stderr)

	fs := boshsys.NewOsFileSystem(logger)

	runner := boshsys.NewExecCmdRunner(logger)

	uuidGen := boshuuid.NewGenerator()

	return logger, fs, runner, uuidGen
}
開發者ID:ronakbanka,項目名稱:vagrant-bosh,代碼行數:11,代碼來源:main.go

示例3: NewProvider

func NewProvider(platform boshplatform.Platform) (p provider) {
	fs := platform.GetFs()
	runner := platform.GetRunner()
	uuidGen := boshuuid.NewGenerator()

	p.blobstores = map[boshsettings.BlobstoreType]Blobstore{
		boshsettings.BlobstoreTypeS3:    newS3Blobstore(fs, runner, uuidGen),
		boshsettings.BlobstoreTypeDummy: newDummyBlobstore(),
	}
	return
}
開發者ID:nicregez,項目名稱:bosh,代碼行數:11,代碼來源:provider.go

示例4: NewProvider

func NewProvider(platform boshplatform.Platform) (p provider) {
	fs := platform.GetFs()
	runner := platform.GetRunner()
	uuidGen := boshuuid.NewGenerator()
	s3cliConfigPath := filepath.Join(boshsettings.VCAP_ETC_DIR, "s3cli")

	p.blobstores = map[boshsettings.BlobstoreType]Blobstore{
		boshsettings.BlobstoreTypeDav:   newDummyBlobstore(),
		boshsettings.BlobstoreTypeDummy: newDummyBlobstore(),
		boshsettings.BlobstoreTypeS3:    newS3Blobstore(fs, runner, uuidGen, s3cliConfigPath),
	}
	return
}
開發者ID:viglesiasce,項目名稱:bosh,代碼行數:13,代碼來源:provider.go

示例5: buildPkg

func buildPkg(bc *fakebc.FakeBundleCollection) (models.Package, *fakebc.FakeBundle) {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())

	pkg := models.Package{
		Name:    "fake-package-name" + uuid,
		Version: "fake-package-name",
		Source: models.Source{
			Sha1:        "fake-blob-sha1",
			BlobstoreID: "fake-blobstore-id",
		},
	}

	bundle := bc.FakeGet(pkg)

	return pkg, bundle
}
開發者ID:amulyas,項目名稱:bosh-cloudstack-cpi,代碼行數:18,代碼來源:concrete_package_applier_test.go

示例6: buildJob

func buildJob(bc *fakebc.FakeBundleCollection) (models.Job, *fakebc.FakeBundle) {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())

	job := models.Job{
		Name:    "fake-job-name" + uuid,
		Version: "fake-job-version",
		Source: models.Source{
			Sha1:          "fake-blob-sha1",
			BlobstoreID:   "fake-blobstore-id",
			PathInArchive: "fake-path-in-archive",
		},
	}

	bundle := bc.FakeGet(job)

	return job, bundle
}
開發者ID:punalpatel,項目名稱:bosh,代碼行數:19,代碼來源:rendered_job_applier_test.go

示例7: TestGetS3

func TestGetS3(t *testing.T) {
	platform, provider := buildProvider()
	options := map[string]string{
		"access_key_id":     "some-access-key",
		"secret_access_key": "some-secret-key",
		"bucket_name":       "some-bucket",
	}
	blobstore, err := provider.Get(boshsettings.Blobstore{
		Type:    boshsettings.BlobstoreTypeS3,
		Options: options,
	})
	assert.NoError(t, err)

	expectedBlobstore := newS3Blobstore(platform.GetFs(), platform.GetRunner(), boshuuid.NewGenerator())
	expectedBlobstore, err = expectedBlobstore.ApplyOptions(options)

	assert.NoError(t, err)
	assert.Equal(t, blobstore, expectedBlobstore)
}
開發者ID:ian-plosker,項目名稱:bosh,代碼行數:19,代碼來源:provider_test.go

示例8: TestGetS3

func TestGetS3(t *testing.T) {
	platform, provider := buildProvider()
	options := map[string]string{
		"access_key_id":     "some-access-key",
		"secret_access_key": "some-secret-key",
		"bucket_name":       "some-bucket",
	}
	blobstore, err := provider.Get(boshsettings.Blobstore{
		Type:    boshsettings.BlobstoreTypeS3,
		Options: options,
	})
	assert.NoError(t, err)

	expectedS3ConfigPath := filepath.Join(boshsettings.VCAP_ETC_DIR, "s3cli")
	expectedBlobstore := newS3Blobstore(platform.GetFs(), platform.GetRunner(), boshuuid.NewGenerator(), expectedS3ConfigPath)
	expectedBlobstore = NewSha1Verifiable(expectedBlobstore)
	expectedBlobstore, err = expectedBlobstore.ApplyOptions(options)

	assert.NoError(t, err)
	assert.Equal(t, blobstore, expectedBlobstore)
}
開發者ID:viglesiasce,項目名稱:bosh,代碼行數:21,代碼來源:provider_test.go

示例9: Setup

func (app *app) Setup(args []string) error {
	opts, err := ParseOptions(args)
	if err != nil {
		return bosherr.WrapError(err, "Parsing options")
	}

	config, err := app.loadConfig(opts.ConfigPath)
	if err != nil {
		return bosherr.WrapError(err, "Loading config")
	}

	dirProvider := boshdirs.NewDirectoriesProvider(opts.BaseDirectory)

	platformProvider := boshplatform.NewProvider(app.logger, dirProvider, config.Platform)

	app.platform, err = platformProvider.Get(opts.PlatformName)
	if err != nil {
		return bosherr.WrapError(err, "Getting platform")
	}

	infProvider := boshinf.NewProvider(app.logger, app.platform)
	app.infrastructure, err = infProvider.Get(opts.InfrastructureName)

	app.platform.SetDevicePathResolver(app.infrastructure.GetDevicePathResolver())

	if err != nil {
		return bosherr.WrapError(err, "Getting infrastructure")
	}

	settingsServiceProvider := boshsettings.NewServiceProvider()

	boot := boshboot.New(
		app.infrastructure,
		app.platform,
		dirProvider,
		settingsServiceProvider,
		app.logger,
	)

	settingsService, err := boot.Run()
	if err != nil {
		return bosherr.WrapError(err, "Running bootstrap")
	}

	mbusHandlerProvider := boshmbus.NewHandlerProvider(settingsService, app.logger)

	mbusHandler, err := mbusHandlerProvider.Get(app.platform, dirProvider)
	if err != nil {
		return bosherr.WrapError(err, "Getting mbus handler")
	}

	blobstoreProvider := boshblob.NewProvider(app.platform, dirProvider)

	blobstore, err := blobstoreProvider.Get(settingsService.GetBlobstore())
	if err != nil {
		return bosherr.WrapError(err, "Getting blobstore")
	}

	monitClientProvider := boshmonit.NewProvider(app.platform, app.logger)

	monitClient, err := monitClientProvider.Get()
	if err != nil {
		return bosherr.WrapError(err, "Getting monit client")
	}

	jobSupervisorProvider := boshjobsuper.NewProvider(
		app.platform,
		monitClient,
		app.logger,
		dirProvider,
		mbusHandler,
	)

	jobSupervisor, err := jobSupervisorProvider.Get(opts.JobSupervisor)
	if err != nil {
		return bosherr.WrapError(err, "Getting job supervisor")
	}

	notifier := boshnotif.NewNotifier(mbusHandler)

	applier, compiler := app.buildApplierAndCompiler(dirProvider, blobstore, jobSupervisor)

	uuidGen := boshuuid.NewGenerator()

	taskService := boshtask.NewAsyncTaskService(uuidGen, app.logger)

	taskManager := boshtask.NewManagerProvider().NewManager(
		app.logger,
		app.platform.GetFs(),
		dirProvider.BoshDir(),
	)

	specFilePath := filepath.Join(dirProvider.BoshDir(), "spec.json")
	specService := boshas.NewConcreteV1Service(
		app.platform.GetFs(),
		app.platform,
		specFilePath,
	)

	drainScriptProvider := boshdrain.NewConcreteDrainScriptProvider(
//.........這裏部分代碼省略.........
開發者ID:Jane4PKU,項目名稱:bosh,代碼行數:101,代碼來源:app.go

示例10: TestGetExternalWhenExternalCommandInPath

func TestGetExternalWhenExternalCommandInPath(t *testing.T) {
	platform, provider := buildProvider()
	options := map[string]string{
		"key": "value",
	}

	platform.Runner.CommandExistsValue = true
	blobstore, err := provider.Get(boshsettings.Blobstore{
		Type:    "fake-external-type",
		Options: options,
	})
	assert.NoError(t, err)

	expectedExternalConfigPath := "/var/vcap/bosh/etc/blobstore-fake-external-type.json"
	expectedBlobstore := NewExternalBlobstore("fake-external-type", options, platform.GetFs(), platform.GetRunner(), boshuuid.NewGenerator(), expectedExternalConfigPath)
	expectedBlobstore = NewSha1Verifiable(expectedBlobstore)
	err = expectedBlobstore.Validate()

	assert.NoError(t, err)
	assert.Equal(t, blobstore, expectedBlobstore)
}
開發者ID:reneedv,項目名稱:bosh,代碼行數:21,代碼來源:provider_test.go

示例11: Setup

func (app *app) Setup(args []string) (err error) {
	opts, err := ParseOptions(args)
	if err != nil {
		err = bosherr.WrapError(err, "Parsing options")
		return
	}

	dirProvider := boshdirs.NewDirectoriesProvider(opts.BaseDirectory)

	platformProvider := boshplatform.NewProvider(app.logger, dirProvider)
	app.platform, err = platformProvider.Get(opts.PlatformName)
	if err != nil {
		err = bosherr.WrapError(err, "Getting platform")
		return
	}

	infProvider := boshinf.NewProvider(app.logger, app.platform)
	app.infrastructure, err = infProvider.Get(opts.InfrastructureName)

	app.platform.SetDevicePathResolver(app.infrastructure.GetDevicePathResolver())

	if err != nil {
		err = bosherr.WrapError(err, "Getting infrastructure")
		return
	}

	settingsServiceProvider := boshsettings.NewServiceProvider()

	boot := boshboot.New(app.infrastructure, app.platform, dirProvider, settingsServiceProvider)
	settingsService, err := boot.Run()
	if err != nil {
		err = bosherr.WrapError(err, "Running bootstrap")
		return
	}

	mbusHandlerProvider := boshmbus.NewHandlerProvider(settingsService, app.logger)
	mbusHandler, err := mbusHandlerProvider.Get(app.platform, dirProvider)
	if err != nil {
		err = bosherr.WrapError(err, "Getting mbus handler")
		return
	}

	blobstoreProvider := boshblob.NewProvider(app.platform, dirProvider)
	blobstore, err := blobstoreProvider.Get(settingsService.GetBlobstore())
	if err != nil {
		err = bosherr.WrapError(err, "Getting blobstore")
		return
	}

	monitClientProvider := boshmonit.NewProvider(app.platform, app.logger)
	monitClient, err := monitClientProvider.Get()
	if err != nil {
		err = bosherr.WrapError(err, "Getting monit client")
		return
	}

	jobSupervisorProvider := boshjobsuper.NewProvider(app.platform, monitClient, app.logger, dirProvider)
	jobSupervisor, err := jobSupervisorProvider.Get(opts.JobSupervisor)
	if err != nil {
		err = bosherr.WrapError(err, "Getting job supervisor")
		return
	}

	notifier := boshnotif.NewNotifier(mbusHandler)

	installPath := dirProvider.DataDir()

	jobsBc := bc.NewFileBundleCollection(installPath, dirProvider.BaseDir(), "jobs", app.platform.GetFs())

	jobApplier := ja.NewRenderedJobApplier(
		jobsBc,
		blobstore,
		app.platform.GetCompressor(),
		jobSupervisor,
	)

	packagesBc := bc.NewFileBundleCollection(installPath, dirProvider.BaseDir(), "packages", app.platform.GetFs())

	packageApplier := pa.NewConcretePackageApplier(
		packagesBc,
		blobstore,
		app.platform.GetCompressor(),
	)

	applier := boshapplier.NewConcreteApplier(jobApplier, packageApplier, app.platform, jobSupervisor, dirProvider)

	compiler := boshcomp.NewConcreteCompiler(
		app.platform.GetCompressor(),
		blobstore,
		app.platform.GetFs(),
		app.platform.GetRunner(),
		dirProvider,
		packageApplier,
		packagesBc,
	)

	uuidGen := boshuuid.NewGenerator()

	taskService := boshtask.NewAsyncTaskService(uuidGen, app.logger)

//.........這裏部分代碼省略.........
開發者ID:velankanisys,項目名稱:bosh,代碼行數:101,代碼來源:app.go

示例12: buildPackage

func buildPackage() models.Package {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())
	return models.Package{Name: "fake-package-name" + uuid, Version: "fake-package-name"}
}
開發者ID:Bosh-for-Cpi,項目名稱:bosh-2605,代碼行數:6,代碼來源:concrete_applier_test.go

示例13: buildJob

func buildJob() models.Job {
	uuidGen := boshuuid.NewGenerator()
	uuid, err := uuidGen.Generate()
	Expect(err).ToNot(HaveOccurred())
	return models.Job{Name: "fake-job-name" + uuid, Version: "fake-version-name"}
}
開發者ID:Bosh-for-Cpi,項目名稱:bosh-2605,代碼行數:6,代碼來源:concrete_applier_test.go

示例14: init

func init() {
	Describe("Testing with Ginkgo", func() {
		It("get dummy", func() {
			_, provider := buildProvider()
			blobstore, err := provider.Get(boshsettings.Blobstore{
				Type: boshsettings.BlobstoreTypeDummy,
			})
			assert.NoError(GinkgoT(), err)
			assert.NotNil(GinkgoT(), blobstore)
		})
		It("get external when external command in path", func() {

			platform, provider := buildProvider()
			options := map[string]string{
				"key": "value",
			}

			platform.Runner.CommandExistsValue = true
			blobstore, err := provider.Get(boshsettings.Blobstore{
				Type:    "fake-external-type",
				Options: options,
			})
			assert.NoError(GinkgoT(), err)

			expectedExternalConfigPath := "/var/vcap/bosh/etc/blobstore-fake-external-type.json"
			expectedBlobstore := NewExternalBlobstore("fake-external-type", options, platform.GetFs(), platform.GetRunner(), boshuuid.NewGenerator(), expectedExternalConfigPath)
			expectedBlobstore = NewSha1Verifiable(expectedBlobstore)
			err = expectedBlobstore.Validate()

			assert.NoError(GinkgoT(), err)
			assert.Equal(GinkgoT(), blobstore, expectedBlobstore)
		})
		It("get external errs when external command not in path", func() {

			platform, provider := buildProvider()
			options := map[string]string{
				"key": "value",
			}

			platform.Runner.CommandExistsValue = false
			_, err := provider.Get(boshsettings.Blobstore{
				Type:    "fake-external-type",
				Options: options,
			})
			assert.Error(GinkgoT(), err)
		})
	})
}
開發者ID:nkuacac,項目名稱:bosh,代碼行數:48,代碼來源:provider_test.go

示例15:

		})

		It("get external when external command in path", func() {
			options := map[string]interface{}{
				"key": "value",
			}

			platform.Runner.CommandExistsValue = true
			blobstore, err := provider.Get(boshsettings.Blobstore{
				Type:    "fake-external-type",
				Options: options,
			})
			Expect(err).ToNot(HaveOccurred())

			expectedExternalConfigPath := "/var/vcap/bosh/etc/blobstore-fake-external-type.json"
			expectedBlobstore := NewExternalBlobstore("fake-external-type", options, platform.GetFs(), platform.GetRunner(), boshuuid.NewGenerator(), expectedExternalConfigPath)
			expectedBlobstore = NewSha1Verifiable(expectedBlobstore)
			err = expectedBlobstore.Validate()

			Expect(err).ToNot(HaveOccurred())
			Expect(blobstore).To(Equal(expectedBlobstore))
		})

		It("get external errs when external command not in path", func() {
			options := map[string]interface{}{
				"key": "value",
			}

			platform.Runner.CommandExistsValue = false
			_, err := provider.Get(boshsettings.Blobstore{
				Type:    "fake-external-type",
開發者ID:Jane4PKU,項目名稱:bosh,代碼行數:31,代碼來源:provider_test.go


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