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


Golang v2.ValidateRepositoryName函数代码示例

本文整理汇总了Golang中github.com/docker/distribution/registry/api/v2.ValidateRepositoryName函数的典型用法代码示例。如果您正苦于以下问题:Golang ValidateRepositoryName函数的具体用法?Golang ValidateRepositoryName怎么用?Golang ValidateRepositoryName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ValidateRepositoryName

// ValidateRepositoryName validates a repository name.
func ValidateRepositoryName(reposName string) error {
	if err := validateNoSchema(reposName); err != nil {
		return err
	}

	_, remoteName := splitReposName(reposName)

	return v2.ValidateRepositoryName(remoteName)
}
开发者ID:JMSwag,项目名称:dockramp,代码行数:10,代码来源:util.go

示例2: RepositoryScoped

// RepositoryScoped returns the scoped cache.
func (rbds *redisBlobDescriptorService) RepositoryScoped(repo string) (distribution.BlobDescriptorService, error) {
	if err := v2.ValidateRepositoryName(repo); err != nil {
		return nil, err
	}

	return &repositoryScopedRedisBlobDescriptorService{
		repo:     repo,
		upstream: rbds,
	}, nil
}
开发者ID:lusis,项目名称:distribution,代码行数:11,代码来源:redis.go

示例3: validateRemoteName

func validateRemoteName(remoteName string) error {

	if !strings.Contains(remoteName, "/") {

		// the repository name must not be a valid image ID
		if err := image.ValidateID(remoteName); err == nil {
			return fmt.Errorf("Invalid repository name (%s), cannot specify 64-byte hexadecimal strings", remoteName)
		}
	}

	return v2.ValidateRepositoryName(remoteName)
}
开发者ID:waterytowers,项目名称:global-hack-day-3,代码行数:12,代码来源:config.go

示例4: RepositoryScoped

func (imbdcp *inMemoryBlobDescriptorCacheProvider) RepositoryScoped(repo string) (distribution.BlobDescriptorService, error) {
	if err := v2.ValidateRepositoryName(repo); err != nil {
		return nil, err
	}

	imbdcp.mu.RLock()
	defer imbdcp.mu.RUnlock()

	return &repositoryScopedInMemoryBlobDescriptorCache{
		repo:       repo,
		parent:     imbdcp,
		repository: imbdcp.repositories[repo],
	}, nil
}
开发者ID:souravbh,项目名称:lattice-release,代码行数:14,代码来源:memory.go

示例5: NewRepository

// NewRepository creates a new Repository for the given repository name and base URL
func NewRepository(ctx context.Context, name, baseURL string, transport http.RoundTripper) (distribution.Repository, error) {
	if err := v2.ValidateRepositoryName(name); err != nil {
		return nil, err
	}

	ub, err := v2.NewURLBuilderFromString(baseURL)
	if err != nil {
		return nil, err
	}

	client := &http.Client{
		Transport: transport,
		// TODO(dmcgowan): create cookie jar
	}

	return &repository{
		client:  client,
		ub:      ub,
		name:    name,
		context: ctx,
	}, nil
}
开发者ID:TomDeVito,项目名称:distribution,代码行数:23,代码来源:repository.go

示例6: Repository

// Repository returns an instance of the repository tied to the registry.
// Instances should not be shared between goroutines but are cheap to
// allocate. In general, they should be request scoped.
func (reg *registry) Repository(ctx context.Context, name string) (distribution.Repository, error) {
	if err := v2.ValidateRepositoryName(name); err != nil {
		return nil, distribution.ErrRepositoryNameInvalid{
			Name:   name,
			Reason: err,
		}
	}

	var descriptorCache distribution.BlobDescriptorService
	if reg.blobDescriptorCacheProvider != nil {
		var err error
		descriptorCache, err = reg.blobDescriptorCacheProvider.RepositoryScoped(name)
		if err != nil {
			return nil, err
		}
	}

	return &repository{
		ctx:             ctx,
		registry:        reg,
		name:            name,
		descriptorCache: descriptorCache,
	}, nil
}
开发者ID:navikt,项目名称:docker-registry,代码行数:27,代码来源:registry.go


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