vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood 2019-11-11 15:04:53 +00:00
parent 3dcf1e61cf
commit 479c803fd9
446 changed files with 25054 additions and 8064 deletions

View file

@ -38,7 +38,7 @@
"description": "Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.",
"discoveryVersion": "v1",
"documentationLink": "https://developers.google.com/drive/",
"etag": "\"9eZ1uxVRThTDhLJCZHhqs3eQWz4/bzjWBZSIb8SwDXXw1rx-RVKTulk\"",
"etag": "\"F5McR9eEaw0XRpaO3M9gbIugkbs/oBMvKC4XV0NjxxOx_Y5WENsew0Q\"",
"icons": {
"x16": "https://ssl.gstatic.com/docs/doclist/images/drive_icon_16.png",
"x32": "https://ssl.gstatic.com/docs/doclist/images/drive_icon_32.png"
@ -3459,7 +3459,7 @@
}
}
},
"revision": "20190620",
"revision": "20191015",
"rootUrl": "https://www.googleapis.com/",
"schemas": {
"About": {
@ -3664,7 +3664,7 @@
"type": "array"
},
"quotaBytesTotal": {
"description": "The total number of quota bytes.",
"description": "The total number of quota bytes. This is only relevant when quotaType is LIMITED.",
"format": "int64",
"type": "string"
},
@ -4573,13 +4573,17 @@
"type": "boolean"
},
"canEdit": {
"description": "Whether the current user can edit this file.",
"description": "Whether the current user can edit this file. Other factors may limit the type of changes a user can make to a file. For example, see canChangeCopyRequiresWriterPermission or canModifyContent.",
"type": "boolean"
},
"canListChildren": {
"description": "Whether the current user can list the children of this folder. This is always false when the item is not a folder.",
"type": "boolean"
},
"canModifyContent": {
"description": "Whether the current user can modify the content of this file.",
"type": "boolean"
},
"canMoveChildrenOutOfDrive": {
"description": "Whether the current user can move children of this folder outside of the shared drive. This is false when the item is not a folder. Only populated for items in shared drives.",
"type": "boolean"
@ -4730,7 +4734,7 @@
"type": "string"
},
"hasAugmentedPermissions": {
"description": "Whether any users are granted file access directly on this file. This field is only populated for items in shared drives.",
"description": "Whether there are permissions directly on this file. This field is only populated for items in shared drives.",
"type": "boolean"
},
"hasThumbnail": {
@ -5570,7 +5574,7 @@
"type": "string"
},
"pinned": {
"description": "Whether this revision is pinned to prevent automatic purging. This will only be populated and can only be modified on files with content stored in Drive which are not Google Docs. Revisions can also be pinned when they are created through the drive.files.insert/update/copy by using the pinned query parameter.",
"description": "Whether this revision is pinned to prevent automatic purging. This will only be populated and can only be modified on files with content stored in Drive which are not Google Docs. Revisions can also be pinned when they are created through the drive.files.insert/update/copy by using the pinned query parameter. Pinned revisions are stored indefinitely using additional storage quota, up to a maximum of 200 revisions.",
"type": "boolean"
},
"publishAuto": {

View file

@ -53,8 +53,8 @@ import (
"strconv"
"strings"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
)
@ -413,7 +413,8 @@ type About struct {
// Google services.
QuotaBytesByService []*AboutQuotaBytesByService `json:"quotaBytesByService,omitempty"`
// QuotaBytesTotal: The total number of quota bytes.
// QuotaBytesTotal: The total number of quota bytes. This is only
// relevant when quotaType is LIMITED.
QuotaBytesTotal int64 `json:"quotaBytesTotal,omitempty,string"`
// QuotaBytesUsed: The number of quota bytes used by Google Drive.
@ -1974,9 +1975,8 @@ type File struct {
// Drive; it is not populated for Google Docs or shortcut files.
FullFileExtension string `json:"fullFileExtension,omitempty"`
// HasAugmentedPermissions: Whether any users are granted file access
// directly on this file. This field is only populated for items in
// shared drives.
// HasAugmentedPermissions: Whether there are permissions directly on
// this file. This field is only populated for items in shared drives.
HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"`
// HasThumbnail: Whether this file has a thumbnail. This does not
@ -2231,13 +2231,19 @@ type FileCapabilities struct {
// CanDownload: Whether the current user can download this file.
CanDownload bool `json:"canDownload,omitempty"`
// CanEdit: Whether the current user can edit this file.
// CanEdit: Whether the current user can edit this file. Other factors
// may limit the type of changes a user can make to a file. For example,
// see canChangeCopyRequiresWriterPermission or canModifyContent.
CanEdit bool `json:"canEdit,omitempty"`
// CanListChildren: Whether the current user can list the children of
// this folder. This is always false when the item is not a folder.
CanListChildren bool `json:"canListChildren,omitempty"`
// CanModifyContent: Whether the current user can modify the content of
// this file.
CanModifyContent bool `json:"canModifyContent,omitempty"`
// CanMoveChildrenOutOfDrive: Whether the current user can move children
// of this folder outside of the shared drive. This is false when the
// item is not a folder. Only populated for items in shared drives.
@ -3284,6 +3290,8 @@ type Revision struct {
// content stored in Drive which are not Google Docs. Revisions can also
// be pinned when they are created through the
// drive.files.insert/update/copy by using the pinned query parameter.
// Pinned revisions are stored indefinitely using additional storage
// quota, up to a maximum of 200 revisions.
Pinned bool `json:"pinned,omitempty"`
// PublishAuto: Whether subsequent revisions will be automatically
@ -3906,7 +3914,7 @@ func (c *AboutGetCall) Header() http.Header {
func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4061,7 +4069,7 @@ func (c *AppsGetCall) Header() http.Header {
func (c *AppsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4237,7 +4245,7 @@ func (c *AppsListCall) Header() http.Header {
func (c *AppsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4416,7 +4424,7 @@ func (c *ChangesGetCall) Header() http.Header {
func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4618,7 +4626,7 @@ func (c *ChangesGetStartPageTokenCall) Header() http.Header {
func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4885,7 +4893,7 @@ func (c *ChangesListCall) Header() http.Header {
func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5219,7 +5227,7 @@ func (c *ChangesWatchCall) Header() http.Header {
func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5428,7 +5436,7 @@ func (c *ChannelsStopCall) Header() http.Header {
func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5532,7 +5540,7 @@ func (c *ChildrenDeleteCall) Header() http.Header {
func (c *ChildrenDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5654,7 +5662,7 @@ func (c *ChildrenGetCall) Header() http.Header {
func (c *ChildrenGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5818,7 +5826,7 @@ func (c *ChildrenInsertCall) Header() http.Header {
func (c *ChildrenInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6014,7 +6022,7 @@ func (c *ChildrenListCall) Header() http.Header {
func (c *ChildrenListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6197,7 +6205,7 @@ func (c *CommentsDeleteCall) Header() http.Header {
func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6327,7 +6335,7 @@ func (c *CommentsGetCall) Header() http.Header {
func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6476,7 +6484,7 @@ func (c *CommentsInsertCall) Header() http.Header {
func (c *CommentsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6656,7 +6664,7 @@ func (c *CommentsListCall) Header() http.Header {
func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6840,7 +6848,7 @@ func (c *CommentsPatchCall) Header() http.Header {
func (c *CommentsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6989,7 +6997,7 @@ func (c *CommentsUpdateCall) Header() http.Header {
func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7135,7 +7143,7 @@ func (c *DrivesDeleteCall) Header() http.Header {
func (c *DrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7255,7 +7263,7 @@ func (c *DrivesGetCall) Header() http.Header {
func (c *DrivesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7393,7 +7401,7 @@ func (c *DrivesHideCall) Header() http.Header {
func (c *DrivesHideCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7522,7 +7530,7 @@ func (c *DrivesInsertCall) Header() http.Header {
func (c *DrivesInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7694,7 +7702,7 @@ func (c *DrivesListCall) Header() http.Header {
func (c *DrivesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7860,7 +7868,7 @@ func (c *DrivesUnhideCall) Header() http.Header {
func (c *DrivesUnhideCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7999,7 +8007,7 @@ func (c *DrivesUpdateCall) Header() http.Header {
func (c *DrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8216,7 +8224,7 @@ func (c *FilesCopyCall) Header() http.Header {
func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8434,7 +8442,7 @@ func (c *FilesDeleteCall) Header() http.Header {
func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8546,7 +8554,7 @@ func (c *FilesEmptyTrashCall) Header() http.Header {
func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8646,7 +8654,7 @@ func (c *FilesExportCall) Header() http.Header {
func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8800,7 +8808,7 @@ func (c *FilesGenerateIdsCall) Header() http.Header {
func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8999,7 +9007,7 @@ func (c *FilesGetCall) Header() http.Header {
func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9317,7 +9325,7 @@ func (c *FilesInsertCall) Header() http.Header {
func (c *FilesInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9332,7 +9340,7 @@ func (c *FilesInsertCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "files")
if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/drive/v2/files")
c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
@ -9688,7 +9696,7 @@ func (c *FilesListCall) Header() http.Header {
func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10063,7 +10071,7 @@ func (c *FilesPatchCall) Header() http.Header {
func (c *FilesPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10321,7 +10329,7 @@ func (c *FilesTouchCall) Header() http.Header {
func (c *FilesTouchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10484,7 +10492,7 @@ func (c *FilesTrashCall) Header() http.Header {
func (c *FilesTrashCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10644,7 +10652,7 @@ func (c *FilesUntrashCall) Header() http.Header {
func (c *FilesUntrashCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10961,7 +10969,7 @@ func (c *FilesUpdateCall) Header() http.Header {
func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10976,7 +10984,7 @@ func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/drive/v2/files/{fileId}")
c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
@ -11301,7 +11309,7 @@ func (c *FilesWatchCall) Header() http.Header {
func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11507,7 +11515,7 @@ func (c *ParentsDeleteCall) Header() http.Header {
func (c *ParentsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11629,7 +11637,7 @@ func (c *ParentsGetCall) Header() http.Header {
func (c *ParentsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11793,7 +11801,7 @@ func (c *ParentsInsertCall) Header() http.Header {
func (c *ParentsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11954,7 +11962,7 @@ func (c *ParentsListCall) Header() http.Header {
func (c *ParentsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12120,7 +12128,7 @@ func (c *PermissionsDeleteCall) Header() http.Header {
func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12287,7 +12295,7 @@ func (c *PermissionsGetCall) Header() http.Header {
func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12460,7 +12468,7 @@ func (c *PermissionsGetIdForEmailCall) Header() http.Header {
func (c *PermissionsGetIdForEmailCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12643,7 +12651,7 @@ func (c *PermissionsInsertCall) Header() http.Header {
func (c *PermissionsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12865,7 +12873,7 @@ func (c *PermissionsListCall) Header() http.Header {
func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13099,7 +13107,7 @@ func (c *PermissionsPatchCall) Header() http.Header {
func (c *PermissionsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13320,7 +13328,7 @@ func (c *PermissionsUpdateCall) Header() http.Header {
func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13504,7 +13512,7 @@ func (c *PropertiesDeleteCall) Header() http.Header {
func (c *PropertiesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13641,7 +13649,7 @@ func (c *PropertiesGetCall) Header() http.Header {
func (c *PropertiesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13795,7 +13803,7 @@ func (c *PropertiesInsertCall) Header() http.Header {
func (c *PropertiesInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13945,7 +13953,7 @@ func (c *PropertiesListCall) Header() http.Header {
func (c *PropertiesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -14094,7 +14102,7 @@ func (c *PropertiesPatchCall) Header() http.Header {
func (c *PropertiesPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -14259,7 +14267,7 @@ func (c *PropertiesUpdateCall) Header() http.Header {
func (c *PropertiesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -14433,7 +14441,7 @@ func (c *RealtimeGetCall) Header() http.Header {
func (c *RealtimeGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -14614,7 +14622,7 @@ func (c *RealtimeUpdateCall) Header() http.Header {
func (c *RealtimeUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -14624,7 +14632,7 @@ func (c *RealtimeUpdateCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/drive/v2/files/{fileId}/realtime")
c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
@ -14769,7 +14777,7 @@ func (c *RepliesDeleteCall) Header() http.Header {
func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -14908,7 +14916,7 @@ func (c *RepliesGetCall) Header() http.Header {
func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -15067,7 +15075,7 @@ func (c *RepliesInsertCall) Header() http.Header {
func (c *RepliesInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -15249,7 +15257,7 @@ func (c *RepliesListCall) Header() http.Header {
func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -15438,7 +15446,7 @@ func (c *RepliesPatchCall) Header() http.Header {
func (c *RepliesPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -15597,7 +15605,7 @@ func (c *RepliesUpdateCall) Header() http.Header {
func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -15755,7 +15763,7 @@ func (c *RevisionsDeleteCall) Header() http.Header {
func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -15878,7 +15886,7 @@ func (c *RevisionsGetCall) Header() http.Header {
func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16049,7 +16057,7 @@ func (c *RevisionsListCall) Header() http.Header {
func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16225,7 +16233,7 @@ func (c *RevisionsPatchCall) Header() http.Header {
func (c *RevisionsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16375,7 +16383,7 @@ func (c *RevisionsUpdateCall) Header() http.Header {
func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16521,7 +16529,7 @@ func (c *TeamdrivesDeleteCall) Header() http.Header {
func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16641,7 +16649,7 @@ func (c *TeamdrivesGetCall) Header() http.Header {
func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16780,7 +16788,7 @@ func (c *TeamdrivesInsertCall) Header() http.Header {
func (c *TeamdrivesInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -16952,7 +16960,7 @@ func (c *TeamdrivesListCall) Header() http.Header {
func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -17129,7 +17137,7 @@ func (c *TeamdrivesUpdateCall) Header() http.Header {
func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}

View file

@ -35,7 +35,7 @@
"description": "Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.",
"discoveryVersion": "v1",
"documentationLink": "https://developers.google.com/drive/",
"etag": "\"9eZ1uxVRThTDhLJCZHhqs3eQWz4/0iA8vxcUiheoF8DYYwsH9o3K3hg\"",
"etag": "\"LYADMvHWYH2ul9D6m9UT9gT77YM/ixkLftF7SIEiqkkwNYopCpZnQlw\"",
"icons": {
"x16": "https://ssl.gstatic.com/docs/doclist/images/drive_icon_16.png",
"x32": "https://ssl.gstatic.com/docs/doclist/images/drive_icon_32.png"
@ -784,7 +784,7 @@
},
"keepRevisionForever": {
"default": "false",
"description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.",
"description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.",
"location": "query",
"type": "boolean"
},
@ -849,7 +849,7 @@
},
"keepRevisionForever": {
"default": "false",
"description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.",
"description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.",
"location": "query",
"type": "boolean"
},
@ -1185,7 +1185,7 @@
},
"keepRevisionForever": {
"default": "false",
"description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.",
"description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.",
"location": "query",
"type": "boolean"
},
@ -2096,7 +2096,7 @@
}
}
},
"revision": "20190620",
"revision": "20190926",
"rootUrl": "https://www.googleapis.com/",
"schemas": {
"About": {
@ -2704,13 +2704,17 @@
"type": "boolean"
},
"canEdit": {
"description": "Whether the current user can edit this file.",
"description": "Whether the current user can edit this file. Other factors may limit the type of changes a user can make to a file. For example, see canChangeCopyRequiresWriterPermission or canModifyContent.",
"type": "boolean"
},
"canListChildren": {
"description": "Whether the current user can list the children of this folder. This is always false when the item is not a folder.",
"type": "boolean"
},
"canModifyContent": {
"description": "Whether the current user can modify the content of this file.",
"type": "boolean"
},
"canMoveChildrenOutOfDrive": {
"description": "Whether the current user can move children of this folder outside of the shared drive. This is false when the item is not a folder. Only populated for items in shared drives.",
"type": "boolean"
@ -2857,7 +2861,7 @@
"type": "string"
},
"hasAugmentedPermissions": {
"description": "Whether any users are granted file access directly on this file. This field is only populated for shared drive files.",
"description": "Whether there are permissions directly on this file. This field is only populated for items in shared drives.",
"type": "boolean"
},
"hasThumbnail": {

View file

@ -53,8 +53,8 @@ import (
"strconv"
"strings"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
)
@ -1196,9 +1196,8 @@ type File struct {
// is not cleared if the new name does not contain a valid extension.
FullFileExtension string `json:"fullFileExtension,omitempty"`
// HasAugmentedPermissions: Whether any users are granted file access
// directly on this file. This field is only populated for shared drive
// files.
// HasAugmentedPermissions: Whether there are permissions directly on
// this file. This field is only populated for items in shared drives.
HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"`
// HasThumbnail: Whether this file has a thumbnail. This does not
@ -1446,13 +1445,19 @@ type FileCapabilities struct {
// CanDownload: Whether the current user can download this file.
CanDownload bool `json:"canDownload,omitempty"`
// CanEdit: Whether the current user can edit this file.
// CanEdit: Whether the current user can edit this file. Other factors
// may limit the type of changes a user can make to a file. For example,
// see canChangeCopyRequiresWriterPermission or canModifyContent.
CanEdit bool `json:"canEdit,omitempty"`
// CanListChildren: Whether the current user can list the children of
// this folder. This is always false when the item is not a folder.
CanListChildren bool `json:"canListChildren,omitempty"`
// CanModifyContent: Whether the current user can modify the content of
// this file.
CanModifyContent bool `json:"canModifyContent,omitempty"`
// CanMoveChildrenOutOfDrive: Whether the current user can move children
// of this folder outside of the shared drive. This is false when the
// item is not a folder. Only populated for items in shared drives.
@ -2863,7 +2868,7 @@ func (c *AboutGetCall) Header() http.Header {
func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3028,7 +3033,7 @@ func (c *ChangesGetStartPageTokenCall) Header() http.Header {
func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3279,7 +3284,7 @@ func (c *ChangesListCall) Header() http.Header {
func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3576,7 +3581,7 @@ func (c *ChangesWatchCall) Header() http.Header {
func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3784,7 +3789,7 @@ func (c *ChannelsStopCall) Header() http.Header {
func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3887,7 +3892,7 @@ func (c *CommentsCreateCall) Header() http.Header {
func (c *CommentsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4026,7 +4031,7 @@ func (c *CommentsDeleteCall) Header() http.Header {
func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4156,7 +4161,7 @@ func (c *CommentsGetCall) Header() http.Header {
func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4345,7 +4350,7 @@ func (c *CommentsListCall) Header() http.Header {
func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4528,7 +4533,7 @@ func (c *CommentsUpdateCall) Header() http.Header {
func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4674,7 +4679,7 @@ func (c *DrivesCreateCall) Header() http.Header {
func (c *DrivesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4808,7 +4813,7 @@ func (c *DrivesDeleteCall) Header() http.Header {
func (c *DrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4928,7 +4933,7 @@ func (c *DrivesGetCall) Header() http.Header {
func (c *DrivesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5066,7 +5071,7 @@ func (c *DrivesHideCall) Header() http.Header {
func (c *DrivesHideCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5233,7 +5238,7 @@ func (c *DrivesListCall) Header() http.Header {
func (c *DrivesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5399,7 +5404,7 @@ func (c *DrivesUnhideCall) Header() http.Header {
func (c *DrivesUnhideCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5538,7 +5543,7 @@ func (c *DrivesUpdateCall) Header() http.Header {
func (c *DrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5670,7 +5675,8 @@ func (c *FilesCopyCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *F
// KeepRevisionForever sets the optional parameter
// "keepRevisionForever": Whether to set the 'keepForever' field in the
// new head revision. This is only applicable to files with binary
// content in Google Drive.
// content in Google Drive. Only 200 revisions for the file can be kept
// forever. If the limit is reached, try deleting pinned revisions.
func (c *FilesCopyCall) KeepRevisionForever(keepRevisionForever bool) *FilesCopyCall {
c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
return c
@ -5727,7 +5733,7 @@ func (c *FilesCopyCall) Header() http.Header {
func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5812,7 +5818,7 @@ func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) {
// },
// "keepRevisionForever": {
// "default": "false",
// "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.",
// "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.",
// "location": "query",
// "type": "boolean"
// },
@ -5883,7 +5889,8 @@ func (c *FilesCreateCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool)
// KeepRevisionForever sets the optional parameter
// "keepRevisionForever": Whether to set the 'keepForever' field in the
// new head revision. This is only applicable to files with binary
// content in Google Drive.
// content in Google Drive. Only 200 revisions for the file can be kept
// forever. If the limit is reached, try deleting pinned revisions.
func (c *FilesCreateCall) KeepRevisionForever(keepRevisionForever bool) *FilesCreateCall {
c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
return c
@ -5987,7 +5994,7 @@ func (c *FilesCreateCall) Header() http.Header {
func (c *FilesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6002,7 +6009,7 @@ func (c *FilesCreateCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "files")
if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/drive/v3/files")
c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
@ -6104,7 +6111,7 @@ func (c *FilesCreateCall) Do(opts ...googleapi.CallOption) (*File, error) {
// },
// "keepRevisionForever": {
// "default": "false",
// "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.",
// "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.",
// "location": "query",
// "type": "boolean"
// },
@ -6214,7 +6221,7 @@ func (c *FilesDeleteCall) Header() http.Header {
func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6326,7 +6333,7 @@ func (c *FilesEmptyTrashCall) Header() http.Header {
func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6426,7 +6433,7 @@ func (c *FilesExportCall) Header() http.Header {
func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6580,7 +6587,7 @@ func (c *FilesGenerateIdsCall) Header() http.Header {
func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6753,7 +6760,7 @@ func (c *FilesGetCall) Header() http.Header {
func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7050,7 +7057,7 @@ func (c *FilesListCall) Header() http.Header {
func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7265,7 +7272,8 @@ func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall {
// KeepRevisionForever sets the optional parameter
// "keepRevisionForever": Whether to set the 'keepForever' field in the
// new head revision. This is only applicable to files with binary
// content in Google Drive.
// content in Google Drive. Only 200 revisions for the file can be kept
// forever. If the limit is reached, try deleting pinned revisions.
func (c *FilesUpdateCall) KeepRevisionForever(keepRevisionForever bool) *FilesUpdateCall {
c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
return c
@ -7376,7 +7384,7 @@ func (c *FilesUpdateCall) Header() http.Header {
func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7391,7 +7399,7 @@ func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/drive/v3/files/{fileId}")
c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
@ -7504,7 +7512,7 @@ func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) {
// },
// "keepRevisionForever": {
// "default": "false",
// "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.",
// "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.",
// "location": "query",
// "type": "boolean"
// },
@ -7628,7 +7636,7 @@ func (c *FilesWatchCall) Header() http.Header {
func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7863,7 +7871,7 @@ func (c *PermissionsCreateCall) Header() http.Header {
func (c *PermissionsCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8063,7 +8071,7 @@ func (c *PermissionsDeleteCall) Header() http.Header {
func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8230,7 +8238,7 @@ func (c *PermissionsGetCall) Header() http.Header {
func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8447,7 +8455,7 @@ func (c *PermissionsListCall) Header() http.Header {
func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8682,7 +8690,7 @@ func (c *PermissionsUpdateCall) Header() http.Header {
func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8861,7 +8869,7 @@ func (c *RepliesCreateCall) Header() http.Header {
func (c *RepliesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9010,7 +9018,7 @@ func (c *RepliesDeleteCall) Header() http.Header {
func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9150,7 +9158,7 @@ func (c *RepliesGetCall) Header() http.Header {
func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9341,7 +9349,7 @@ func (c *RepliesListCall) Header() http.Header {
func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9529,7 +9537,7 @@ func (c *RepliesUpdateCall) Header() http.Header {
func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9687,7 +9695,7 @@ func (c *RevisionsDeleteCall) Header() http.Header {
func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9819,7 +9827,7 @@ func (c *RevisionsGetCall) Header() http.Header {
func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10014,7 +10022,7 @@ func (c *RevisionsListCall) Header() http.Header {
func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10190,7 +10198,7 @@ func (c *RevisionsUpdateCall) Header() http.Header {
func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10337,7 +10345,7 @@ func (c *TeamdrivesCreateCall) Header() http.Header {
func (c *TeamdrivesCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10470,7 +10478,7 @@ func (c *TeamdrivesDeleteCall) Header() http.Header {
func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10590,7 +10598,7 @@ func (c *TeamdrivesGetCall) Header() http.Header {
func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10767,7 +10775,7 @@ func (c *TeamdrivesListCall) Header() http.Header {
func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10944,7 +10952,7 @@ func (c *TeamdrivesUpdateCall) Header() http.Header {
func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}

View file

@ -1,4 +1,4 @@
// Copyright 2011 Google Inc. All rights reserved.
// Copyright 2011 Google LLC. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
@ -256,14 +256,22 @@ func ProcessMediaOptions(opts []MediaOption) *MediaOptions {
// "http://www.golang.org/topics/myproject/mytopic". It strips all parent
// references (e.g. ../..) as well as anything after the host
// (e.g. /bar/gaz gets stripped out of foo.com/bar/gaz).
//
// ResolveRelative panics if either basestr or relstr is not able to be parsed.
func ResolveRelative(basestr, relstr string) string {
u, _ := url.Parse(basestr)
u, err := url.Parse(basestr)
if err != nil {
panic(fmt.Sprintf("failed to parse %q", basestr))
}
afterColonPath := ""
if i := strings.IndexRune(relstr, ':'); i > 0 {
afterColonPath = relstr[i+1:]
relstr = relstr[:i]
}
rel, _ := url.Parse(relstr)
rel, err := url.Parse(relstr)
if err != nil {
panic(fmt.Sprintf("failed to parse %q", relstr))
}
u = u.ResolveReference(rel)
us := u.String()
if afterColonPath != "" {

View file

@ -191,7 +191,7 @@ func parseTerm(term string) (result templateTerm, err error) {
err = errors.New("not a valid name: " + result.name)
}
if result.explode && result.truncate > 0 {
err = errors.New("both explode and prefix modifers on same term")
err = errors.New("both explode and prefix modifiers on same term")
}
return result, err
}

View file

@ -1,4 +1,4 @@
// Copyright 2012 Google Inc. All rights reserved.
// Copyright 2012 Google LLC. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

View file

@ -1,4 +1,4 @@
// Copyright 2013 Google Inc. All rights reserved.
// Copyright 2013 Google LLC. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

View file

@ -1,16 +1,6 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package internal

View file

@ -1,16 +1,6 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2016 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gensupport

View file

@ -1,16 +1,6 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2016 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package internal

View file

@ -1,16 +1,6 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package internal supports the options and transport packages.
package internal

View file

@ -1,16 +1,6 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.9

View file

@ -1,16 +1,6 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !go1.9

View file

@ -1,16 +1,6 @@
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package option contains options for Google API clients.
package option

View file

@ -26,7 +26,7 @@
"description": "Stores and retrieves potentially large, immutable data objects.",
"discoveryVersion": "v1",
"documentationLink": "https://developers.google.com/storage/docs/json_api/",
"etag": "\"9eZ1uxVRThTDhLJCZHhqs3eQWz4/m18VxIxuaQHJN-C1B3-yQYvta24\"",
"etag": "\"F5McR9eEaw0XRpaO3M9gbIugkbs/bQWWH-5yykbmINHZHPMOypW2I3M\"",
"icons": {
"x16": "https://www.google.com/images/icons/product/cloud_storage-16.png",
"x32": "https://www.google.com/images/icons/product/cloud_storage-32.png"
@ -450,6 +450,13 @@
"required": true,
"type": "string"
},
"optionsRequestedPolicyVersion": {
"description": "The IAM policy format version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn't support part of the requested IAM policy, the request fails.",
"format": "int32",
"location": "query",
"minimum": "1",
"type": "integer"
},
"provisionalUserProject": {
"description": "The project to be billed for this request if the target bucket is requester-pays bucket.",
"location": "query",
@ -3054,6 +3061,7 @@
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/devstorage.full_control",
"https://www.googleapis.com/auth/devstorage.read_only"
]
},
@ -3196,7 +3204,7 @@
}
}
},
"revision": "20190624",
"revision": "20191011",
"rootUrl": "https://www.googleapis.com/",
"schemas": {
"Bucket": {
@ -4305,6 +4313,11 @@
"resourceId": {
"description": "The ID of the resource to which this policy belongs. Will be of the form projects/_/buckets/bucket for buckets, and projects/_/buckets/bucket/objects/object for objects. A specific generation may be specified by appending #generationNumber to the end of the object name, e.g. projects/_/buckets/my-bucket/objects/data.txt#17. The current generation can be denoted with #0. This field is ignored on input.",
"type": "string"
},
"version": {
"description": "The IAM policy format version.",
"format": "int32",
"type": "integer"
}
},
"type": "object"

View file

@ -55,8 +55,8 @@ import (
"strconv"
"strings"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
)
@ -2068,6 +2068,9 @@ type Policy struct {
// generation can be denoted with #0. This field is ignored on input.
ResourceId string `json:"resourceId,omitempty"`
// Version: The IAM policy format version.
Version int64 `json:"version,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
@ -2389,7 +2392,7 @@ func (c *BucketAccessControlsDeleteCall) Header() http.Header {
func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -2537,7 +2540,7 @@ func (c *BucketAccessControlsGetCall) Header() http.Header {
func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -2704,7 +2707,7 @@ func (c *BucketAccessControlsInsertCall) Header() http.Header {
func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -2877,7 +2880,7 @@ func (c *BucketAccessControlsListCall) Header() http.Header {
func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3038,7 +3041,7 @@ func (c *BucketAccessControlsPatchCall) Header() http.Header {
func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3212,7 +3215,7 @@ func (c *BucketAccessControlsUpdateCall) Header() http.Header {
func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3398,7 +3401,7 @@ func (c *BucketsDeleteCall) Header() http.Header {
func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3577,7 +3580,7 @@ func (c *BucketsGetCall) Header() http.Header {
func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3721,6 +3724,16 @@ func (r *BucketsService) GetIamPolicy(bucket string) *BucketsGetIamPolicyCall {
return c
}
// OptionsRequestedPolicyVersion sets the optional parameter
// "optionsRequestedPolicyVersion": The IAM policy format version to be
// returned. If the optionsRequestedPolicyVersion is for an older
// version that doesn't support part of the requested IAM policy, the
// request fails.
func (c *BucketsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *BucketsGetIamPolicyCall {
c.urlParams_.Set("optionsRequestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
return c
}
// ProvisionalUserProject sets the optional parameter
// "provisionalUserProject": The project to be billed for this request
// if the target bucket is requester-pays bucket.
@ -3773,7 +3786,7 @@ func (c *BucketsGetIamPolicyCall) Header() http.Header {
func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -3848,6 +3861,13 @@ func (c *BucketsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, err
// "required": true,
// "type": "string"
// },
// "optionsRequestedPolicyVersion": {
// "description": "The IAM policy format version to be returned. If the optionsRequestedPolicyVersion is for an older version that doesn't support part of the requested IAM policy, the request fails.",
// "format": "int32",
// "location": "query",
// "minimum": "1",
// "type": "integer"
// },
// "provisionalUserProject": {
// "description": "The project to be billed for this request if the target bucket is requester-pays bucket.",
// "location": "query",
@ -3983,7 +4003,7 @@ func (c *BucketsInsertCall) Header() http.Header {
func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4240,7 +4260,7 @@ func (c *BucketsListCall) Header() http.Header {
func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4450,7 +4470,7 @@ func (c *BucketsLockRetentionPolicyCall) Header() http.Header {
func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4685,7 +4705,7 @@ func (c *BucketsPatchCall) Header() http.Header {
func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -4914,7 +4934,7 @@ func (c *BucketsSetIamPolicyCall) Header() http.Header {
func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5089,7 +5109,7 @@ func (c *BucketsTestIamPermissionsCall) Header() http.Header {
func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5329,7 +5349,7 @@ func (c *BucketsUpdateCall) Header() http.Header {
func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5541,7 +5561,7 @@ func (c *ChannelsStopCall) Header() http.Header {
func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5658,7 +5678,7 @@ func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header {
func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5806,7 +5826,7 @@ func (c *DefaultObjectAccessControlsGetCall) Header() http.Header {
func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -5974,7 +5994,7 @@ func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header {
func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6164,7 +6184,7 @@ func (c *DefaultObjectAccessControlsListCall) Header() http.Header {
func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6337,7 +6357,7 @@ func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header {
func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6511,7 +6531,7 @@ func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header {
func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6683,7 +6703,7 @@ func (c *NotificationsDeleteCall) Header() http.Header {
func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -6831,7 +6851,7 @@ func (c *NotificationsGetCall) Header() http.Header {
func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7001,7 +7021,7 @@ func (c *NotificationsInsertCall) Header() http.Header {
func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7176,7 +7196,7 @@ func (c *NotificationsListCall) Header() http.Header {
func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7349,7 +7369,7 @@ func (c *ObjectAccessControlsDeleteCall) Header() http.Header {
func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7521,7 +7541,7 @@ func (c *ObjectAccessControlsGetCall) Header() http.Header {
func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7712,7 +7732,7 @@ func (c *ObjectAccessControlsInsertCall) Header() http.Header {
func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -7909,7 +7929,7 @@ func (c *ObjectAccessControlsListCall) Header() http.Header {
func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8094,7 +8114,7 @@ func (c *ObjectAccessControlsPatchCall) Header() http.Header {
func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8292,7 +8312,7 @@ func (c *ObjectAccessControlsUpdateCall) Header() http.Header {
func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8529,7 +8549,7 @@ func (c *ObjectsComposeCall) Header() http.Header {
func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -8861,7 +8881,7 @@ func (c *ObjectsCopyCall) Header() http.Header {
func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9184,7 +9204,7 @@ func (c *ObjectsDeleteCall) Header() http.Header {
func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9417,7 +9437,7 @@ func (c *ObjectsGetCall) Header() http.Header {
func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9667,7 +9687,7 @@ func (c *ObjectsGetIamPolicyCall) Header() http.Header {
func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9984,7 +10004,7 @@ func (c *ObjectsInsertCall) Header() http.Header {
func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -9999,7 +10019,7 @@ func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "b/{bucket}/o")
if c.mediaInfo_ != nil {
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/storage/v1/b/{bucket}/o")
c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
}
if body == nil {
@ -10339,7 +10359,7 @@ func (c *ObjectsListCall) Header() http.Header {
func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -10646,7 +10666,7 @@ func (c *ObjectsPatchCall) Header() http.Header {
func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11038,7 +11058,7 @@ func (c *ObjectsRewriteCall) Header() http.Header {
func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11341,7 +11361,7 @@ func (c *ObjectsSetIamPolicyCall) Header() http.Header {
func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11541,7 +11561,7 @@ func (c *ObjectsTestIamPermissionsCall) Header() http.Header {
func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -11802,7 +11822,7 @@ func (c *ObjectsUpdateCall) Header() http.Header {
func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12102,7 +12122,7 @@ func (c *ObjectsWatchAllCall) Header() http.Header {
func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12308,7 +12328,7 @@ func (c *ProjectsHmacKeysCreateCall) Header() http.Header {
func (c *ProjectsHmacKeysCreateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12458,7 +12478,7 @@ func (c *ProjectsHmacKeysDeleteCall) Header() http.Header {
func (c *ProjectsHmacKeysDeleteCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12593,7 +12613,7 @@ func (c *ProjectsHmacKeysGetCall) Header() http.Header {
func (c *ProjectsHmacKeysGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12689,6 +12709,7 @@ func (c *ProjectsHmacKeysGetCall) Do(opts ...googleapi.CallOption) (*HmacKeyMeta
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/cloud-platform.read-only",
// "https://www.googleapis.com/auth/devstorage.full_control",
// "https://www.googleapis.com/auth/devstorage.read_only"
// ]
// }
@ -12792,7 +12813,7 @@ func (c *ProjectsHmacKeysListCall) Header() http.Header {
func (c *ProjectsHmacKeysListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -12987,7 +13008,7 @@ func (c *ProjectsHmacKeysUpdateCall) Header() http.Header {
func (c *ProjectsHmacKeysUpdateCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}
@ -13164,7 +13185,7 @@ func (c *ProjectsServiceAccountGetCall) Header() http.Header {
func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20190802")
reqHeaders.Set("x-goog-api-client", "gl-go/1.13.0 gdcl/20191026")
for k, v := range c.header_ {
reqHeaders[k] = v
}

View file

@ -1,16 +1,6 @@
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2015 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package http supports network connections to HTTP servers.
// This package is not intended for use by end developers. Use the

View file

@ -1,16 +1,6 @@
// Copyright 2016 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2016 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build appengine

View file

@ -1,16 +1,6 @@
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2018 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.8

View file

@ -1,10 +1,9 @@
module google.golang.org/appengine
go 1.11
require (
github.com/golang/protobuf v1.3.1
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 // indirect
golang.org/x/net v0.0.0-20190603091049-60506f45cf65
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c // indirect
golang.org/x/text v0.3.2
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b // indirect
)

View file

@ -1,22 +1,11 @@
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=

View file

@ -32,7 +32,7 @@ func limitDial(network, addr string) (net.Conn, error) {
// Dial with a timeout in case the API host is MIA.
// The connection should normally be very fast.
conn, err := net.DialTimeout(network, addr, 500*time.Millisecond)
conn, err := net.DialTimeout(network, addr, 10*time.Second)
if err != nil {
limitRelease()
return nil, err

View file

@ -2,18 +2,20 @@ language: go
matrix:
include:
- go: 1.12.x
- go: 1.13.x
env: VET=1 GO111MODULE=on
- go: 1.12.x
- go: 1.13.x
env: RACE=1 GO111MODULE=on
- go: 1.12.x
- go: 1.13.x
env: RUN386=1
- go: 1.12.x
- go: 1.13.x
env: GRPC_GO_RETRY=on
- go: 1.13.x
env: TESTEXAMPLES=1
- go: 1.12.x
env: GO111MODULE=on
- go: 1.11.x
env: GO111MODULE=on
- go: 1.10.x
- go: 1.9.x
- go: 1.9.x
env: GAE=1
@ -23,17 +25,18 @@ before_install:
- if [[ "${GO111MODULE}" = "on" ]]; then mkdir "${HOME}/go"; export GOPATH="${HOME}/go"; fi
- if [[ -n "${RUN386}" ]]; then export GOARCH=386; fi
- if [[ "${TRAVIS_EVENT_TYPE}" = "cron" && -z "${RUN386}" ]]; then RACE=1; fi
- if [[ "${TRAVIS_EVENT_TYPE}" != "cron" ]]; then VET_SKIP_PROTO=1; fi
- if [[ "${TRAVIS_EVENT_TYPE}" != "cron" ]]; then export VET_SKIP_PROTO=1; fi
install:
- try3() { eval "$*" || eval "$*" || eval "$*"; }
- try3 'if [[ "${GO111MODULE}" = "on" ]]; then go mod download; else make testdeps; fi'
- if [[ "${GAE}" = 1 ]]; then source ./install_gae.sh; make testappenginedeps; fi
- if [[ "${VET}" = 1 ]]; then ./vet.sh -install; fi
- if [[ -n "${GAE}" ]]; then source ./install_gae.sh; make testappenginedeps; fi
- if [[ -n "${VET}" ]]; then ./vet.sh -install; fi
script:
- set -e
- if [[ "${VET}" = 1 ]]; then ./vet.sh; fi
- if [[ "${GAE}" = 1 ]]; then make testappengine; exit 0; fi
- if [[ "${RACE}" = 1 ]]; then make testrace; exit 0; fi
- if [[ -n "${TESTEXAMPLES}" ]]; then examples/examples_test.sh; exit 0; fi
- if [[ -n "${VET}" ]]; then ./vet.sh; fi
- if [[ -n "${GAE}" ]]; then make testappengine; exit 0; fi
- if [[ -n "${RACE}" ]]; then make testrace; exit 0; fi
- make test

3
vendor/google.golang.org/grpc/CODE-OF-CONDUCT.md generated vendored Normal file
View file

@ -0,0 +1,3 @@
## Community Code of Conduct
gRPC follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).

View file

@ -1,6 +1,8 @@
# How to contribute
We definitely welcome your patches and contributions to gRPC!
We definitely welcome your patches and contributions to gRPC! Please read the gRPC
organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md)
and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding.
If you are new to github, please start by reading [Pull Request howto](https://help.github.com/articles/about-pull-requests/)

1
vendor/google.golang.org/grpc/GOVERNANCE.md generated vendored Normal file
View file

@ -0,0 +1 @@
This repository is governed by the gRPC organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md).

27
vendor/google.golang.org/grpc/MAINTAINERS.md generated vendored Normal file
View file

@ -0,0 +1,27 @@
This page lists all active maintainers of this repository. If you were a
maintainer and would like to add your name to the Emeritus list, please send us a
PR.
See [GOVERNANCE.md](https://github.com/grpc/grpc-community/blob/master/governance.md)
for governance guidelines and how to become a maintainer.
See [CONTRIBUTING.md](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md)
for general contribution guidelines.
## Maintainers (in alphabetical order)
- [canguler](https://github.com/canguler), Google LLC
- [cesarghali](https://github.com/cesarghali), Google LLC
- [dfawley](https://github.com/dfawley), Google LLC
- [easwars](https://github.com/easwars), Google LLC
- [jadekler](https://github.com/jadekler), Google LLC
- [menghanl](https://github.com/menghanl), Google LLC
- [srini100](https://github.com/srini100), Google LLC
## Emeritus Maintainers (in alphabetical order)
- [adelez](https://github.com/adelez), Google LLC
- [iamqizhao](https://github.com/iamqizhao), Google LLC
- [jtattermusch](https://github.com/jtattermusch), Google LLC
- [lyuxuan](https://github.com/lyuxuan), Google LLC
- [makmukhi](https://github.com/makmukhi), Google LLC
- [matt-kwong](https://github.com/matt-kwong), Google LLC
- [nicolasnoble](https://github.com/nicolasnoble), Google LLC
- [yongni](https://github.com/yongni), Google LLC

View file

@ -23,16 +23,36 @@ package grpc
import (
"time"
"google.golang.org/grpc/backoff"
)
// DefaultBackoffConfig uses values specified for backoff in
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
//
// Deprecated: use ConnectParams instead. Will be supported throughout 1.x.
var DefaultBackoffConfig = BackoffConfig{
MaxDelay: 120 * time.Second,
}
// BackoffConfig defines the parameters for the default gRPC backoff strategy.
//
// Deprecated: use ConnectParams instead. Will be supported throughout 1.x.
type BackoffConfig struct {
// MaxDelay is the upper bound of backoff delay.
MaxDelay time.Duration
}
// ConnectParams defines the parameters for connecting and retrying. Users are
// encouraged to use this instead of the BackoffConfig type defined above. See
// here for more details:
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
//
// This API is EXPERIMENTAL.
type ConnectParams struct {
// Backoff specifies the configuration options for connection backoff.
Backoff backoff.Config
// MinConnectTimeout is the minimum amount of time we are willing to give a
// connection to complete.
MinConnectTimeout time.Duration
}

52
vendor/google.golang.org/grpc/backoff/backoff.go generated vendored Normal file
View file

@ -0,0 +1,52 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// Package backoff provides configuration options for backoff.
//
// More details can be found at:
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
//
// All APIs in this package are experimental.
package backoff
import "time"
// Config defines the configuration options for backoff.
type Config struct {
// BaseDelay is the amount of time to backoff after the first failure.
BaseDelay time.Duration
// Multiplier is the factor with which to multiply backoffs after a
// failed retry. Should ideally be greater than 1.
Multiplier float64
// Jitter is the factor with which backoffs are randomized.
Jitter float64
// MaxDelay is the upper bound of backoff delay.
MaxDelay time.Duration
}
// DefaultConfig is a backoff configuration with the default values specfied
// at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
//
// This should be useful for callers who want to configure backoff with
// non-default values only for a subset of the options.
var DefaultConfig = Config{
BaseDelay: 1.0 * time.Second,
Multiplier: 1.6,
Jitter: 0.2,
MaxDelay: 120 * time.Second,
}

View file

@ -305,14 +305,23 @@ type ClientConnState struct {
BalancerConfig serviceconfig.LoadBalancingConfig
}
// ErrBadResolverState may be returned by UpdateClientConnState to indicate a
// problem with the provided name resolver data.
var ErrBadResolverState = errors.New("bad resolver state")
// V2Balancer is defined for documentation purposes. If a Balancer also
// implements V2Balancer, its UpdateClientConnState method will be called
// instead of HandleResolvedAddrs and its UpdateSubConnState will be called
// instead of HandleSubConnStateChange.
type V2Balancer interface {
// UpdateClientConnState is called by gRPC when the state of the ClientConn
// changes.
UpdateClientConnState(ClientConnState)
// changes. If the error returned is ErrBadResolverState, the ClientConn
// will begin calling ResolveNow on the active name resolver with
// exponential backoff until a subsequent call to UpdateClientConnState
// returns a nil error. Any other errors are currently ignored.
UpdateClientConnState(ClientConnState) error
// ResolverError is called by gRPC when the name resolver reports an error.
ResolverError(error)
// UpdateSubConnState is called by gRPC when the state of a SubConn
// changes.
UpdateSubConnState(SubConn, SubConnState)

View file

@ -53,6 +53,8 @@ func (bb *baseBuilder) Name() string {
return bb.name
}
var _ balancer.V2Balancer = (*baseBalancer)(nil) // Assert that we implement V2Balancer
type baseBalancer struct {
cc balancer.ClientConn
pickerBuilder PickerBuilder
@ -70,7 +72,11 @@ func (b *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error)
panic("not implemented")
}
func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) {
func (b *baseBalancer) ResolverError(error) {
// Ignore
}
func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) error {
// TODO: handle s.ResolverState.Err (log if not nil) once implemented.
// TODO: handle s.ResolverState.ServiceConfig?
if grpclog.V(2) {
@ -101,6 +107,7 @@ func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) {
// The entry will be deleted in HandleSubConnStateChange.
}
}
return nil
}
// regeneratePicker takes a snapshot of the balancer, and generates a picker

View file

@ -25,6 +25,8 @@ import (
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/buffer"
"google.golang.org/grpc/internal/grpcsync"
"google.golang.org/grpc/resolver"
)
@ -34,62 +36,14 @@ type scStateUpdate struct {
state connectivity.State
}
// scStateUpdateBuffer is an unbounded channel for scStateChangeTuple.
// TODO make a general purpose buffer that uses interface{}.
type scStateUpdateBuffer struct {
c chan *scStateUpdate
mu sync.Mutex
backlog []*scStateUpdate
}
func newSCStateUpdateBuffer() *scStateUpdateBuffer {
return &scStateUpdateBuffer{
c: make(chan *scStateUpdate, 1),
}
}
func (b *scStateUpdateBuffer) put(t *scStateUpdate) {
b.mu.Lock()
defer b.mu.Unlock()
if len(b.backlog) == 0 {
select {
case b.c <- t:
return
default:
}
}
b.backlog = append(b.backlog, t)
}
func (b *scStateUpdateBuffer) load() {
b.mu.Lock()
defer b.mu.Unlock()
if len(b.backlog) > 0 {
select {
case b.c <- b.backlog[0]:
b.backlog[0] = nil
b.backlog = b.backlog[1:]
default:
}
}
}
// get returns the channel that the scStateUpdate will be sent to.
//
// Upon receiving, the caller should call load to send another
// scStateChangeTuple onto the channel if there is any.
func (b *scStateUpdateBuffer) get() <-chan *scStateUpdate {
return b.c
}
// ccBalancerWrapper is a wrapper on top of cc for balancers.
// It implements balancer.ClientConn interface.
type ccBalancerWrapper struct {
cc *ClientConn
balancer balancer.Balancer
stateChangeQueue *scStateUpdateBuffer
ccUpdateCh chan *balancer.ClientConnState
done chan struct{}
cc *ClientConn
balancerMu sync.Mutex // synchronizes calls to the balancer
balancer balancer.Balancer
scBuffer *buffer.Unbounded
done *grpcsync.Event
mu sync.Mutex
subConns map[*acBalancerWrapper]struct{}
@ -97,11 +51,10 @@ type ccBalancerWrapper struct {
func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.BuildOptions) *ccBalancerWrapper {
ccb := &ccBalancerWrapper{
cc: cc,
stateChangeQueue: newSCStateUpdateBuffer(),
ccUpdateCh: make(chan *balancer.ClientConnState, 1),
done: make(chan struct{}),
subConns: make(map[*acBalancerWrapper]struct{}),
cc: cc,
scBuffer: buffer.NewUnbounded(),
done: grpcsync.NewEvent(),
subConns: make(map[*acBalancerWrapper]struct{}),
}
go ccb.watcher()
ccb.balancer = b.Build(ccb, bopts)
@ -113,36 +66,23 @@ func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.Bui
func (ccb *ccBalancerWrapper) watcher() {
for {
select {
case t := <-ccb.stateChangeQueue.get():
ccb.stateChangeQueue.load()
select {
case <-ccb.done:
ccb.balancer.Close()
return
default:
case t := <-ccb.scBuffer.Get():
ccb.scBuffer.Load()
if ccb.done.HasFired() {
break
}
ccb.balancerMu.Lock()
su := t.(*scStateUpdate)
if ub, ok := ccb.balancer.(balancer.V2Balancer); ok {
ub.UpdateSubConnState(t.sc, balancer.SubConnState{ConnectivityState: t.state})
ub.UpdateSubConnState(su.sc, balancer.SubConnState{ConnectivityState: su.state})
} else {
ccb.balancer.HandleSubConnStateChange(t.sc, t.state)
ccb.balancer.HandleSubConnStateChange(su.sc, su.state)
}
case s := <-ccb.ccUpdateCh:
select {
case <-ccb.done:
ccb.balancer.Close()
return
default:
}
if ub, ok := ccb.balancer.(balancer.V2Balancer); ok {
ub.UpdateClientConnState(*s)
} else {
ccb.balancer.HandleResolvedAddrs(s.ResolverState.Addresses, nil)
}
case <-ccb.done:
ccb.balancerMu.Unlock()
case <-ccb.done.Done():
}
select {
case <-ccb.done:
if ccb.done.HasFired() {
ccb.balancer.Close()
ccb.mu.Lock()
scs := ccb.subConns
@ -153,14 +93,12 @@ func (ccb *ccBalancerWrapper) watcher() {
}
ccb.UpdateBalancerState(connectivity.Connecting, nil)
return
default:
}
ccb.cc.firstResolveEvent.Fire()
}
}
func (ccb *ccBalancerWrapper) close() {
close(ccb.done)
ccb.done.Fire()
}
func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s connectivity.State) {
@ -174,30 +112,28 @@ func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s co
if sc == nil {
return
}
ccb.stateChangeQueue.put(&scStateUpdate{
ccb.scBuffer.Put(&scStateUpdate{
sc: sc,
state: s,
})
}
func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) {
if ccb.cc.curBalancerName != grpclbName {
// Filter any grpclb addresses since we don't have the grpclb balancer.
s := &ccs.ResolverState
for i := 0; i < len(s.Addresses); {
if s.Addresses[i].Type == resolver.GRPCLB {
copy(s.Addresses[i:], s.Addresses[i+1:])
s.Addresses = s.Addresses[:len(s.Addresses)-1]
continue
}
i++
}
func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) error {
ccb.balancerMu.Lock()
defer ccb.balancerMu.Unlock()
if ub, ok := ccb.balancer.(balancer.V2Balancer); ok {
return ub.UpdateClientConnState(*ccs)
}
select {
case <-ccb.ccUpdateCh:
default:
ccb.balancer.HandleResolvedAddrs(ccs.ResolverState.Addresses, nil)
return nil
}
func (ccb *ccBalancerWrapper) resolverError(err error) {
if ub, ok := ccb.balancer.(balancer.V2Balancer); ok {
ccb.balancerMu.Lock()
ub.ResolverError(err)
ccb.balancerMu.Unlock()
}
ccb.ccUpdateCh <- ccs
}
func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) {

View file

@ -31,7 +31,7 @@ import (
"time"
"google.golang.org/grpc/balancer"
_ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin.
"google.golang.org/grpc/balancer/base"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/credentials"
@ -42,10 +42,12 @@ import (
"google.golang.org/grpc/internal/transport"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/resolver"
_ "google.golang.org/grpc/resolver/dns" // To register dns resolver.
_ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver.
"google.golang.org/grpc/serviceconfig"
"google.golang.org/grpc/status"
_ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin.
_ "google.golang.org/grpc/internal/resolver/dns" // To register dns resolver.
_ "google.golang.org/grpc/internal/resolver/passthrough" // To register passthrough resolver.
)
const (
@ -186,11 +188,11 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
}
if cc.dopts.defaultServiceConfigRawJSON != nil {
sc, err := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON)
if err != nil {
return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, err)
scpr := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON)
if scpr.Err != nil {
return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, scpr.Err)
}
cc.dopts.defaultServiceConfig = sc
cc.dopts.defaultServiceConfig, _ = scpr.Config.(*ServiceConfig)
}
cc.mkp = cc.dopts.copts.KeepaliveParams
@ -235,9 +237,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
}
}
if cc.dopts.bs == nil {
cc.dopts.bs = backoff.Exponential{
MaxDelay: DefaultBackoffConfig.MaxDelay,
}
cc.dopts.bs = backoff.DefaultExponential
}
if cc.dopts.resolverBuilder == nil {
// Only try to parse target when resolver builder is not already set.
@ -443,7 +443,18 @@ func (csm *connectivityStateManager) getNotifyChan() <-chan struct{} {
return csm.notifyChan
}
// ClientConn represents a client connection to an RPC server.
// ClientConn represents a virtual connection to a conceptual endpoint, to
// perform RPCs.
//
// A ClientConn is free to have zero or more actual connections to the endpoint
// based on configuration, load, etc. It is also free to determine which actual
// endpoints to use and may change it every RPC, permitting client-side load
// balancing.
//
// A ClientConn encapsulates a range of functionality including name
// resolution, TCP connection establishment (with retries and backoff) and TLS
// handshakes. It also handles errors on established connections by
// re-resolving the name and reconnecting.
type ClientConn struct {
ctx context.Context
cancel context.CancelFunc
@ -532,58 +543,104 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error {
}
}
func (cc *ClientConn) updateResolverState(s resolver.State) error {
var emptyServiceConfig *ServiceConfig
func init() {
cfg := parseServiceConfig("{}")
if cfg.Err != nil {
panic(fmt.Sprintf("impossible error parsing empty service config: %v", cfg.Err))
}
emptyServiceConfig = cfg.Config.(*ServiceConfig)
}
func (cc *ClientConn) maybeApplyDefaultServiceConfig(addrs []resolver.Address) {
if cc.sc != nil {
cc.applyServiceConfigAndBalancer(cc.sc, addrs)
return
}
if cc.dopts.defaultServiceConfig != nil {
cc.applyServiceConfigAndBalancer(cc.dopts.defaultServiceConfig, addrs)
} else {
cc.applyServiceConfigAndBalancer(emptyServiceConfig, addrs)
}
}
func (cc *ClientConn) updateResolverState(s resolver.State, err error) error {
defer cc.firstResolveEvent.Fire()
cc.mu.Lock()
defer cc.mu.Unlock()
// Check if the ClientConn is already closed. Some fields (e.g.
// balancerWrapper) are set to nil when closing the ClientConn, and could
// cause nil pointer panic if we don't have this check.
if cc.conns == nil {
cc.mu.Unlock()
return nil
}
if cc.dopts.disableServiceConfig || s.ServiceConfig == nil {
if cc.dopts.defaultServiceConfig != nil && cc.sc == nil {
cc.applyServiceConfig(cc.dopts.defaultServiceConfig)
if err != nil {
// May need to apply the initial service config in case the resolver
// doesn't support service configs, or doesn't provide a service config
// with the new addresses.
cc.maybeApplyDefaultServiceConfig(nil)
if cc.balancerWrapper != nil {
cc.balancerWrapper.resolverError(err)
}
// No addresses are valid with err set; return early.
cc.mu.Unlock()
return balancer.ErrBadResolverState
}
var ret error
if cc.dopts.disableServiceConfig || s.ServiceConfig == nil {
cc.maybeApplyDefaultServiceConfig(s.Addresses)
// TODO: do we need to apply a failing LB policy if there is no
// default, per the error handling design?
} else {
if sc, ok := s.ServiceConfig.Config.(*ServiceConfig); s.ServiceConfig.Err == nil && ok {
cc.applyServiceConfigAndBalancer(sc, s.Addresses)
} else {
ret = balancer.ErrBadResolverState
if cc.balancerWrapper == nil {
var err error
if s.ServiceConfig.Err != nil {
err = status.Errorf(codes.Unavailable, "error parsing service config: %v", s.ServiceConfig.Err)
} else {
err = status.Errorf(codes.Unavailable, "illegal service config type: %T", s.ServiceConfig.Config)
}
cc.blockingpicker.updatePicker(base.NewErrPicker(err))
cc.csMgr.updateState(connectivity.TransientFailure)
cc.mu.Unlock()
return ret
}
}
} else if sc, ok := s.ServiceConfig.(*ServiceConfig); ok {
cc.applyServiceConfig(sc)
}
var balCfg serviceconfig.LoadBalancingConfig
if cc.dopts.balancerBuilder == nil {
// Only look at balancer types and switch balancer if balancer dial
// option is not set.
var newBalancerName string
if cc.sc != nil && cc.sc.lbConfig != nil {
newBalancerName = cc.sc.lbConfig.name
balCfg = cc.sc.lbConfig.cfg
} else {
var isGRPCLB bool
for _, a := range s.Addresses {
if a.Type == resolver.GRPCLB {
isGRPCLB = true
break
}
}
if isGRPCLB {
newBalancerName = grpclbName
} else if cc.sc != nil && cc.sc.LB != nil {
newBalancerName = *cc.sc.LB
} else {
newBalancerName = PickFirstBalancerName
}
}
cc.switchBalancer(newBalancerName)
} else if cc.balancerWrapper == nil {
// Balancer dial option was set, and this is the first time handling
// resolved addresses. Build a balancer with dopts.balancerBuilder.
cc.curBalancerName = cc.dopts.balancerBuilder.Name()
cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts)
if cc.dopts.balancerBuilder == nil && cc.sc != nil && cc.sc.lbConfig != nil {
balCfg = cc.sc.lbConfig.cfg
}
cc.balancerWrapper.updateClientConnState(&balancer.ClientConnState{ResolverState: s, BalancerConfig: balCfg})
return nil
cbn := cc.curBalancerName
bw := cc.balancerWrapper
cc.mu.Unlock()
if cbn != grpclbName {
// Filter any grpclb addresses since we don't have the grpclb balancer.
for i := 0; i < len(s.Addresses); {
if s.Addresses[i].Type == resolver.GRPCLB {
copy(s.Addresses[i:], s.Addresses[i+1:])
s.Addresses = s.Addresses[:len(s.Addresses)-1]
continue
}
i++
}
}
uccsErr := bw.updateClientConnState(&balancer.ClientConnState{ResolverState: s, BalancerConfig: balCfg})
if ret == nil {
ret = uccsErr // prefer ErrBadResolver state since any other error is
// currently meaningless to the caller.
}
return ret
}
// switchBalancer starts the switching from current balancer to the balancer
@ -831,10 +888,10 @@ func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method st
return t, done, nil
}
func (cc *ClientConn) applyServiceConfig(sc *ServiceConfig) error {
func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, addrs []resolver.Address) {
if sc == nil {
// should never reach here.
return fmt.Errorf("got nil pointer for service config")
return
}
cc.sc = sc
@ -850,7 +907,35 @@ func (cc *ClientConn) applyServiceConfig(sc *ServiceConfig) error {
cc.retryThrottler.Store((*retryThrottler)(nil))
}
return nil
if cc.dopts.balancerBuilder == nil {
// Only look at balancer types and switch balancer if balancer dial
// option is not set.
var newBalancerName string
if cc.sc != nil && cc.sc.lbConfig != nil {
newBalancerName = cc.sc.lbConfig.name
} else {
var isGRPCLB bool
for _, a := range addrs {
if a.Type == resolver.GRPCLB {
isGRPCLB = true
break
}
}
if isGRPCLB {
newBalancerName = grpclbName
} else if cc.sc != nil && cc.sc.LB != nil {
newBalancerName = *cc.sc.LB
} else {
newBalancerName = PickFirstBalancerName
}
}
cc.switchBalancer(newBalancerName)
} else if cc.balancerWrapper == nil {
// Balancer dial option was set, and this is the first time handling
// resolved addresses. Build a balancer with dopts.balancerBuilder.
cc.curBalancerName = cc.dopts.balancerBuilder.Name()
cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts)
}
}
func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) {
@ -875,8 +960,9 @@ func (cc *ClientConn) resolveNow(o resolver.ResolveNowOption) {
// This API is EXPERIMENTAL.
func (cc *ClientConn) ResetConnectBackoff() {
cc.mu.Lock()
defer cc.mu.Unlock()
for ac := range cc.conns {
conns := cc.conns
cc.mu.Unlock()
for ac := range conns {
ac.resetConnectBackoff()
}
}
@ -1136,10 +1222,16 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
onCloseCalled := make(chan struct{})
reconnect := grpcsync.NewEvent()
authority := ac.cc.authority
// addr.ServerName takes precedent over ClientConn authority, if present.
if addr.ServerName != "" {
authority = addr.ServerName
}
target := transport.TargetInfo{
Addr: addr.Addr,
Metadata: addr.Metadata,
Authority: ac.cc.authority,
Authority: authority,
}
once := sync.Once{}
@ -1331,7 +1423,7 @@ func (ac *addrConn) tearDown(err error) {
curTr := ac.transport
ac.transport = nil
// We have to set the state to Shutdown before anything else to prevent races
// between setting the state and logic that waits on context cancelation / etc.
// between setting the state and logic that waits on context cancellation / etc.
ac.updateConnectivityState(connectivity.Shutdown)
ac.cancel()
ac.curAddr = resolver.Address{}
@ -1355,7 +1447,7 @@ func (ac *addrConn) tearDown(err error) {
},
})
// TraceEvent needs to be called before RemoveEntry, as TraceEvent may add trace reference to
// the entity beng deleted, and thus prevent it from being deleted right away.
// the entity being deleted, and thus prevent it from being deleted right away.
channelz.RemoveEntry(ac.channelzID)
}
ac.mu.Unlock()

View file

@ -30,10 +30,11 @@ import (
"fmt"
"io/ioutil"
"net"
"strings"
"github.com/golang/protobuf/proto"
"google.golang.org/grpc/credentials/internal"
ginternal "google.golang.org/grpc/internal"
)
// PerRPCCredentials defines the common interface for the credentials which need to
@ -45,7 +46,8 @@ type PerRPCCredentials interface {
// context. If a status code is returned, it will be used as the status
// for the RPC. uri is the URI of the entry point for the request.
// When supported by the underlying implementation, ctx can be used for
// timeout and cancellation.
// timeout and cancellation. Additionally, RequestInfo data will be
// available via ctx to this call.
// TODO(zhaoq): Define the set of the qualified keys instead of leaving
// it as an arbitrary string.
GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
@ -166,11 +168,12 @@ func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawCon
// use local cfg to avoid clobbering ServerName if using multiple endpoints
cfg := cloneTLSConfig(c.config)
if cfg.ServerName == "" {
colonPos := strings.LastIndex(authority, ":")
if colonPos == -1 {
colonPos = len(authority)
serverName, _, err := net.SplitHostPort(authority)
if err != nil {
// If the authority had no host port or if the authority cannot be parsed, use it as-is.
serverName = authority
}
cfg.ServerName = authority[:colonPos]
cfg.ServerName = serverName
}
conn := tls.Client(rawConn, cfg)
errChannel := make(chan error, 1)
@ -334,3 +337,28 @@ func cloneTLSConfig(cfg *tls.Config) *tls.Config {
return cfg.Clone()
}
// RequestInfo contains request data attached to the context passed to GetRequestMetadata calls.
//
// This API is experimental.
type RequestInfo struct {
// The method passed to Invoke or NewStream for this RPC. (For proto methods, this has the format "/some.Service/Method")
Method string
}
// requestInfoKey is a struct to be used as the key when attaching a RequestInfo to a context object.
type requestInfoKey struct{}
// RequestInfoFromContext extracts the RequestInfo from the context if it exists.
//
// This API is experimental.
func RequestInfoFromContext(ctx context.Context) (ri RequestInfo, ok bool) {
ri, ok = ctx.Value(requestInfoKey{}).(RequestInfo)
return
}
func init() {
ginternal.NewRequestInfoContext = func(ctx context.Context, ri RequestInfo) context.Context {
return context.WithValue(ctx, requestInfoKey{}, ri)
}
}

View file

@ -24,11 +24,12 @@ import (
"net"
"time"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/internal/backoff"
internalbackoff "google.golang.org/grpc/internal/backoff"
"google.golang.org/grpc/internal/envconfig"
"google.golang.org/grpc/internal/transport"
"google.golang.org/grpc/keepalive"
@ -47,7 +48,7 @@ type dialOptions struct {
cp Compressor
dc Decompressor
bs backoff.Strategy
bs internalbackoff.Strategy
block bool
insecure bool
timeout time.Duration
@ -68,6 +69,10 @@ type dialOptions struct {
minConnectTimeout func() time.Duration
defaultServiceConfig *ServiceConfig // defaultServiceConfig is parsed from defaultServiceConfigRawJSON.
defaultServiceConfigRawJSON *string
// This is used by ccResolverWrapper to backoff between successive calls to
// resolver.ResolveNow(). The user will have no need to configure this, but
// we need to be able to configure this in tests.
resolveNowBackoff func(int) time.Duration
}
// DialOption configures how we set up the connection.
@ -246,8 +251,28 @@ func WithServiceConfig(c <-chan ServiceConfig) DialOption {
})
}
// WithConnectParams configures the dialer to use the provided ConnectParams.
//
// The backoff configuration specified as part of the ConnectParams overrides
// all defaults specified in
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md. Consider
// using the backoff.DefaultConfig as a base, in cases where you want to
// override only a subset of the backoff configuration.
//
// This API is EXPERIMENTAL.
func WithConnectParams(p ConnectParams) DialOption {
return newFuncDialOption(func(o *dialOptions) {
o.bs = internalbackoff.Exponential{Config: p.Backoff}
o.minConnectTimeout = func() time.Duration {
return p.MinConnectTimeout
}
})
}
// WithBackoffMaxDelay configures the dialer to use the provided maximum delay
// when backing off after failed connection attempts.
//
// Deprecated: use WithConnectParams instead. Will be supported throughout 1.x.
func WithBackoffMaxDelay(md time.Duration) DialOption {
return WithBackoffConfig(BackoffConfig{MaxDelay: md})
}
@ -255,19 +280,18 @@ func WithBackoffMaxDelay(md time.Duration) DialOption {
// WithBackoffConfig configures the dialer to use the provided backoff
// parameters after connection failures.
//
// Use WithBackoffMaxDelay until more parameters on BackoffConfig are opened up
// for use.
// Deprecated: use WithConnectParams instead. Will be supported throughout 1.x.
func WithBackoffConfig(b BackoffConfig) DialOption {
return withBackoff(backoff.Exponential{
MaxDelay: b.MaxDelay,
})
bc := backoff.DefaultConfig
bc.MaxDelay = b.MaxDelay
return withBackoff(internalbackoff.Exponential{Config: bc})
}
// withBackoff sets the backoff strategy used for connectRetryNum after a failed
// connection attempt.
//
// This can be exported if arbitrary backoff strategies are allowed by gRPC.
func withBackoff(bs backoff.Strategy) DialOption {
func withBackoff(bs internalbackoff.Strategy) DialOption {
return newFuncDialOption(func(o *dialOptions) {
o.bs = bs
})
@ -539,6 +563,7 @@ func defaultDialOptions() dialOptions {
WriteBufferSize: defaultWriteBufSize,
ReadBufferSize: defaultReadBufSize,
},
resolveNowBackoff: internalbackoff.DefaultExponential.Backoff,
}
}
@ -552,3 +577,13 @@ func withMinConnectDeadline(f func() time.Duration) DialOption {
o.minConnectTimeout = f
})
}
// withResolveNowBackoff specifies the function that clientconn uses to backoff
// between successive calls to resolver.ResolveNow().
//
// For testing purpose only.
func withResolveNowBackoff(f func(int) time.Duration) DialOption {
return newFuncDialOption(func(o *dialOptions) {
o.resolveNowBackoff = f
})
}

View file

@ -46,6 +46,10 @@ type Compressor interface {
// coding header. The result must be static; the result cannot change
// between calls.
Name() string
// EXPERIMENTAL: if a Compressor implements
// DecompressedSize(compressedBytes []byte) int, gRPC will call it
// to determine the size of the buffer allocated for the result of decompression.
// Return -1 to indicate unknown size.
}
var registeredCompressor = make(map[string]Compressor)

15
vendor/google.golang.org/grpc/go.mod generated vendored
View file

@ -1,19 +1,16 @@
module google.golang.org/grpc
go 1.11
require (
cloud.google.com/go v0.26.0 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/client9/misspell v0.3.4
github.com/envoyproxy/go-control-plane v0.9.0
github.com/envoyproxy/protoc-gen-validate v0.1.0
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/mock v1.1.1
github.com/golang/protobuf v1.2.0
github.com/golang/protobuf v1.3.2
github.com/google/go-cmp v0.2.0
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
golang.org/x/net v0.0.0-20190311183353-d8887717615a
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135
google.golang.org/appengine v1.1.0 // indirect
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55
)

36
vendor/google.golang.org/grpc/go.sum generated vendored
View file

@ -1,37 +1,53 @@
cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/envoyproxy/go-control-plane v0.9.0 h1:67WMNTvGrl7V1dWdKCeTwxDr7nio9clKoTlLhwIPnT4=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View file

@ -89,7 +89,7 @@ func Fatal(args ...interface{}) {
}
// Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf.
// It calles os.Exit() with exit code 1.
// It calls os.Exit() with exit code 1.
func Fatalf(format string, args ...interface{}) {
logger.Fatalf(format, args...)
// Make sure fatal logs will exit.

View file

@ -25,44 +25,39 @@ package backoff
import (
"time"
grpcbackoff "google.golang.org/grpc/backoff"
"google.golang.org/grpc/internal/grpcrand"
)
// Strategy defines the methodology for backing off after a grpc connection
// failure.
//
type Strategy interface {
// Backoff returns the amount of time to wait before the next retry given
// the number of consecutive failures.
Backoff(retries int) time.Duration
}
const (
// baseDelay is the amount of time to wait before retrying after the first
// failure.
baseDelay = 1.0 * time.Second
// factor is applied to the backoff after each retry.
factor = 1.6
// jitter provides a range to randomize backoff delays.
jitter = 0.2
)
// DefaultExponential is an exponential backoff implementation using the
// default values for all the configurable knobs defined in
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
var DefaultExponential = Exponential{Config: grpcbackoff.DefaultConfig}
// Exponential implements exponential backoff algorithm as defined in
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.
type Exponential struct {
// MaxDelay is the upper bound of backoff delay.
MaxDelay time.Duration
// Config contains all options to configure the backoff algorithm.
Config grpcbackoff.Config
}
// Backoff returns the amount of time to wait before the next retry given the
// number of retries.
func (bc Exponential) Backoff(retries int) time.Duration {
if retries == 0 {
return baseDelay
return bc.Config.BaseDelay
}
backoff, max := float64(baseDelay), float64(bc.MaxDelay)
backoff, max := float64(bc.Config.BaseDelay), float64(bc.Config.MaxDelay)
for backoff < max && retries > 0 {
backoff *= factor
backoff *= bc.Config.Multiplier
retries--
}
if backoff > max {
@ -70,7 +65,7 @@ func (bc Exponential) Backoff(retries int) time.Duration {
}
// Randomize backoff delays so that if a cluster of requests start at
// the same time, they won't operate in lockstep.
backoff *= 1 + jitter*(grpcrand.Float64()*2-1)
backoff *= 1 + bc.Config.Jitter*(grpcrand.Float64()*2-1)
if backoff < 0 {
return 0
}

View file

@ -34,7 +34,7 @@ type Logger interface {
}
// binLogger is the global binary logger for the binary. One of this should be
// built at init time from the configuration (environment varialbe or flags).
// built at init time from the configuration (environment variable or flags).
//
// It is used to get a methodLogger for each individual method.
var binLogger Logger

View file

@ -43,7 +43,7 @@ import (
// Foo.
//
// If two configs exist for one certain method or service, the one specified
// later overrides the privous config.
// later overrides the previous config.
func NewLoggerFromConfigString(s string) Logger {
if s == "" {
return nil
@ -74,7 +74,7 @@ func (l *logger) fillMethodLoggerWithConfigString(config string) error {
return fmt.Errorf("invalid config: %q, %v", config, err)
}
if m == "*" {
return fmt.Errorf("invalid config: %q, %v", config, "* not allowd in blacklist config")
return fmt.Errorf("invalid config: %q, %v", config, "* not allowed in blacklist config")
}
if suffix != "" {
return fmt.Errorf("invalid config: %q, %v", config, "header/message limit not allowed in blacklist config")

View file

@ -63,7 +63,7 @@ func (ns *noopSink) Close() error { return nil }
// newWriterSink creates a binary log sink with the given writer.
//
// Write() marshalls the proto message and writes it to the given writer. Each
// Write() marshals the proto message and writes it to the given writer. Each
// message is prefixed with a 4 byte big endian unsigned integer as the length.
//
// No buffer is done, Close() doesn't try to close the writer.

View file

@ -0,0 +1,78 @@
/*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// Package buffer provides an implementation of an unbounded buffer.
package buffer
import "sync"
// Unbounded is an implementation of an unbounded buffer which does not use
// extra goroutines. This is typically used for passing updates from one entity
// to another within gRPC.
//
// All methods on this type are thread-safe and don't block on anything except
// the underlying mutex used for synchronization.
type Unbounded struct {
c chan interface{}
mu sync.Mutex
backlog []interface{}
}
// NewUnbounded returns a new instance of Unbounded.
func NewUnbounded() *Unbounded {
return &Unbounded{c: make(chan interface{}, 1)}
}
// Put adds t to the unbounded buffer.
func (b *Unbounded) Put(t interface{}) {
b.mu.Lock()
if len(b.backlog) == 0 {
select {
case b.c <- t:
b.mu.Unlock()
return
default:
}
}
b.backlog = append(b.backlog, t)
b.mu.Unlock()
}
// Load sends the earliest buffered data, if any, onto the read channel
// returned by Get(). Users are expected to call this every time they read a
// value from the read channel.
func (b *Unbounded) Load() {
b.mu.Lock()
if len(b.backlog) > 0 {
select {
case b.c <- b.backlog[0]:
b.backlog[0] = nil
b.backlog = b.backlog[1:]
default:
}
}
b.mu.Unlock()
}
// Get returns a read channel on which values added to the buffer, via Put(),
// are sent on.
//
// Upon reading a value from this channel, users are expected to call Load() to
// send the next buffered value onto the channel if there is any.
func (b *Unbounded) Get() <-chan interface{} {
return b.c
}

View file

@ -28,9 +28,9 @@ import (
)
var (
// WithResolverBuilder is exported by dialoptions.go
// WithResolverBuilder is set by dialoptions.go
WithResolverBuilder interface{} // func (resolver.Builder) grpc.DialOption
// WithHealthCheckFunc is not exported by dialoptions.go
// WithHealthCheckFunc is set by dialoptions.go
WithHealthCheckFunc interface{} // func (HealthChecker) DialOption
// HealthCheckFunc is used to provide client-side LB channel health checking
HealthCheckFunc HealthChecker
@ -39,14 +39,17 @@ var (
// KeepaliveMinPingTime is the minimum ping interval. This must be 10s by
// default, but tests may wish to set it lower for convenience.
KeepaliveMinPingTime = 10 * time.Second
// ParseServiceConfig is a function to parse JSON service configs into
// opaque data structures.
ParseServiceConfig func(sc string) (interface{}, error)
// StatusRawProto is exported by status/status.go. This func returns a
// pointer to the wrapped Status proto for a given status.Status without a
// call to proto.Clone(). The returned Status proto should not be mutated by
// the caller.
StatusRawProto interface{} // func (*status.Status) *spb.Status
// NewRequestInfoContext creates a new context based on the argument context attaching
// the passed in RequestInfo to the new context.
NewRequestInfoContext interface{} // func(context.Context, credentials.RequestInfo) context.Context
// ParseServiceConfigForTesting is for creating a fake
// ClientConn for resolver testing only
ParseServiceConfigForTesting interface{} // func(string) *serviceconfig.ParseResult
)
// HealthChecker defines the signature of the client-side LB channel health checking function.

View file

@ -32,8 +32,9 @@ import (
"sync"
"time"
"google.golang.org/grpc/backoff"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/backoff"
internalbackoff "google.golang.org/grpc/internal/backoff"
"google.golang.org/grpc/internal/grpcrand"
"google.golang.org/grpc/resolver"
)
@ -126,9 +127,11 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts
// DNS address (non-IP).
ctx, cancel := context.WithCancel(context.Background())
bc := backoff.DefaultConfig
bc.MaxDelay = b.minFreq
d := &dnsResolver{
freq: b.minFreq,
backoff: backoff.Exponential{MaxDelay: b.minFreq},
backoff: internalbackoff.Exponential{Config: bc},
host: host,
port: port,
ctx: ctx,
@ -200,7 +203,7 @@ func (i *ipResolver) watcher() {
// dnsResolver watches for the name resolution update for a non-IP target.
type dnsResolver struct {
freq time.Duration
backoff backoff.Exponential
backoff internalbackoff.Exponential
retryCount int
host string
port string

View file

@ -107,8 +107,8 @@ func (*registerStream) isTransportResponseFrame() bool { return false }
type headerFrame struct {
streamID uint32
hf []hpack.HeaderField
endStream bool // Valid on server side.
initStream func(uint32) (bool, error) // Used only on the client side.
endStream bool // Valid on server side.
initStream func(uint32) error // Used only on the client side.
onWrite func()
wq *writeQuota // write quota for the stream created.
cleanup *cleanupStream // Valid on the server side.
@ -637,21 +637,17 @@ func (l *loopyWriter) headerHandler(h *headerFrame) error {
func (l *loopyWriter) originateStream(str *outStream) error {
hdr := str.itl.dequeue().(*headerFrame)
sendPing, err := hdr.initStream(str.id)
if err != nil {
if err := hdr.initStream(str.id); err != nil {
if err == ErrConnClosing {
return err
}
// Other errors(errStreamDrain) need not close transport.
return nil
}
if err = l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil {
if err := l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil {
return err
}
l.estdStreams[str.id] = str
if sendPing {
return l.pingHandler(&ping{data: [8]byte{}})
}
return nil
}

View file

@ -35,6 +35,7 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/internal/channelz"
"google.golang.org/grpc/internal/syscall"
"google.golang.org/grpc/keepalive"
@ -46,6 +47,7 @@ import (
// http2Client implements the ClientTransport interface with HTTP2.
type http2Client struct {
lastRead int64 // keep this field 64-bit aligned
ctx context.Context
cancel context.CancelFunc
ctxDone <-chan struct{} // Cache the ctx.Done() chan.
@ -62,8 +64,6 @@ type http2Client struct {
// goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor)
// that the server sent GoAway on this transport.
goAway chan struct{}
// awakenKeepalive is used to wake up keepalive when after it has gone dormant.
awakenKeepalive chan struct{}
framer *framer
// controlBuf delivers all the control related tasks (e.g., window
@ -77,9 +77,6 @@ type http2Client struct {
perRPCCreds []credentials.PerRPCCredentials
// Boolean to keep track of reading activity on transport.
// 1 is true and 0 is false.
activity uint32 // Accessed atomically.
kp keepalive.ClientParameters
keepaliveEnabled bool
@ -110,6 +107,16 @@ type http2Client struct {
// goAwayReason records the http2.ErrCode and debug data received with the
// GoAway frame.
goAwayReason GoAwayReason
// A condition variable used to signal when the keepalive goroutine should
// go dormant. The condition for dormancy is based on the number of active
// streams and the `PermitWithoutStream` keepalive client parameter. And
// since the number of active streams is guarded by the above mutex, we use
// the same for this condition variable as well.
kpDormancyCond *sync.Cond
// A boolean to track whether the keepalive goroutine is dormant or not.
// This is checked before attempting to signal the above condition
// variable.
kpDormant bool
// Fields below are for channelz metric collection.
channelzID int64 // channelz unique identification number
@ -232,7 +239,6 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne
readerDone: make(chan struct{}),
writerDone: make(chan struct{}),
goAway: make(chan struct{}),
awakenKeepalive: make(chan struct{}, 1),
framer: newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize),
fc: &trInFlow{limit: uint32(icwz)},
scheme: scheme,
@ -264,9 +270,6 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne
updateFlowControl: t.updateFlowControl,
}
}
// Make sure awakenKeepalive can't be written upon.
// keepalive routine will make it writable, if need be.
t.awakenKeepalive <- struct{}{}
if t.statsHandler != nil {
t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{
RemoteAddr: t.remoteAddr,
@ -281,6 +284,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne
t.channelzID = channelz.RegisterNormalSocket(t, opts.ChannelzParentID, fmt.Sprintf("%s -> %s", t.localAddr, t.remoteAddr))
}
if t.keepaliveEnabled {
t.kpDormancyCond = sync.NewCond(&t.mu)
go t.keepalive()
}
// Start the reader goroutine for incoming message. Each transport has
@ -347,6 +351,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne
func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream {
// TODO(zhaoq): Handle uint32 overflow of Stream.id.
s := &Stream{
ct: t,
done: make(chan struct{}),
method: callHdr.Method,
sendCompress: callHdr.SendCompress,
@ -380,23 +385,23 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream {
}
func (t *http2Client) getPeer() *peer.Peer {
pr := &peer.Peer{
Addr: t.remoteAddr,
return &peer.Peer{
Addr: t.remoteAddr,
AuthInfo: t.authInfo,
}
// Attach Auth info if there is any.
if t.authInfo != nil {
pr.AuthInfo = t.authInfo
}
return pr
}
func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) ([]hpack.HeaderField, error) {
aud := t.createAudience(callHdr)
authData, err := t.getTrAuthData(ctx, aud)
ri := credentials.RequestInfo{
Method: callHdr.Method,
}
ctxWithRequestInfo := internal.NewRequestInfoContext.(func(context.Context, credentials.RequestInfo) context.Context)(ctx, ri)
authData, err := t.getTrAuthData(ctxWithRequestInfo, aud)
if err != nil {
return nil, err
}
callAuthData, err := t.getCallAuthData(ctx, aud, callHdr)
callAuthData, err := t.getCallAuthData(ctxWithRequestInfo, aud, callHdr)
if err != nil {
return nil, err
}
@ -564,7 +569,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea
hdr := &headerFrame{
hf: headerFields,
endStream: false,
initStream: func(id uint32) (bool, error) {
initStream: func(id uint32) error {
t.mu.Lock()
if state := t.state; state != reachable {
t.mu.Unlock()
@ -574,29 +579,19 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea
err = ErrConnClosing
}
cleanup(err)
return false, err
return err
}
t.activeStreams[id] = s
if channelz.IsOn() {
atomic.AddInt64(&t.czData.streamsStarted, 1)
atomic.StoreInt64(&t.czData.lastStreamCreatedTime, time.Now().UnixNano())
}
var sendPing bool
// If the number of active streams change from 0 to 1, then check if keepalive
// has gone dormant. If so, wake it up.
if len(t.activeStreams) == 1 && t.keepaliveEnabled {
select {
case t.awakenKeepalive <- struct{}{}:
sendPing = true
// Fill the awakenKeepalive channel again as this channel must be
// kept non-writable except at the point that the keepalive()
// goroutine is waiting either to be awaken or shutdown.
t.awakenKeepalive <- struct{}{}
default:
}
// If the keepalive goroutine has gone dormant, wake it up.
if t.kpDormant {
t.kpDormancyCond.Signal()
}
t.mu.Unlock()
return sendPing, nil
return nil
},
onOrphaned: cleanup,
wq: s.wq,
@ -778,6 +773,11 @@ func (t *http2Client) Close() error {
t.state = closing
streams := t.activeStreams
t.activeStreams = nil
if t.kpDormant {
// If the keepalive goroutine is blocked on this condition variable, we
// should unblock it so that the goroutine eventually exits.
t.kpDormancyCond.Signal()
}
t.mu.Unlock()
t.controlBuf.finish()
t.cancel()
@ -853,11 +853,11 @@ func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) e
return t.controlBuf.put(df)
}
func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) {
func (t *http2Client) getStream(f http2.Frame) *Stream {
t.mu.Lock()
defer t.mu.Unlock()
s, ok := t.activeStreams[f.Header().StreamID]
return s, ok
s := t.activeStreams[f.Header().StreamID]
t.mu.Unlock()
return s
}
// adjustWindow sends out extra window update over the initial window size
@ -937,8 +937,8 @@ func (t *http2Client) handleData(f *http2.DataFrame) {
t.controlBuf.put(bdpPing)
}
// Select the right stream to dispatch.
s, ok := t.getStream(f)
if !ok {
s := t.getStream(f)
if s == nil {
return
}
if size > 0 {
@ -969,8 +969,8 @@ func (t *http2Client) handleData(f *http2.DataFrame) {
}
func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) {
s, ok := t.getStream(f)
if !ok {
s := t.getStream(f)
if s == nil {
return
}
if f.ErrCode == http2.ErrCodeRefusedStream {
@ -1147,8 +1147,8 @@ func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) {
// operateHeaders takes action on the decoded headers.
func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
s, ok := t.getStream(frame)
if !ok {
s := t.getStream(frame)
if s == nil {
return
}
endStream := frame.StreamEnded()
@ -1191,6 +1191,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) {
// If headerChan hasn't been closed yet
if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) {
s.headerValid = true
if !endStream {
// HEADERS frame block carries a Response-Headers.
isHeader = true
@ -1233,7 +1234,7 @@ func (t *http2Client) reader() {
}
t.conn.SetReadDeadline(time.Time{}) // reset deadline once we get the settings frame (we didn't time out, yay!)
if t.keepaliveEnabled {
atomic.CompareAndSwapUint32(&t.activity, 0, 1)
atomic.StoreInt64(&t.lastRead, time.Now().UnixNano())
}
sf, ok := frame.(*http2.SettingsFrame)
if !ok {
@ -1248,7 +1249,7 @@ func (t *http2Client) reader() {
t.controlBuf.throttle()
frame, err := t.framer.fr.ReadFrame()
if t.keepaliveEnabled {
atomic.CompareAndSwapUint32(&t.activity, 0, 1)
atomic.StoreInt64(&t.lastRead, time.Now().UnixNano())
}
if err != nil {
// Abort an active stream if the http2.Framer returns a
@ -1292,56 +1293,84 @@ func (t *http2Client) reader() {
}
}
func minTime(a, b time.Duration) time.Duration {
if a < b {
return a
}
return b
}
// keepalive running in a separate goroutune makes sure the connection is alive by sending pings.
func (t *http2Client) keepalive() {
p := &ping{data: [8]byte{}}
// True iff a ping has been sent, and no data has been received since then.
outstandingPing := false
// Amount of time remaining before which we should receive an ACK for the
// last sent ping.
timeoutLeft := time.Duration(0)
// Records the last value of t.lastRead before we go block on the timer.
// This is required to check for read activity since then.
prevNano := time.Now().UnixNano()
timer := time.NewTimer(t.kp.Time)
for {
select {
case <-timer.C:
if atomic.CompareAndSwapUint32(&t.activity, 1, 0) {
timer.Reset(t.kp.Time)
lastRead := atomic.LoadInt64(&t.lastRead)
if lastRead > prevNano {
// There has been read activity since the last time we were here.
outstandingPing = false
// Next timer should fire at kp.Time seconds from lastRead time.
timer.Reset(time.Duration(lastRead) + t.kp.Time - time.Duration(time.Now().UnixNano()))
prevNano = lastRead
continue
}
// Check if keepalive should go dormant.
if outstandingPing && timeoutLeft <= 0 {
t.Close()
return
}
t.mu.Lock()
if t.state == closing {
// If the transport is closing, we should exit from the
// keepalive goroutine here. If not, we could have a race
// between the call to Signal() from Close() and the call to
// Wait() here, whereby the keepalive goroutine ends up
// blocking on the condition variable which will never be
// signalled again.
t.mu.Unlock()
return
}
if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream {
// Make awakenKeepalive writable.
<-t.awakenKeepalive
t.mu.Unlock()
select {
case <-t.awakenKeepalive:
// If the control gets here a ping has been sent
// need to reset the timer with keepalive.Timeout.
case <-t.ctx.Done():
return
}
} else {
t.mu.Unlock()
// If a ping was sent out previously (because there were active
// streams at that point) which wasn't acked and its timeout
// hadn't fired, but we got here and are about to go dormant,
// we should make sure that we unconditionally send a ping once
// we awaken.
outstandingPing = false
t.kpDormant = true
t.kpDormancyCond.Wait()
}
t.kpDormant = false
t.mu.Unlock()
// We get here either because we were dormant and a new stream was
// created which unblocked the Wait() call, or because the
// keepalive timer expired. In both cases, we need to send a ping.
if !outstandingPing {
if channelz.IsOn() {
atomic.AddInt64(&t.czData.kpCount, 1)
}
// Send ping.
t.controlBuf.put(p)
timeoutLeft = t.kp.Timeout
outstandingPing = true
}
// By the time control gets here a ping has been sent one way or the other.
timer.Reset(t.kp.Timeout)
select {
case <-timer.C:
if atomic.CompareAndSwapUint32(&t.activity, 1, 0) {
timer.Reset(t.kp.Time)
continue
}
infof("transport: closing client transport due to idleness.")
t.Close()
return
case <-t.ctx.Done():
if !timer.Stop() {
<-timer.C
}
return
}
// The amount of time to sleep here is the minimum of kp.Time and
// timeoutLeft. This will ensure that we wait only for kp.Time
// before sending out the next ping (for cases where the ping is
// acked).
sleepDuration := minTime(t.kp.Time, timeoutLeft)
timeoutLeft -= sleepDuration
prevNano = lastRead
timer.Reset(sleepDuration)
case <-t.ctx.Done():
if !timer.Stop() {
<-timer.C

View file

@ -65,8 +65,7 @@ var (
// http2Server implements the ServerTransport interface with HTTP2.
type http2Server struct {
ctx context.Context
ctxDone <-chan struct{} // Cache the context.Done() chan
cancel context.CancelFunc
done chan struct{}
conn net.Conn
loopy *loopyWriter
readerDone chan struct{} // sync point to enable testing.
@ -138,7 +137,10 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
}
framer := newFramer(conn, writeBufSize, readBufSize, maxHeaderListSize)
// Send initial settings as connection preface to client.
var isettings []http2.Setting
isettings := []http2.Setting{{
ID: http2.SettingMaxFrameSize,
Val: http2MaxFrameLen,
}}
// TODO(zhaoq): Have a better way to signal "no limit" because 0 is
// permitted in the HTTP2 spec.
maxStreams := config.MaxStreams
@ -172,6 +174,12 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
Val: *config.MaxHeaderListSize,
})
}
if config.HeaderTableSize != nil {
isettings = append(isettings, http2.Setting{
ID: http2.SettingHeaderTableSize,
Val: *config.HeaderTableSize,
})
}
if err := framer.fr.WriteSettings(isettings...); err != nil {
return nil, connectionErrorf(false, err, "transport: %v", err)
}
@ -203,11 +211,10 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
if kep.MinTime == 0 {
kep.MinTime = defaultKeepalivePolicyMinTime
}
ctx, cancel := context.WithCancel(context.Background())
done := make(chan struct{})
t := &http2Server{
ctx: ctx,
cancel: cancel,
ctxDone: ctx.Done(),
ctx: context.Background(),
done: done,
conn: conn,
remoteAddr: conn.RemoteAddr(),
localAddr: conn.LocalAddr(),
@ -228,7 +235,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
czData: new(channelzData),
bufferPool: newBufferPool(),
}
t.controlBuf = newControlBuffer(t.ctxDone)
t.controlBuf = newControlBuffer(t.done)
if dynamicWindow {
t.bdpEst = &bdpEstimator{
bdp: initialWindowSize,
@ -359,12 +366,14 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
rstCode: http2.ErrCodeRefusedStream,
onWrite: func() {},
})
s.cancel()
return false
}
}
t.mu.Lock()
if t.state != reachable {
t.mu.Unlock()
s.cancel()
return false
}
if uint32(len(t.activeStreams)) >= t.maxStreams {
@ -375,12 +384,14 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
rstCode: http2.ErrCodeRefusedStream,
onWrite: func() {},
})
s.cancel()
return false
}
if streamID%2 != 1 || streamID <= t.maxStreamID {
t.mu.Unlock()
// illegal gRPC stream id.
errorf("transport: http2Server.HandleStreams received an illegal stream id: %v", streamID)
s.cancel()
return true
}
t.maxStreamID = streamID
@ -746,7 +757,7 @@ func (t *http2Server) checkForHeaderListSize(it interface{}) bool {
return true
}
// WriteHeader sends the header metedata md back to the client.
// WriteHeader sends the header metadata md back to the client.
func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {
if s.updateHeaderSent() || s.getState() == streamDone {
return ErrIllegalHeaderWrite
@ -882,7 +893,7 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e
// TODO(mmukhi, dfawley): Should the server write also return io.EOF?
s.cancel()
select {
case <-t.ctx.Done():
case <-t.done:
return ErrConnClosing
default:
}
@ -904,7 +915,7 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e
}
if err := s.wq.get(int32(len(hdr) + len(data))); err != nil {
select {
case <-t.ctx.Done():
case <-t.done:
return ErrConnClosing
default:
}
@ -970,7 +981,7 @@ func (t *http2Server) keepalive() {
t.Close()
// Resetting the timer so that the clean-up doesn't deadlock.
maxAge.Reset(infinity)
case <-t.ctx.Done():
case <-t.done:
}
return
case <-keepalive.C:
@ -992,7 +1003,7 @@ func (t *http2Server) keepalive() {
}
t.controlBuf.put(p)
keepalive.Reset(t.kp.Timeout)
case <-t.ctx.Done():
case <-t.done:
return
}
}
@ -1012,7 +1023,7 @@ func (t *http2Server) Close() error {
t.activeStreams = nil
t.mu.Unlock()
t.controlBuf.finish()
t.cancel()
close(t.done)
err := t.conn.Close()
if channelz.IsOn() {
channelz.RemoveEntry(t.channelzID)
@ -1152,7 +1163,7 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) {
select {
case <-t.drainChan:
case <-timer.C:
case <-t.ctx.Done():
case <-t.done:
return
}
t.controlBuf.put(&goAway{code: g.code, debugData: g.debugData})
@ -1202,7 +1213,7 @@ func (t *http2Server) getOutFlowWindow() int64 {
select {
case sz := <-resp:
return int64(sz)
case <-t.ctxDone:
case <-t.done:
return -1
case <-timer.C:
return -2

View file

@ -667,6 +667,7 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, maxHeaderList
writer: w,
fr: http2.NewFramer(w, r),
}
f.fr.SetMaxReadFrameSize(http2MaxFrameLen)
// Opt-in to Frame reuse API on framer to reduce garbage.
// Frames aren't safe to read from after a subsequent call to ReadFrame.
f.fr.SetReuseFrames()

View file

@ -233,6 +233,7 @@ const (
type Stream struct {
id uint32
st ServerTransport // nil for client side Stream
ct *http2Client // nil for server side Stream
ctx context.Context // the associated context of the stream
cancel context.CancelFunc // always nil for client side Stream
done chan struct{} // closed at the end of stream to unblock writers. On the client side.
@ -251,6 +252,10 @@ type Stream struct {
headerChan chan struct{} // closed to indicate the end of header metadata.
headerChanClosed uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times.
// headerValid indicates whether a valid header was received. Only
// meaningful after headerChan is closed (always call waitOnHeader() before
// reading its value). Not valid on server side.
headerValid bool
// hdrMu protects header and trailer metadata on the server-side.
hdrMu sync.Mutex
@ -303,34 +308,28 @@ func (s *Stream) getState() streamState {
return streamState(atomic.LoadUint32((*uint32)(&s.state)))
}
func (s *Stream) waitOnHeader() error {
func (s *Stream) waitOnHeader() {
if s.headerChan == nil {
// On the server headerChan is always nil since a stream originates
// only after having received headers.
return nil
return
}
select {
case <-s.ctx.Done():
// We prefer success over failure when reading messages because we delay
// context error in stream.Read(). To keep behavior consistent, we also
// prefer success here.
select {
case <-s.headerChan:
return nil
default:
}
return ContextErr(s.ctx.Err())
// Close the stream to prevent headers/trailers from changing after
// this function returns.
s.ct.CloseStream(s, ContextErr(s.ctx.Err()))
// headerChan could possibly not be closed yet if closeStream raced
// with operateHeaders; wait until it is closed explicitly here.
<-s.headerChan
case <-s.headerChan:
return nil
}
}
// RecvCompress returns the compression algorithm applied to the inbound
// message. It is empty string if there is no compression applied.
func (s *Stream) RecvCompress() string {
if err := s.waitOnHeader(); err != nil {
return ""
}
s.waitOnHeader()
return s.recvCompress
}
@ -351,36 +350,27 @@ func (s *Stream) Done() <-chan struct{} {
// available. It blocks until i) the metadata is ready or ii) there is no header
// metadata or iii) the stream is canceled/expired.
//
// On server side, it returns the out header after t.WriteHeader is called.
// On server side, it returns the out header after t.WriteHeader is called. It
// does not block and must not be called until after WriteHeader.
func (s *Stream) Header() (metadata.MD, error) {
if s.headerChan == nil && s.header != nil {
if s.headerChan == nil {
// On server side, return the header in stream. It will be the out
// header after t.WriteHeader is called.
return s.header.Copy(), nil
}
err := s.waitOnHeader()
// Even if the stream is closed, header is returned if available.
select {
case <-s.headerChan:
if s.header == nil {
return nil, nil
}
return s.header.Copy(), nil
default:
s.waitOnHeader()
if !s.headerValid {
return nil, s.status.Err()
}
return nil, err
return s.header.Copy(), nil
}
// TrailersOnly blocks until a header or trailers-only frame is received and
// then returns true if the stream was trailers-only. If the stream ends
// before headers are received, returns true, nil. If a context error happens
// first, returns it as a status error. Client-side only.
func (s *Stream) TrailersOnly() (bool, error) {
err := s.waitOnHeader()
if err != nil {
return false, err
}
return s.noHeaders, nil
// before headers are received, returns true, nil. Client-side only.
func (s *Stream) TrailersOnly() bool {
s.waitOnHeader()
return s.noHeaders
}
// Trailer returns the cached trailer metedata. Note that if it is not called
@ -534,6 +524,7 @@ type ServerConfig struct {
ReadBufferSize int
ChannelzParentID int64
MaxHeaderListSize *uint32
HeaderTableSize *uint32
}
// NewServerTransport creates a ServerTransport with conn or non-nil error

View file

@ -21,6 +21,10 @@
package resolver
import (
"context"
"net"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/serviceconfig"
)
@ -86,9 +90,16 @@ type Address struct {
// Type is the type of this address.
Type AddressType
// ServerName is the name of this address.
// If non-empty, the ServerName is used as the transport certification authority for
// the address, instead of the hostname from the Dial target string. In most cases,
// this should not be set.
//
// e.g. if Type is GRPCLB, ServerName should be the name of the remote load
// If Type is GRPCLB, ServerName should be the name of the remote load
// balancer, not the name of the backend.
//
// WARNING: ServerName must only be populated with trusted values. It
// is insecure to populate it with data from untrusted inputs since untrusted
// values could be used to bypass the authority checks performed by TLS.
ServerName string
// Metadata is the information associated with Addr, which may be used
// to make load balancing decision.
@ -98,18 +109,38 @@ type Address struct {
// BuildOption includes additional information for the builder to create
// the resolver.
type BuildOption struct {
// DisableServiceConfig indicates whether resolver should fetch service config data.
// DisableServiceConfig indicates whether a resolver implementation should
// fetch service config data.
DisableServiceConfig bool
// DialCreds is the transport credentials used by the ClientConn for
// communicating with the target gRPC service (set via
// WithTransportCredentials). In cases where a name resolution service
// requires the same credentials, the resolver may use this field. In most
// cases though, it is not appropriate, and this field may be ignored.
DialCreds credentials.TransportCredentials
// CredsBundle is the credentials bundle used by the ClientConn for
// communicating with the target gRPC service (set via
// WithCredentialsBundle). In cases where a name resolution service
// requires the same credentials, the resolver may use this field. In most
// cases though, it is not appropriate, and this field may be ignored.
CredsBundle credentials.Bundle
// Dialer is the custom dialer used by the ClientConn for dialling the
// target gRPC service (set via WithDialer). In cases where a name
// resolution service requires the same dialer, the resolver may use this
// field. In most cases though, it is not appropriate, and this field may
// be ignored.
Dialer func(context.Context, string) (net.Conn, error)
}
// State contains the current Resolver state relevant to the ClientConn.
type State struct {
Addresses []Address // Resolved addresses for the target
// ServiceConfig is the parsed service config; obtained from
// serviceconfig.Parse.
ServiceConfig serviceconfig.Config
// Addresses is the latest set of resolved addresses for the target.
Addresses []Address
// TODO: add Err error
// ServiceConfig contains the result from parsing the latest service
// config. If it is nil, it indicates no service config is present or the
// resolver does not provide service configs.
ServiceConfig *serviceconfig.ParseResult
}
// ClientConn contains the callbacks for resolver to notify any updates
@ -122,6 +153,10 @@ type State struct {
type ClientConn interface {
// UpdateState updates the state of the ClientConn appropriately.
UpdateState(State)
// ReportError notifies the ClientConn that the Resolver encountered an
// error. The ClientConn will notify the load balancer and begin calling
// ResolveNow on the Resolver with exponential backoff.
ReportError(error)
// NewAddress is called by resolver to notify ClientConn a new list
// of resolved addresses.
// The address list should be the complete list of resolved addresses.
@ -133,6 +168,9 @@ type ClientConn interface {
//
// Deprecated: Use UpdateState instead.
NewServiceConfig(serviceConfig string)
// ParseServiceConfig parses the provided service config and returns an
// object that provides the parsed config.
ParseServiceConfig(serviceConfigJSON string) *serviceconfig.ParseResult
}
// Target represents a target for gRPC, as specified in:

View file

@ -21,22 +21,29 @@ package grpc
import (
"fmt"
"strings"
"sync/atomic"
"sync"
"time"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/channelz"
"google.golang.org/grpc/internal/grpcsync"
"google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig"
)
// ccResolverWrapper is a wrapper on top of cc for resolvers.
// It implements resolver.ClientConnection interface.
type ccResolverWrapper struct {
cc *ClientConn
resolver resolver.Resolver
addrCh chan []resolver.Address
scCh chan string
done uint32 // accessed atomically; set to 1 when closed.
curState resolver.State
cc *ClientConn
resolverMu sync.Mutex
resolver resolver.Resolver
done *grpcsync.Event
curState resolver.State
pollingMu sync.Mutex
polling chan struct{}
}
// split2 returns the values from strings.SplitN(s, sep, 2).
@ -67,12 +74,9 @@ func parseTarget(target string) (ret resolver.Target) {
return ret
}
// newCCResolverWrapper parses cc.target for scheme and gets the resolver
// builder for this scheme and builds the resolver. The monitoring goroutine
// for it is not started yet and can be created by calling start().
//
// If withResolverBuilder dial option is set, the specified resolver will be
// used instead.
// newCCResolverWrapper uses the resolver.Builder stored in the ClientConn to
// build a Resolver and returns a ccResolverWrapper object which wraps the
// newly built resolver.
func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) {
rb := cc.dopts.resolverBuilder
if rb == nil {
@ -80,47 +84,122 @@ func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) {
}
ccr := &ccResolverWrapper{
cc: cc,
addrCh: make(chan []resolver.Address, 1),
scCh: make(chan string, 1),
cc: cc,
done: grpcsync.NewEvent(),
}
var credsClone credentials.TransportCredentials
if creds := cc.dopts.copts.TransportCredentials; creds != nil {
credsClone = creds.Clone()
}
rbo := resolver.BuildOption{
DisableServiceConfig: cc.dopts.disableServiceConfig,
DialCreds: credsClone,
CredsBundle: cc.dopts.copts.CredsBundle,
Dialer: cc.dopts.copts.Dialer,
}
var err error
ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, resolver.BuildOption{DisableServiceConfig: cc.dopts.disableServiceConfig})
// We need to hold the lock here while we assign to the ccr.resolver field
// to guard against a data race caused by the following code path,
// rb.Build-->ccr.ReportError-->ccr.poll-->ccr.resolveNow, would end up
// accessing ccr.resolver which is being assigned here.
ccr.resolverMu.Lock()
ccr.resolver, err = rb.Build(cc.parsedTarget, ccr, rbo)
if err != nil {
return nil, err
}
ccr.resolverMu.Unlock()
return ccr, nil
}
func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOption) {
ccr.resolver.ResolveNow(o)
ccr.resolverMu.Lock()
if !ccr.done.HasFired() {
ccr.resolver.ResolveNow(o)
}
ccr.resolverMu.Unlock()
}
func (ccr *ccResolverWrapper) close() {
ccr.resolverMu.Lock()
ccr.resolver.Close()
atomic.StoreUint32(&ccr.done, 1)
ccr.done.Fire()
ccr.resolverMu.Unlock()
}
func (ccr *ccResolverWrapper) isDone() bool {
return atomic.LoadUint32(&ccr.done) == 1
// poll begins or ends asynchronous polling of the resolver based on whether
// err is ErrBadResolverState.
func (ccr *ccResolverWrapper) poll(err error) {
ccr.pollingMu.Lock()
defer ccr.pollingMu.Unlock()
if err != balancer.ErrBadResolverState {
// stop polling
if ccr.polling != nil {
close(ccr.polling)
ccr.polling = nil
}
return
}
if ccr.polling != nil {
// already polling
return
}
p := make(chan struct{})
ccr.polling = p
go func() {
for i := 0; ; i++ {
ccr.resolveNow(resolver.ResolveNowOption{})
t := time.NewTimer(ccr.cc.dopts.resolveNowBackoff(i))
select {
case <-p:
t.Stop()
return
case <-ccr.done.Done():
// Resolver has been closed.
t.Stop()
return
case <-t.C:
select {
case <-p:
return
default:
}
// Timer expired; re-resolve.
}
}
}()
}
func (ccr *ccResolverWrapper) UpdateState(s resolver.State) {
if ccr.isDone() {
if ccr.done.HasFired() {
return
}
grpclog.Infof("ccResolverWrapper: sending update to cc: %v", s)
if channelz.IsOn() {
ccr.addChannelzTraceEvent(s)
}
ccr.cc.updateResolverState(s)
ccr.curState = s
ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil))
}
func (ccr *ccResolverWrapper) ReportError(err error) {
if ccr.done.HasFired() {
return
}
grpclog.Warningf("ccResolverWrapper: reporting error to cc: %v", err)
if channelz.IsOn() {
channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{
Desc: fmt.Sprintf("Resolver reported error: %v", err),
Severity: channelz.CtWarning,
})
}
ccr.poll(ccr.cc.updateResolverState(resolver.State{}, err))
}
// NewAddress is called by the resolver implementation to send addresses to gRPC.
func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) {
if ccr.isDone() {
if ccr.done.HasFired() {
return
}
grpclog.Infof("ccResolverWrapper: sending new addresses to cc: %v", addrs)
@ -128,31 +207,49 @@ func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) {
ccr.addChannelzTraceEvent(resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig})
}
ccr.curState.Addresses = addrs
ccr.cc.updateResolverState(ccr.curState)
ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil))
}
// NewServiceConfig is called by the resolver implementation to send service
// configs to gRPC.
func (ccr *ccResolverWrapper) NewServiceConfig(sc string) {
if ccr.isDone() {
if ccr.done.HasFired() {
return
}
grpclog.Infof("ccResolverWrapper: got new service config: %v", sc)
c, err := parseServiceConfig(sc)
if err != nil {
scpr := parseServiceConfig(sc)
if scpr.Err != nil {
grpclog.Warningf("ccResolverWrapper: error parsing service config: %v", scpr.Err)
if channelz.IsOn() {
channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{
Desc: fmt.Sprintf("Error parsing service config: %v", scpr.Err),
Severity: channelz.CtWarning,
})
}
ccr.poll(balancer.ErrBadResolverState)
return
}
if channelz.IsOn() {
ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: c})
ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: scpr})
}
ccr.curState.ServiceConfig = c
ccr.cc.updateResolverState(ccr.curState)
ccr.curState.ServiceConfig = scpr
ccr.poll(ccr.cc.updateResolverState(ccr.curState, nil))
}
func (ccr *ccResolverWrapper) ParseServiceConfig(scJSON string) *serviceconfig.ParseResult {
return parseServiceConfig(scJSON)
}
func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) {
var updates []string
oldSC, oldOK := ccr.curState.ServiceConfig.(*ServiceConfig)
newSC, newOK := s.ServiceConfig.(*ServiceConfig)
var oldSC, newSC *ServiceConfig
var oldOK, newOK bool
if ccr.curState.ServiceConfig != nil {
oldSC, oldOK = ccr.curState.ServiceConfig.Config.(*ServiceConfig)
}
if s.ServiceConfig != nil {
newSC, newOK = s.ServiceConfig.Config.(*ServiceConfig)
}
if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) {
updates = append(updates, "service config updated")
}

View file

@ -648,35 +648,58 @@ func recvAndDecompress(p *parser, s *transport.Stream, dc Decompressor, maxRecei
return nil, st.Err()
}
var size int
if pf == compressionMade {
// To match legacy behavior, if the decompressor is set by WithDecompressor or RPCDecompressor,
// use this decompressor as the default.
if dc != nil {
d, err = dc.Do(bytes.NewReader(d))
if err != nil {
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
}
size = len(d)
} else {
dcReader, err := compressor.Decompress(bytes.NewReader(d))
if err != nil {
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
}
// Read from LimitReader with limit max+1. So if the underlying
// reader is over limit, the result will be bigger than max.
d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
if err != nil {
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
}
d, size, err = decompress(compressor, d, maxReceiveMessageSize)
}
if err != nil {
return nil, status.Errorf(codes.Internal, "grpc: failed to decompress the received message %v", err)
}
} else {
size = len(d)
}
if len(d) > maxReceiveMessageSize {
if size > maxReceiveMessageSize {
// TODO: Revisit the error code. Currently keep it consistent with java
// implementation.
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", len(d), maxReceiveMessageSize)
return nil, status.Errorf(codes.ResourceExhausted, "grpc: received message larger than max (%d vs. %d)", size, maxReceiveMessageSize)
}
return d, nil
}
// Using compressor, decompress d, returning data and size.
// Optionally, if data will be over maxReceiveMessageSize, just return the size.
func decompress(compressor encoding.Compressor, d []byte, maxReceiveMessageSize int) ([]byte, int, error) {
dcReader, err := compressor.Decompress(bytes.NewReader(d))
if err != nil {
return nil, 0, err
}
if sizer, ok := compressor.(interface {
DecompressedSize(compressedBytes []byte) int
}); ok {
if size := sizer.DecompressedSize(d); size >= 0 {
if size > maxReceiveMessageSize {
return nil, size, nil
}
// size is used as an estimate to size the buffer, but we
// will read more data if available.
// +MinRead so ReadFrom will not reallocate if size is correct.
buf := bytes.NewBuffer(make([]byte, 0, size+bytes.MinRead))
bytesRead, err := buf.ReadFrom(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
return buf.Bytes(), int(bytesRead), err
}
}
// Read from LimitReader with limit max+1. So if the underlying
// reader is over limit, the result will be bigger than max.
d, err = ioutil.ReadAll(io.LimitReader(dcReader, int64(maxReceiveMessageSize)+1))
return d, len(d), err
}
// For the two compressor parameters, both should not be set, but if they are,
// dc takes precedence over compressor.
// TODO(dfawley): wrap the old compressor/decompressor using the new API?

View file

@ -130,6 +130,7 @@ type serverOptions struct {
readBufferSize int
connectionTimeout time.Duration
maxHeaderListSize *uint32
headerTableSize *uint32
}
var defaultServerOptions = serverOptions{
@ -377,6 +378,16 @@ func MaxHeaderListSize(s uint32) ServerOption {
})
}
// HeaderTableSize returns a ServerOption that sets the size of dynamic
// header table for stream.
//
// This API is EXPERIMENTAL.
func HeaderTableSize(s uint32) ServerOption {
return newFuncServerOption(func(o *serverOptions) {
o.headerTableSize = &s
})
}
// NewServer creates a gRPC server which has no service registered and has not
// started to accept requests yet.
func NewServer(opt ...ServerOption) *Server {
@ -686,6 +697,7 @@ func (s *Server) newHTTP2Transport(c net.Conn, authInfo credentials.AuthInfo) tr
ReadBufferSize: s.opts.readBufferSize,
ChannelzParentID: s.channelzID,
MaxHeaderListSize: s.opts.maxHeaderListSize,
HeaderTableSize: s.opts.headerTableSize,
}
st, err := transport.NewServerTransport("http2", c, config)
if err != nil {

View file

@ -261,20 +261,17 @@ type jsonSC struct {
}
func init() {
internal.ParseServiceConfig = func(sc string) (interface{}, error) {
return parseServiceConfig(sc)
}
internal.ParseServiceConfigForTesting = parseServiceConfig
}
func parseServiceConfig(js string) (*ServiceConfig, error) {
func parseServiceConfig(js string) *serviceconfig.ParseResult {
if len(js) == 0 {
return nil, fmt.Errorf("no JSON service config provided")
return &serviceconfig.ParseResult{Err: fmt.Errorf("no JSON service config provided")}
}
var rsc jsonSC
err := json.Unmarshal([]byte(js), &rsc)
if err != nil {
grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err)
return nil, err
return &serviceconfig.ParseResult{Err: err}
}
sc := ServiceConfig{
LB: rsc.LoadBalancingPolicy,
@ -288,7 +285,7 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
if len(lbcfg) != 1 {
err := fmt.Errorf("invalid loadBalancingConfig: entry %v does not contain exactly 1 policy/config pair: %q", i, lbcfg)
grpclog.Warningf(err.Error())
return nil, err
return &serviceconfig.ParseResult{Err: err}
}
var name string
var jsonCfg json.RawMessage
@ -303,17 +300,25 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
var err error
sc.lbConfig.cfg, err = parser.ParseConfig(jsonCfg)
if err != nil {
return nil, fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err)
return &serviceconfig.ParseResult{Err: fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err)}
}
} else if string(jsonCfg) != "{}" {
grpclog.Warningf("non-empty balancer configuration %q, but balancer does not implement ParseConfig", string(jsonCfg))
}
break
}
if sc.lbConfig == nil {
// We had a loadBalancingConfig field but did not encounter a
// supported policy. The config is considered invalid in this
// case.
err := fmt.Errorf("invalid loadBalancingConfig: no supported policies found")
grpclog.Warningf(err.Error())
return &serviceconfig.ParseResult{Err: err}
}
}
if rsc.MethodConfig == nil {
return &sc, nil
return &serviceconfig.ParseResult{Config: &sc}
}
for _, m := range *rsc.MethodConfig {
if m.Name == nil {
@ -322,7 +327,7 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
d, err := parseDuration(m.Timeout)
if err != nil {
grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err)
return nil, err
return &serviceconfig.ParseResult{Err: err}
}
mc := MethodConfig{
@ -331,7 +336,7 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
}
if mc.retryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil {
grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err)
return nil, err
return &serviceconfig.ParseResult{Err: err}
}
if m.MaxRequestMessageBytes != nil {
if *m.MaxRequestMessageBytes > int64(maxInt) {
@ -356,13 +361,13 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
if sc.retryThrottling != nil {
if mt := sc.retryThrottling.MaxTokens; mt <= 0 || mt > 1000 {
return nil, fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt)
return &serviceconfig.ParseResult{Err: fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt)}
}
if tr := sc.retryThrottling.TokenRatio; tr <= 0 {
return nil, fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr)
return &serviceconfig.ParseResult{Err: fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr)}
}
}
return &sc, nil
return &serviceconfig.ParseResult{Config: &sc}
}
func convertRetryPolicy(jrp *jsonRetryPolicy) (p *retryPolicy, err error) {

View file

@ -22,27 +22,20 @@
// This package is EXPERIMENTAL.
package serviceconfig
import (
"google.golang.org/grpc/internal"
)
// Config represents an opaque data structure holding a service config.
type Config interface {
isConfig()
isServiceConfig()
}
// LoadBalancingConfig represents an opaque data structure holding a load
// balancer config.
// balancing config.
type LoadBalancingConfig interface {
isLoadBalancingConfig()
}
// Parse parses the JSON service config provided into an internal form or
// returns an error if the config is invalid.
func Parse(ServiceConfigJSON string) (Config, error) {
c, err := internal.ParseServiceConfig(ServiceConfigJSON)
if err != nil {
return nil, err
}
return c.(Config), err
// ParseResult contains a service config or an error. Exactly one must be
// non-nil.
type ParseResult struct {
Config Config
Err error
}

View file

@ -488,7 +488,7 @@ func (cs *clientStream) shouldRetry(err error) error {
pushback := 0
hasPushback := false
if cs.attempt.s != nil {
if to, toErr := cs.attempt.s.TrailersOnly(); toErr != nil || !to {
if !cs.attempt.s.TrailersOnly() {
return err
}

View file

@ -19,4 +19,4 @@
package grpc
// Version is the current grpc version.
const Version = "1.23.0"
const Version = "1.25.1"

18
vendor/google.golang.org/grpc/vet.sh generated vendored
View file

@ -31,12 +31,15 @@ PATH="${GOPATH}/bin:${GOROOT}/bin:${PATH}"
if [[ "$1" = "-install" ]]; then
# Check for module support
if go help mod >& /dev/null; then
# Install the pinned versions as defined in module tools.
pushd ./test/tools
go install \
golang.org/x/lint/golint \
golang.org/x/tools/cmd/goimports \
honnef.co/go/tools/cmd/staticcheck \
github.com/client9/misspell/cmd/misspell \
github.com/golang/protobuf/protoc-gen-go
popd
else
# Ye olde `go get` incantation.
# Note: this gets the latest version of all tools (vs. the pinned versions
@ -67,18 +70,21 @@ elif [[ "$#" -ne 0 ]]; then
fi
# - Ensure all source files contain a copyright message.
git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | fail_on_output
(! git grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" -- '*.go')
# - Make sure all tests in grpc and grpc/test use leakcheck via Teardown.
(! grep 'func Test[^(]' *_test.go)
(! grep 'func Test[^(]' test/*.go)
# - Do not import x/net/context.
(! git grep -l 'x/net/context' -- "*.go")
# - Do not import math/rand for real library code. Use internal/grpcrand for
# thread safety.
git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand\|wrr_test')
git grep -l '"math/rand"' -- "*.go" 2>&1 | (! grep -v '^examples\|^stress\|grpcrand\|wrr_test')
# - Ensure all ptypes proto packages are renamed when importing.
git ls-files "*.go" | (! xargs grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/")
(! git grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/" -- "*.go")
# - Check imports that are illegal in appengine (until Go 1.11).
# TODO: Remove when we drop Go 1.10 support
@ -86,7 +92,7 @@ go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go
# - gofmt, goimports, golint (with exceptions for generated code), go vet.
gofmt -s -d -l . 2>&1 | fail_on_output
goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") | fail_on_output
goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go") | fail_on_output
golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:")
go vet -all .
@ -109,8 +115,10 @@ fi
staticcheck -go 1.9 -checks 'inherit,-ST1015' -ignore '
google.golang.org/grpc/balancer.go:SA1019
google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go:SA1019
google.golang.org/grpc/balancer/grpclb/grpclb_test.go:SA1019
google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go:SA1019
google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go:SA1019
google.golang.org/grpc/xds/internal/resolver/xds_resolver.go:SA1019
google.golang.org/grpc/xds/internal/balancer/xds.go:SA1019
google.golang.org/grpc/xds/internal/balancer/xds_client.go:SA1019
google.golang.org/grpc/balancer_conn_wrappers.go:SA1019
@ -124,7 +132,7 @@ google.golang.org/grpc/examples/features/debugging/client/main.go:SA1019
google.golang.org/grpc/examples/features/load_balancing/client/main.go:SA1019
google.golang.org/grpc/internal/transport/handler_server.go:SA1019
google.golang.org/grpc/internal/transport/handler_server_test.go:SA1019
google.golang.org/grpc/resolver/dns/dns_resolver.go:SA1019
google.golang.org/grpc/internal/resolver/dns/dns_resolver.go:SA1019
google.golang.org/grpc/stats/stats_test.go:SA1019
google.golang.org/grpc/test/balancer_test.go:SA1019
google.golang.org/grpc/test/channelz_test.go:SA1019