code: func NewPusher(ref reference.Named, endpoint registry.APIEndpoint, repoInfo *registry.RepositoryInfo, imagePushConfig *ImagePushConfig) (Pusher, error) {
  	switch endpoint.Version {
  	case registry.APIVersion2:
  		return &v2Pusher{
  			v2MetadataService: metadata.NewV2MetadataService(imagePushConfig.MetadataStore),
  			ref:               ref,
  			endpoint:          endpoint,
  			repoInfo:          repoInfo,
  			config:            imagePushConfig,
  		}, nil
  	case registry.APIVersion1:
  		return &v1Pusher{
  			v1IDService: metadata.NewV1IDService(imagePushConfig.MetadataStore),
  			ref:         ref,
  			endpoint:    endpoint,
  			repoInfo:    repoInfo,
  			config:      imagePushConfig,
  		}, nil
  	}
  	return nil, fmt.Errorf("unknown version %d for registry %s", endpoint.Version, endpoint.URL)
  }
docs: // NewPusher creates a new Pusher interface that will push to either a v1 or v2
  // registry. The endpoint argument contains a Version field that determines
  // whether a v1 or v2 pusher will be created. The other parameters are passed
  // through to the underlying pusher implementation for use during the actual
  // push operation.