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


Golang blobstore.Blobstore类代码示例

本文整理汇总了Golang中github.com/cloudfoundry/bosh-utils/blobstore.Blobstore的典型用法代码示例。如果您正苦于以下问题:Golang Blobstore类的具体用法?Golang Blobstore怎么用?Golang Blobstore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

import (
	"errors"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	boshblob "github.com/cloudfoundry/bosh-utils/blobstore"
	fakeblob "github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	bosherr "github.com/cloudfoundry/bosh-utils/errors"
	boshlog "github.com/cloudfoundry/bosh-utils/logger"
)

var _ = Describe("retryableBlobstore", func() {
	var (
		innerBlobstore     *fakeblob.FakeBlobstore
		logger             boshlog.Logger
		retryableBlobstore boshblob.Blobstore
	)

	BeforeEach(func() {
		innerBlobstore = &fakeblob.FakeBlobstore{}
		logger = boshlog.NewLogger(boshlog.LevelNone)
		retryableBlobstore = boshblob.NewRetryableBlobstore(innerBlobstore, 3, logger)
	})

	Describe("Get", func() {
		Context("when inner blobstore succeeds before maximum number of get tries (first time)", func() {
			It("returns path without an error", func() {
				innerBlobstore.GetFileName = "fake-path"

				path, err := retryableBlobstore.Get("fake-blob-id", "fake-fingerprint")
开发者ID:jianqiu,项目名称:bosh-agent,代码行数:31,代码来源:retryable_blobstore_test.go

示例2:

	. "github.com/cloudfoundry/bosh-utils/internal/github.com/onsi/ginkgo"
	. "github.com/cloudfoundry/bosh-utils/internal/github.com/onsi/gomega"

	boshblob "github.com/cloudfoundry/bosh-utils/blobstore"
	fakeblob "github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	bosherr "github.com/cloudfoundry/bosh-utils/errors"
)

var _ = Describe("sha1VerifiableBlobstore", func() {
	const (
		fixturePath = "test_assets/some.config"
		fixtureSHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709"
	)

	var (
		innerBlobstore          *fakeblob.FakeBlobstore
		sha1VerifiableBlobstore boshblob.Blobstore
	)

	BeforeEach(func() {
		innerBlobstore = &fakeblob.FakeBlobstore{}
		sha1VerifiableBlobstore = boshblob.NewSHA1VerifiableBlobstore(innerBlobstore)
	})

	Describe("Get", func() {
		It("returns without an error if sha1 matches", func() {
			innerBlobstore.GetFileName = fixturePath

			fileName, err := sha1VerifiableBlobstore.Get("fake-blob-id", fixtureSHA1)
			Expect(err).ToNot(HaveOccurred())

			Expect(innerBlobstore.GetBlobIDs).To(Equal([]string{"fake-blob-id"}))
开发者ID:EMC-CMD,项目名称:bosh-agent,代码行数:32,代码来源:sha1_verifiable_blobstore_test.go

示例3:

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"errors"
	"github.com/cloudfoundry/bosh-agent/agent/blobstore"
	boshblob "github.com/cloudfoundry/bosh-utils/blobstore"
	fakeblob "github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
	boshlog "github.com/cloudfoundry/bosh-utils/logger"
)

var _ = Describe("cascadingBlobstore", func() {
	var (
		innerBlobstore     *fakeblob.FakeBlobstore
		blobManager        *fakeblob.FakeBlobManagerInterface
		cascadingBlobstore boshblob.Blobstore
	)

	BeforeEach(func() {
		innerBlobstore = &fakeblob.FakeBlobstore{}
		blobManager = &fakeblob.FakeBlobManagerInterface{}
		logger := boshlog.NewLogger(boshlog.LevelNone)

		cascadingBlobstore = blobstore.NewCascadingBlobstore(innerBlobstore, blobManager, logger)
	})

	Describe("Get", func() {
		Describe("when blobManager returns the file path", func() {
			It("returns the path provided by the blobManager", func() {
				blobManager.GetPathReturns("/path/to-copy/of-blob", nil)
开发者ID:mattcui,项目名称:bosh-agent,代码行数:31,代码来源:cascading_blobstore_test.go

示例4:

	"errors"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	boshblob "github.com/cloudfoundry/bosh-utils/blobstore"
	fakeblob "github.com/cloudfoundry/bosh-utils/blobstore/fakes"
	boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
	bosherr "github.com/cloudfoundry/bosh-utils/errors"
	boshlog "github.com/cloudfoundry/bosh-utils/logger"
)

var _ = Describe("retryableBlobstore", func() {
	var (
		innerBlobstore     *fakeblob.FakeBlobstore
		logger             boshlog.Logger
		retryableBlobstore boshblob.Blobstore
	)

	BeforeEach(func() {
		innerBlobstore = &fakeblob.FakeBlobstore{}
		logger = boshlog.NewLogger(boshlog.LevelNone)
		retryableBlobstore = boshblob.NewRetryableBlobstore(innerBlobstore, 3, logger)
	})

	Describe("Get", func() {
		Context("when inner blobstore succeeds before maximum number of get tries (first time)", func() {
			It("returns path without an error", func() {
				innerBlobstore.GetFileName = "fake-path"

				path, err := retryableBlobstore.Get("fake-blob-id", boshcrypto.NewDigest("fake", "fingerprint"))
开发者ID:mattcui,项目名称:bosh-agent,代码行数:31,代码来源:retryable_blobstore_test.go

示例5:

	boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
	bosherr "github.com/cloudfoundry/bosh-utils/errors"
	fakesys "github.com/cloudfoundry/bosh-utils/system/fakes"
)

var _ = Describe("checksumVerifiableBlobstore", func() {
	const (
		fixturePath   = "test_assets/some.config"
		fixtureSHA1   = "da39a3ee5e6b4b0d3255bfef95601890afd80709"
		fixtureSHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
		fixtureSHA512 = "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
	)

	var (
		innerBlobstore              *fakeblob.FakeBlobstore
		checksumVerifiableBlobstore boshblob.Blobstore
		checksumProvider            boshcrypto.DigestProvider
		fixtureDigest               boshcrypto.Digest
	)

	BeforeEach(func() {
		fixtureDigest = boshcrypto.NewDigest(boshcrypto.DigestAlgorithmSHA1, fixtureSHA1)
		innerBlobstore = &fakeblob.FakeBlobstore{}
		checksumProvider = boshcrypto.NewDigestProvider(fakesys.NewFakeFileSystem())
		checksumVerifiableBlobstore = boshblob.NewDigestVerifiableBlobstore(innerBlobstore, checksumProvider)
	})

	Describe("Get", func() {
		It("returns without an error if sha1 matches", func() {
			innerBlobstore.GetFileName = fixturePath

			fileName, err := checksumVerifiableBlobstore.Get("fake-blob-id", fixtureDigest)
开发者ID:mattcui,项目名称:bosh-agent,代码行数:32,代码来源:digest_verifiable_blobstore_test.go


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