当前位置: 首页>>代码示例>>Golang>>正文


Golang Migration.Version方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry-incubator/bbs/migration.Migration.Version方法的典型用法代码示例。如果您正苦于以下问题:Golang Migration.Version方法的具体用法?Golang Migration.Version怎么用?Golang Migration.Version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry-incubator/bbs/migration.Migration的用法示例。


在下文中一共展示了Migration.Version方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AppendMigration

func AppendMigration(migration migration.Migration) {
	for _, m := range Migrations {
		if m.Version() == migration.Version() {
			panic("cannot have two migrations with the same version")
		}
	}

	Migrations = append(Migrations, migration)
}
开发者ID:emc-xchallenge,项目名称:bbs,代码行数:9,代码来源:migrations.go

示例2:

		encryptionKey, err := encryption.NewKey("label", "passphrase")
		Expect(err).NotTo(HaveOccurred())
		keyManager, err := encryption.NewKeyManager(encryptionKey, nil)
		Expect(err).NotTo(HaveOccurred())
		cryptor = encryption.NewCryptor(keyManager, rand.Reader)
		serializer = format.NewSerializer(cryptor)
		migration = migrations.NewBase64ProtobufEncode()
	})

	It("appends itself to the migration list", func() {
		Expect(migrations.Migrations).To(ContainElement(migration))
	})

	Describe("Version", func() {
		It("returns the timestamp from which it was created", func() {
			Expect(migration.Version()).To(BeEquivalentTo(1441411196))
		})
	})

	Describe("Up", func() {
		var (
			expectedDesiredLRP                             *models.DesiredLRP
			expectedActualLRP, expectedEvacuatingActualLRP *models.ActualLRP
			expectedTask                                   *models.Task
			migrationErr                                   error
		)

		BeforeEach(func() {
			// DesiredLRP
			expectedDesiredLRP = model_helpers.NewValidDesiredLRP("process-guid")
			jsonValue, err := json.Marshal(expectedDesiredLRP)
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:1441411196_base64_protobuf_encode_test.go

示例3:

		encryptionKey, err := encryption.NewKey("label", "passphrase")
		Expect(err).NotTo(HaveOccurred())
		keyManager, err := encryption.NewKeyManager(encryptionKey, nil)
		Expect(err).NotTo(HaveOccurred())
		cryptor = encryption.NewCryptor(keyManager, rand.Reader)
		serializer = format.NewSerializer(cryptor)
		migration = migrations.NewSplitDesiredLRP()
	})

	It("appends itself to the migration list", func() {
		Expect(migrations.Migrations).To(ContainElement(migration))
	})

	Describe("Version", func() {
		It("returns the timestamp from which it was created", func() {
			Expect(migration.Version()).To(BeEquivalentTo(1442529338))
		})
	})

	var newValidDesiredLRP = func(guid string) *models.DesiredLRP {
		myRouterJSON := json.RawMessage(`{"foo":"bar"}`)
		modTag := models.NewModificationTag("epoch", 0)
		desiredLRP := &models.DesiredLRP{
			ProcessGuid:             guid,
			Domain:                  "some-domain",
			RootFs:                  "some:rootfs",
			Instances:               1,
			EnvironmentVariables:    []*models.EnvironmentVariable{{Name: "FOO", Value: "bar"}},
			Setup:                   models.WrapAction(&models.RunAction{Path: "ls", User: "name"}),
			Action:                  models.WrapAction(&models.RunAction{Path: "ls", User: "name"}),
			DeprecatedStartTimeoutS: 15,
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:1442529338_split_desired_lrp_test.go

示例4:

		Expect(err).NotTo(HaveOccurred())
		keyManager, err := encryption.NewKeyManager(encryptionKey, nil)
		Expect(err).NotTo(HaveOccurred())
		cryptor = encryption.NewCryptor(keyManager, rand.Reader)
		serializer = format.NewSerializer(cryptor)
		migration = migrations.NewTimeoutMilliseconds()
		db = etcddb.NewETCD(format.ENCRYPTED_PROTO, 1, 1, 1*time.Minute, cryptor, storeClient, fakeClock)
	})

	It("appends itself to the migration list", func() {
		Expect(migrations.Migrations).To(ContainElement(migration))
	})

	Describe("Version", func() {
		It("returns the timestamp from which it was created", func() {
			Expect(migration.Version()).To(BeEquivalentTo(1451635200))
		})
	})

	Describe("Down", func() {
		It("returns a not implemented error", func() {
			Expect(migration.Down(logger)).To(HaveOccurred())
		})
	})

	Describe("Up", func() {
		var (
			task         *models.Task
			migrationErr error
		)
开发者ID:timani,项目名称:bbs,代码行数:30,代码来源:1451635200_timeouts_to_milliseconds_test.go

示例5:

			migration = migrations.NewETCDToSQL()
			serializer = format.NewSerializer(cryptor)

			rawSQLDB.Exec("DROP TABLE domains;")
			rawSQLDB.Exec("DROP TABLE tasks;")
			rawSQLDB.Exec("DROP TABLE desired_lrps;")
			rawSQLDB.Exec("DROP TABLE actual_lrps;")
		})

		It("appends itself to the migration list", func() {
			Expect(migrations.Migrations).To(ContainElement(migration))
		})

		Describe("Version", func() {
			It("returns the timestamp from which it was created", func() {
				Expect(migration.Version()).To(BeEquivalentTo(1461790966))
			})
		})

		Describe("Up", func() {
			JustBeforeEach(func() {
				migration.SetStoreClient(storeClient)
				migration.SetRawSQLDB(rawSQLDB)
				migration.SetCryptor(cryptor)
				migration.SetClock(fakeClock)
				migration.SetDBFlavor(sqlRunner.DriverName())
				migrationErr = migration.Up(logger)
			})

			Context("when there is existing data in the database", func() {
				BeforeEach(func() {
开发者ID:timani,项目名称:bbs,代码行数:31,代码来源:1461790966_etcd_to_sql_test.go


注:本文中的github.com/cloudfoundry-incubator/bbs/migration.Migration.Version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。