mirror of https://github.com/k3s-io/k3s
Merge pull request #52132 from portworx/kubelet_weird_output_fix
Automatic merge from submit-queue (batch tested with PRs 51064, 52132). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.. Kubelet weird output fix **What this PR does / why we need it**: All kube binaries print the following message at the top when executed: ``` 2017/08/28 21:37:12 proto: duplicate proto type registered: google.protobuf.Any 2017/08/28 21:37:12 proto: duplicate proto type registered: google.protobuf.Duration 2017/08/28 21:37:12 proto: duplicate proto type registered: google.protobuf.Timestamp ``` This PR addresses the above issue It involves the following two changes: 1. Updating vendor packages - Removes everything under the repo ``go.pedge.io`` - Updates repo libopenstorage/openstorage (which was using the above package) 2. Updates the portworx volume native driver to adhere to the newly vendor'ed code. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #51452 **Special notes for your reviewer**: I have divided the changes into 2 commits 1. Vendor'ed changes 2. Changes in portworx volume driver. ```release-note Remove duplicate proto errors in kubelet. ```pull/6/head
commit
1a15b3db36
|
@ -1930,27 +1930,31 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/api",
|
||||
"Rev": "6e787003b91ddba85f108b8aede075b1af0d3606"
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/api/client",
|
||||
"Rev": "6e787003b91ddba85f108b8aede075b1af0d3606"
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/api/client/volume",
|
||||
"Rev": "6e787003b91ddba85f108b8aede075b1af0d3606"
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/api/spec",
|
||||
"Rev": "6e787003b91ddba85f108b8aede075b1af0d3606"
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/pkg/parser",
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/pkg/units",
|
||||
"Rev": "6e787003b91ddba85f108b8aede075b1af0d3606"
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/libopenstorage/openstorage/volume",
|
||||
"Rev": "6e787003b91ddba85f108b8aede075b1af0d3606"
|
||||
"Rev": "093a0c3888753c2056e7373183693d670c6bba01"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/lpabon/godbc",
|
||||
|
@ -2000,6 +2004,10 @@
|
|||
"ImportPath": "github.com/mitchellh/mapstructure",
|
||||
"Rev": "53818660ed4955e899c0bcafa97299a388bd7c8e"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mohae/deepcopy",
|
||||
"Rev": "491d3605edfb866af34a48075bd4355ac1bf46ca"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mreiferson/go-httpclient",
|
||||
"Rev": "31f0106b4474f14bc441575c19d3a5fa21aa1f6c"
|
||||
|
@ -2749,10 +2757,6 @@
|
|||
"Comment": "v1.0-13-g5292687",
|
||||
"Rev": "5292687f5379e01054407da44d7c4590a61fd3de"
|
||||
},
|
||||
{
|
||||
"ImportPath": "go.pedge.io/pb/go/google/protobuf",
|
||||
"Rev": "f3c84f58974dc53d460d0855337cad85843bf0df"
|
||||
},
|
||||
{
|
||||
"ImportPath": "go4.org/errorutil",
|
||||
"Rev": "03efcb870d84809319ea509714dd6d19a1498483"
|
||||
|
|
|
@ -67651,6 +67651,205 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/libopenstorage/openstorage/pkg/parser licensed under: =
|
||||
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2015 Openstorage.org.
|
||||
|
||||
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.
|
||||
|
||||
= vendor/github.com/libopenstorage/openstorage/LICENSE 40c3e1c9eacda859a17048003909a2f8
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/libopenstorage/openstorage/pkg/units licensed under: =
|
||||
|
||||
|
@ -69146,6 +69345,35 @@ THE SOFTWARE.
|
|||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/mohae/deepcopy licensed under: =
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Joel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
= vendor/github.com/mohae/deepcopy/LICENSE 268dc9c546e3de67a93c1d12a039d702
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/github.com/mreiferson/go-httpclient licensed under: =
|
||||
|
||||
|
@ -88246,36 +88474,6 @@ SOFTWARE.
|
|||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/go.pedge.io/pb/go/google/protobuf licensed under: =
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Peter Edge
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
= vendor/go.pedge.io/pb/LICENSE bd5821dd74e6e83799a4a8dd9f48c43f
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
= vendor/go4.org/errorutil licensed under: =
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ import (
|
|||
"k8s.io/kubernetes/pkg/volume/util/volumehelper"
|
||||
)
|
||||
|
||||
const (
|
||||
attachContextKey = "context"
|
||||
attachHostKey = "host"
|
||||
)
|
||||
|
||||
// This is the primary entrypoint for volume plugins.
|
||||
func ProbeVolumePlugins() []volume.VolumePlugin {
|
||||
return []volume.VolumePlugin{&portworxVolumePlugin{nil, nil}}
|
||||
|
@ -205,7 +210,7 @@ type portworxManager interface {
|
|||
// Deletes a volume
|
||||
DeleteVolume(deleter *portworxVolumeDeleter) error
|
||||
// Attach a volume
|
||||
AttachVolume(mounter *portworxVolumeMounter) (string, error)
|
||||
AttachVolume(mounter *portworxVolumeMounter, attachOptions map[string]string) (string, error)
|
||||
// Detach a volume
|
||||
DetachVolume(unmounter *portworxVolumeUnmounter) error
|
||||
// Mount a volume
|
||||
|
@ -274,7 +279,10 @@ func (b *portworxVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if _, err := b.manager.AttachVolume(b); err != nil {
|
||||
attachOptions := make(map[string]string)
|
||||
attachOptions[attachContextKey] = dir
|
||||
attachOptions[attachHostKey] = b.plugin.host.GetHostName()
|
||||
if _, err := b.manager.AttachVolume(b, attachOptions); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ type fakePortworxManager struct {
|
|||
mountCalled bool
|
||||
}
|
||||
|
||||
func (fake *fakePortworxManager) AttachVolume(b *portworxVolumeMounter) (string, error) {
|
||||
func (fake *fakePortworxManager) AttachVolume(b *portworxVolumeMounter, attachOptions map[string]string) (string, error) {
|
||||
fake.attachCalled = true
|
||||
return "", nil
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ const (
|
|||
pxdDriverName = "pxd"
|
||||
pvcClaimLabel = "pvc"
|
||||
pxServiceName = "portworx-service"
|
||||
pxDriverName = "pxd-sched"
|
||||
)
|
||||
|
||||
type PortworxVolumeUtil struct {
|
||||
|
@ -60,23 +61,26 @@ func (util *PortworxVolumeUtil) CreateVolume(p *portworxVolumeProvisioner) (stri
|
|||
// doesn't support new parameters, the server-side processing will parse it correctly.
|
||||
// We still need to call SpecFromOpts() here to handle cases where someone is running Portworx 1.2.8 and lower.
|
||||
specHandler := osdspec.NewSpecHandler()
|
||||
spec, _ := specHandler.SpecFromOpts(p.options.Parameters)
|
||||
spec, locator, source, _ := specHandler.SpecFromOpts(p.options.Parameters)
|
||||
if spec == nil {
|
||||
spec = specHandler.DefaultSpec()
|
||||
}
|
||||
|
||||
// Pass all parameters as volume labels for Portworx server-side processing.
|
||||
spec.VolumeLabels = p.options.Parameters
|
||||
|
||||
// Update the requested size in the spec
|
||||
spec.Size = uint64(requestGB * 1024 * 1024 * 1024)
|
||||
source := osdapi.Source{}
|
||||
locator := osdapi.VolumeLocator{
|
||||
Name: p.options.PVName,
|
||||
// Change the Portworx Volume name to PV name
|
||||
if locator == nil {
|
||||
locator = &osdapi.VolumeLocator{
|
||||
VolumeLabels: make(map[string]string),
|
||||
}
|
||||
}
|
||||
locator.Name = p.options.PVName
|
||||
|
||||
// Add claim Name as a part of Portworx Volume Labels
|
||||
locator.VolumeLabels = make(map[string]string)
|
||||
locator.VolumeLabels[pvcClaimLabel] = p.options.PVC.Name
|
||||
volumeID, err := driver.Create(&locator, &source, spec)
|
||||
volumeID, err := driver.Create(locator, source, spec)
|
||||
if err != nil {
|
||||
glog.Errorf("Error creating Portworx Volume : %v", err)
|
||||
}
|
||||
|
@ -102,14 +106,14 @@ func (util *PortworxVolumeUtil) DeleteVolume(d *portworxVolumeDeleter) error {
|
|||
}
|
||||
|
||||
// AttachVolume attaches a Portworx Volume
|
||||
func (util *PortworxVolumeUtil) AttachVolume(m *portworxVolumeMounter) (string, error) {
|
||||
func (util *PortworxVolumeUtil) AttachVolume(m *portworxVolumeMounter, attachOptions map[string]string) (string, error) {
|
||||
driver, err := util.getPortworxDriver(m.plugin.host, true /*localOnly*/)
|
||||
if err != nil || driver == nil {
|
||||
glog.Errorf("Failed to get portworx driver. Err: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
devicePath, err := driver.Attach(m.volName)
|
||||
devicePath, err := driver.Attach(m.volName, attachOptions)
|
||||
if err != nil {
|
||||
glog.Errorf("Error attaching Portworx Volume (%v): %v", m.volName, err)
|
||||
return "", err
|
||||
|
@ -125,7 +129,7 @@ func (util *PortworxVolumeUtil) DetachVolume(u *portworxVolumeUnmounter) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = driver.Detach(u.volName)
|
||||
err = driver.Detach(u.volName, false /*doNotForceDetach*/)
|
||||
if err != nil {
|
||||
glog.Errorf("Error detaching Portworx Volume (%v): %v", u.volName, err)
|
||||
return err
|
||||
|
@ -181,7 +185,7 @@ func isClientValid(client *osdclient.Client) (bool, error) {
|
|||
|
||||
func createDriverClient(hostname string) (*osdclient.Client, error) {
|
||||
client, err := volumeclient.NewDriverClient("http://"+hostname+":"+osdMgmtPort,
|
||||
pxdDriverName, osdDriverVersion)
|
||||
pxdDriverName, osdDriverVersion, pxDriverName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -260,6 +260,7 @@ filegroup(
|
|||
"//vendor/github.com/kr/fs:all-srcs",
|
||||
"//vendor/github.com/kr/pty:all-srcs",
|
||||
"//vendor/github.com/libopenstorage/openstorage/api:all-srcs",
|
||||
"//vendor/github.com/libopenstorage/openstorage/pkg/parser:all-srcs",
|
||||
"//vendor/github.com/libopenstorage/openstorage/pkg/units:all-srcs",
|
||||
"//vendor/github.com/libopenstorage/openstorage/volume:all-srcs",
|
||||
"//vendor/github.com/lpabon/godbc:all-srcs",
|
||||
|
@ -273,6 +274,7 @@ filegroup(
|
|||
"//vendor/github.com/mistifyio/go-zfs:all-srcs",
|
||||
"//vendor/github.com/mitchellh/go-wordwrap:all-srcs",
|
||||
"//vendor/github.com/mitchellh/mapstructure:all-srcs",
|
||||
"//vendor/github.com/mohae/deepcopy:all-srcs",
|
||||
"//vendor/github.com/mreiferson/go-httpclient:all-srcs",
|
||||
"//vendor/github.com/mrunalp/fileutils:all-srcs",
|
||||
"//vendor/github.com/mvdan/xurls:all-srcs",
|
||||
|
@ -330,7 +332,6 @@ filegroup(
|
|||
"//vendor/github.com/xanzy/go-cloudstack/cloudstack:all-srcs",
|
||||
"//vendor/github.com/xiang90/probing:all-srcs",
|
||||
"//vendor/github.com/xyproto/simpleredis:all-srcs",
|
||||
"//vendor/go.pedge.io/pb/go/google/protobuf:all-srcs",
|
||||
"//vendor/go4.org/errorutil:all-srcs",
|
||||
"//vendor/golang.org/x/crypto/bcrypt:all-srcs",
|
||||
"//vendor/golang.org/x/crypto/blowfish:all-srcs",
|
||||
|
|
|
@ -10,7 +10,8 @@ go_library(
|
|||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/golang/protobuf/proto:go_default_library",
|
||||
"//vendor/go.pedge.io/pb/go/google/protobuf:go_default_library",
|
||||
"//vendor/github.com/golang/protobuf/ptypes/timestamp:go_default_library",
|
||||
"//vendor/github.com/mohae/deepcopy:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# OpenStorage API usage
|
||||
|
||||
Any storage product that uses the openstorage API can be managed via this API. Below are some examples of using this API.
|
||||
|
||||
### Enumerate nodes in a cluster
|
||||
```go
|
||||
|
||||
import (
|
||||
...
|
||||
|
||||
"github.com/libopenstorage/gossip/types"
|
||||
"github.com/libopenstorage/openstorage/api"
|
||||
"github.com/libopenstorage/openstorage/api/client/cluster"
|
||||
)
|
||||
|
||||
type myapp struct {
|
||||
manager cluster.Cluster
|
||||
}
|
||||
|
||||
func (c *myapp) init() {
|
||||
// Choose the default version.
|
||||
// Leave the host blank to use the local UNIX socket, or pass in an IP and a port at which the server is listening on.
|
||||
clnt, err := cluster.NewClusterClient("", cluster.APIVersion)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to initialize client library: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
c.manager = cluster.ClusterManager(clnt)
|
||||
}
|
||||
|
||||
func (c *myapp) listNodes() {
|
||||
cluster, err := c.manager.Enumerate()
|
||||
if err != nil {
|
||||
cmdError(context, fn, err)
|
||||
return
|
||||
}
|
||||
|
||||
// cluster is now a hashmap of nodes... do something useful with it:
|
||||
for _, n := range cluster.Nodes {
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Inspect a volume in a cluster
|
||||
```go
|
||||
|
||||
import (
|
||||
...
|
||||
|
||||
"github.com/libopenstorage/openstorage/api"
|
||||
volumeclient "github.com/libopenstorage/openstorage/api/client/volume"
|
||||
"github.com/libopenstorage/openstorage/volume"
|
||||
)
|
||||
|
||||
type myapp struct {
|
||||
volDriver volume.VolumeDriver
|
||||
}
|
||||
|
||||
func (c *myapp) init() {
|
||||
// Choose the default version.
|
||||
// Leave the host blank to use the local UNIX socket, or pass in an IP and a port at which the server is listening on.
|
||||
clnt, err := volumeclient.NewDriverClient("", v.name, volume.APIVersion)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to initialize client library: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
v.volDriver = volumeclient.VolumeDriver(clnt)
|
||||
}
|
||||
|
||||
func (c *myapp) inspect(id string) {
|
||||
stats, err := v.volDriver.Stats(id, true)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// stats is an object that has various volume properties and statistics.
|
||||
}
|
||||
```
|
|
@ -2,26 +2,44 @@ package api
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mohae/deepcopy"
|
||||
)
|
||||
|
||||
// Strings for VolumeSpec
|
||||
const (
|
||||
Name = "name"
|
||||
SpecEphemeral = "ephemeral"
|
||||
SpecShared = "shared"
|
||||
SpecSize = "size"
|
||||
SpecScale = "scale"
|
||||
SpecFilesystem = "fs"
|
||||
SpecBlockSize = "block_size"
|
||||
SpecHaLevel = "repl"
|
||||
SpecPriority = "io_priority"
|
||||
SpecSnapshotInterval = "snap_interval"
|
||||
SpecAggregationLevel = "aggregation_level"
|
||||
SpecDedupe = "dedupe"
|
||||
SpecPassphrase = "passphrase"
|
||||
Name = "name"
|
||||
SpecNodes = "nodes"
|
||||
SpecParent = "parent"
|
||||
SpecEphemeral = "ephemeral"
|
||||
SpecShared = "shared"
|
||||
SpecSticky = "sticky"
|
||||
SpecSecure = "secure"
|
||||
SpecCompressed = "compressed"
|
||||
SpecSize = "size"
|
||||
SpecScale = "scale"
|
||||
SpecFilesystem = "fs"
|
||||
SpecBlockSize = "block_size"
|
||||
SpecHaLevel = "repl"
|
||||
SpecPriority = "io_priority"
|
||||
SpecSnapshotInterval = "snap_interval"
|
||||
SpecSnapshotSchedule = "snap_schedule"
|
||||
SpecAggregationLevel = "aggregation_level"
|
||||
SpecDedupe = "dedupe"
|
||||
SpecPassphrase = "secret_key"
|
||||
SpecAutoAggregationValue = "auto"
|
||||
SpecGroup = "group"
|
||||
SpecGroupEnforce = "fg"
|
||||
SpecZones = "zones"
|
||||
SpecRacks = "racks"
|
||||
SpecRegions = "regions"
|
||||
SpecLabels = "labels"
|
||||
SpecPriorityAlias = "priority_io"
|
||||
SpecIoProfile = "io_profile"
|
||||
)
|
||||
|
||||
// OptionKey specifies a set of recognized query params.
|
||||
|
@ -30,6 +48,8 @@ const (
|
|||
OptName = "Name"
|
||||
// OptVolumeID query parameter used to lookup volume by ID.
|
||||
OptVolumeID = "VolumeID"
|
||||
// OptSnapID query parameter used to lookup snapshot by ID.
|
||||
OptSnapID = "SnapID"
|
||||
// OptLabel query parameter used to lookup volume by set of labels.
|
||||
OptLabel = "Label"
|
||||
// OptConfigLabel query parameter used to lookup volume by set of labels.
|
||||
|
@ -40,9 +60,16 @@ const (
|
|||
|
||||
// Api client-server Constants
|
||||
const (
|
||||
OsdVolumePath = "osd-volumes"
|
||||
OsdVolumePath = "osd-volumes"
|
||||
OsdSnapshotPath = "osd-snapshot"
|
||||
TimeLayout = "Jan 2 15:04:05 UTC 2006"
|
||||
)
|
||||
|
||||
const (
|
||||
// AutoAggregation value indicates driver to select aggregation level.
|
||||
AutoAggregation = math.MaxUint32
|
||||
)
|
||||
|
||||
// Node describes the state of a node.
|
||||
// It includes the current physical state (CPU, memory, storage, network usage) as
|
||||
// well as the containers running on the system.
|
||||
|
@ -56,6 +83,7 @@ type Node struct {
|
|||
Status Status
|
||||
GenNumber uint64
|
||||
Disks map[string]StorageResource
|
||||
Pools []StoragePool
|
||||
MgmtIp string
|
||||
DataIp string
|
||||
Timestamp time.Time
|
||||
|
@ -66,6 +94,17 @@ type Node struct {
|
|||
NodeLabels map[string]string
|
||||
}
|
||||
|
||||
type FluentDConfig struct {
|
||||
IP string `json:"ip"`
|
||||
Port string `json:"port"`
|
||||
}
|
||||
|
||||
type TunnelConfig struct {
|
||||
Key string `json:"key"`
|
||||
Cert string `json:"cert"`
|
||||
Endpoint string `json:"tunnel_endpoint"`
|
||||
}
|
||||
|
||||
// Cluster represents the state of the cluster.
|
||||
type Cluster struct {
|
||||
Status Status
|
||||
|
@ -79,6 +118,18 @@ type Cluster struct {
|
|||
|
||||
// Nodes is an array of all the nodes in the cluster.
|
||||
Nodes []Node
|
||||
|
||||
// Logging url for the cluster.
|
||||
LoggingURL string
|
||||
|
||||
// Management url for the cluster
|
||||
ManagementURL string
|
||||
|
||||
// FluentD Host for the cluster
|
||||
FluentDConfig FluentDConfig
|
||||
|
||||
// TunnelConfig for the cluster [key, cert, endpoint]
|
||||
TunnelConfig TunnelConfig
|
||||
}
|
||||
|
||||
// StatPoint represents the basic structure of a single Stat reported
|
||||
|
@ -95,69 +146,97 @@ type StatPoint struct {
|
|||
Timestamp int64
|
||||
}
|
||||
|
||||
// DriverTypeSimpleValueOf returns the string format of DriverType
|
||||
func DriverTypeSimpleValueOf(s string) (DriverType, error) {
|
||||
obj, err := simpleValueOf("driver_type", DriverType_value, s)
|
||||
return DriverType(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of DriverType
|
||||
func (x DriverType) SimpleString() string {
|
||||
return simpleString("driver_type", DriverType_name, int32(x))
|
||||
}
|
||||
|
||||
// FSTypeSimpleValueOf returns the string format of FSType
|
||||
func FSTypeSimpleValueOf(s string) (FSType, error) {
|
||||
obj, err := simpleValueOf("fs_type", FSType_value, s)
|
||||
return FSType(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of DriverType
|
||||
func (x FSType) SimpleString() string {
|
||||
return simpleString("fs_type", FSType_name, int32(x))
|
||||
}
|
||||
|
||||
// CosTypeSimpleValueOf returns the string format of CosType
|
||||
func CosTypeSimpleValueOf(s string) (CosType, error) {
|
||||
obj, err := simpleValueOf("cos_type", CosType_value, s)
|
||||
return CosType(obj), err
|
||||
obj, exists := CosType_value[strings.ToUpper(s)]
|
||||
if !exists {
|
||||
return -1, fmt.Errorf("Invalid cos value: %s", s)
|
||||
}
|
||||
return CosType(obj), nil
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of CosType
|
||||
func (x CosType) SimpleString() string {
|
||||
return simpleString("cos_type", CosType_name, int32(x))
|
||||
}
|
||||
|
||||
// GraphDriverChangeTypeSimpleValueOf returns the string format of GraphDriverChangeType
|
||||
func GraphDriverChangeTypeSimpleValueOf(s string) (GraphDriverChangeType, error) {
|
||||
obj, err := simpleValueOf("graph_driver_change_type", GraphDriverChangeType_value, s)
|
||||
return GraphDriverChangeType(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of GraphDriverChangeType
|
||||
func (x GraphDriverChangeType) SimpleString() string {
|
||||
return simpleString("graph_driver_change_type", GraphDriverChangeType_name, int32(x))
|
||||
}
|
||||
|
||||
// VolumeActionParamSimpleValueOf returns the string format of VolumeAction
|
||||
func VolumeActionParamSimpleValueOf(s string) (VolumeActionParam, error) {
|
||||
obj, err := simpleValueOf("volume_action_param", VolumeActionParam_value, s)
|
||||
return VolumeActionParam(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of VolumeAction
|
||||
func (x VolumeActionParam) SimpleString() string {
|
||||
return simpleString("volume_action_param", VolumeActionParam_name, int32(x))
|
||||
}
|
||||
|
||||
// VolumeStateSimpleValueOf returns the string format of VolumeState
|
||||
func VolumeStateSimpleValueOf(s string) (VolumeState, error) {
|
||||
obj, err := simpleValueOf("volume_state", VolumeState_value, s)
|
||||
return VolumeState(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of VolumeState
|
||||
func (x VolumeState) SimpleString() string {
|
||||
return simpleString("volume_state", VolumeState_name, int32(x))
|
||||
}
|
||||
|
||||
// VolumeStatusSimpleValueOf returns the string format of VolumeStatus
|
||||
func VolumeStatusSimpleValueOf(s string) (VolumeStatus, error) {
|
||||
obj, err := simpleValueOf("volume_status", VolumeStatus_value, s)
|
||||
return VolumeStatus(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of VolumeStatus
|
||||
func (x VolumeStatus) SimpleString() string {
|
||||
return simpleString("volume_status", VolumeStatus_name, int32(x))
|
||||
}
|
||||
|
||||
// IoProfileSimpleValueOf returns the string format of IoProfile
|
||||
func IoProfileSimpleValueOf(s string) (IoProfile, error) {
|
||||
obj, err := simpleValueOf("io_profile", IoProfile_value, s)
|
||||
return IoProfile(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of IoProfile
|
||||
func (x IoProfile) SimpleString() string {
|
||||
return simpleString("io_profile", IoProfile_name, int32(x))
|
||||
}
|
||||
|
||||
func simpleValueOf(typeString string, valueMap map[string]int32, s string) (int32, error) {
|
||||
obj, ok := valueMap[strings.ToUpper(fmt.Sprintf("%s_%s", typeString, s))]
|
||||
if !ok {
|
||||
|
@ -178,6 +257,7 @@ func toSec(ms uint64) uint64 {
|
|||
return ms / 1000
|
||||
}
|
||||
|
||||
// WriteThroughput returns the write throughput
|
||||
func (v *Stats) WriteThroughput() uint64 {
|
||||
if v.IntervalMs == 0 {
|
||||
return 0
|
||||
|
@ -185,6 +265,7 @@ func (v *Stats) WriteThroughput() uint64 {
|
|||
return (v.WriteBytes) / toSec(v.IntervalMs)
|
||||
}
|
||||
|
||||
// ReadThroughput returns the read throughput
|
||||
func (v *Stats) ReadThroughput() uint64 {
|
||||
if v.IntervalMs == 0 {
|
||||
return 0
|
||||
|
@ -192,17 +273,93 @@ func (v *Stats) ReadThroughput() uint64 {
|
|||
return (v.ReadBytes) / toSec(v.IntervalMs)
|
||||
}
|
||||
|
||||
// Latency returns latency
|
||||
func (v *Stats) Latency() uint64 {
|
||||
ops := v.Writes + v.Reads
|
||||
if ops == 0 {
|
||||
return 0
|
||||
}
|
||||
return (uint64)((v.IoMs * 1000) / (v.Writes + v.Reads))
|
||||
return (uint64)((v.IoMs * 1000) / ops)
|
||||
}
|
||||
|
||||
// Read latency returns avg. time required for read operation to complete
|
||||
func (v *Stats) ReadLatency() uint64 {
|
||||
if v.Reads == 0 {
|
||||
return 0
|
||||
}
|
||||
return (uint64)((v.ReadMs * 1000) / v.Reads)
|
||||
}
|
||||
|
||||
// Write latency returns avg. time required for write operation to complete
|
||||
func (v *Stats) WriteLatency() uint64 {
|
||||
if v.Writes == 0 {
|
||||
return 0
|
||||
}
|
||||
return (uint64)((v.WriteMs * 1000) / v.Writes)
|
||||
}
|
||||
|
||||
// Iops returns iops
|
||||
func (v *Stats) Iops() uint64 {
|
||||
if v.IntervalMs == 0 {
|
||||
return 0
|
||||
}
|
||||
return (v.Writes + v.Reads) / toSec(v.IntervalMs)
|
||||
}
|
||||
|
||||
// Scaled returns true if the volume is scaled.
|
||||
func (v *Volume) Scaled() bool {
|
||||
return v.Spec.Scale > 1
|
||||
}
|
||||
|
||||
// Contains returns true if mid is a member of volume's replication set.
|
||||
func (m *Volume) Contains(mid string) bool {
|
||||
rsets := m.GetReplicaSets()
|
||||
for _, rset := range rsets {
|
||||
for _, node := range rset.Nodes {
|
||||
if node == mid {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Copy makes a deep copy of VolumeSpec
|
||||
func (s *VolumeSpec) Copy() *VolumeSpec {
|
||||
spec := *s
|
||||
if s.VolumeLabels != nil {
|
||||
spec.VolumeLabels = make(map[string]string)
|
||||
for k, v := range s.VolumeLabels {
|
||||
spec.VolumeLabels[k] = v
|
||||
}
|
||||
}
|
||||
if s.ReplicaSet != nil {
|
||||
spec.ReplicaSet = &ReplicaSet{Nodes: make([]string, len(s.ReplicaSet.Nodes))}
|
||||
copy(spec.ReplicaSet.Nodes, s.ReplicaSet.Nodes)
|
||||
}
|
||||
return &spec
|
||||
}
|
||||
|
||||
// Copy makes a deep copy of Node
|
||||
func (s *Node) Copy() *Node {
|
||||
localCopy := deepcopy.Copy(*s)
|
||||
nodeCopy := localCopy.(Node)
|
||||
return &nodeCopy
|
||||
}
|
||||
|
||||
func (v Volume) IsClone() bool {
|
||||
return v.Source != nil && len(v.Source.Parent) != 0 && !v.Readonly
|
||||
}
|
||||
|
||||
func (v Volume) IsSnapshot() bool {
|
||||
return v.Source != nil && len(v.Source.Parent) != 0 && v.Readonly
|
||||
}
|
||||
|
||||
func (v Volume) DisplayId() string {
|
||||
if v.Locator != nil {
|
||||
return fmt.Sprintf("%s (%s)", v.Locator.Name, v.Id)
|
||||
} else {
|
||||
return v.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -90,6 +90,13 @@ enum CosType {
|
|||
HIGH = 3;
|
||||
}
|
||||
|
||||
enum IoProfile {
|
||||
IO_PROFILE_SEQUENTIAL = 0;
|
||||
IO_PROFILE_RANDOM= 1;
|
||||
IO_PROFILE_DB = 2;
|
||||
IO_PROFILE_DB_REMOTE = 3;
|
||||
}
|
||||
|
||||
// VolumeState represents the state of a volume.
|
||||
enum VolumeState {
|
||||
VOLUME_STATE_NONE = 0;
|
||||
|
@ -108,6 +115,10 @@ enum VolumeState {
|
|||
// Volume is deleted, it will remain in this state
|
||||
// while resources are asynchronously reclaimed
|
||||
VOLUME_STATE_DELETED = 7;
|
||||
// Volume is trying to be detached
|
||||
VOLUME_STATE_TRY_DETACHING = 8;
|
||||
// Volume is undergoing restore
|
||||
VOLUME_STATE_RESTORE = 9;
|
||||
}
|
||||
|
||||
// VolumeStatus represents a health status for a volume.
|
||||
|
@ -138,6 +149,15 @@ enum ClusterNotify {
|
|||
CLUSTER_NOTIFY_DOWN = 0;
|
||||
}
|
||||
|
||||
enum AttachState {
|
||||
// Attached and available externally
|
||||
ATTACH_STATE_EXTERNAL = 0;
|
||||
// Attached but only available internally
|
||||
ATTACH_STATE_INTERNAL = 1;
|
||||
// Switching from External to Internal
|
||||
ATTACH_STATE_INTERNAL_SWITCH = 2;
|
||||
}
|
||||
|
||||
// StorageResource groups properties of a storage device.
|
||||
message StorageResource {
|
||||
// Id is the LUN identifier.
|
||||
|
@ -166,6 +186,24 @@ message StorageResource {
|
|||
google.protobuf.Timestamp last_scan = 12;
|
||||
}
|
||||
|
||||
// StoragePool groups different storage devices based on their CosType
|
||||
message StoragePool {
|
||||
// ID pool ID
|
||||
int32 ID = 1;
|
||||
// Cos reflects the capabilities of this drive pool
|
||||
CosType Cos = 2;
|
||||
// Medium underlying storage type
|
||||
StorageMedium Medium = 3;
|
||||
// RaidLevel storage raid level
|
||||
string RaidLevel = 4;
|
||||
// TotalSize of the pool
|
||||
uint64 TotalSize = 7;
|
||||
// Used size of the pool
|
||||
uint64 Used = 8;
|
||||
// Labels is a list of user defined name-value pairs
|
||||
map<string, string> labels = 9;
|
||||
}
|
||||
|
||||
// VolumeLocator is a structure that is attached to a volume
|
||||
// and is used to carry opaque metadata.
|
||||
message VolumeLocator {
|
||||
|
@ -183,89 +221,115 @@ message Source {
|
|||
string seed = 2;
|
||||
}
|
||||
|
||||
message Group {
|
||||
// Id common identifier across volumes that have the same group.
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
// VolumeSpec has the properties needed to create a volume.
|
||||
message VolumeSpec {
|
||||
// Ephemeral storage
|
||||
bool ephemeral = 1;
|
||||
// Thin provisioned volume size in bytes
|
||||
// Size specifies the thin provisioned volume size.
|
||||
uint64 size = 2;
|
||||
// Format disk with this FSType
|
||||
// Format specifies the filesystem for this volume.
|
||||
FSType format = 3;
|
||||
// Block size for filesystem
|
||||
// BlockSize for the filesystem.
|
||||
int64 block_size = 4;
|
||||
// Specifies the number of nodes that are
|
||||
// allowed to fail, and yet data is available
|
||||
// A value of 0 implies that data is not erasure coded,
|
||||
// a failure of a node will lead to data loss
|
||||
// HaLevel specifies the number of copies of data.
|
||||
int64 ha_level = 5;
|
||||
// The COS, 1 to 9
|
||||
// Cos specifies the relative class of service.
|
||||
CosType cos = 6;
|
||||
// Perform dedupe on this disk
|
||||
bool dedupe = 7;
|
||||
// IoProfile provides a hint about application using this volume.
|
||||
IoProfile io_profile = 7;
|
||||
// Dedupe specifies if the volume data is to be de-duplicated.
|
||||
bool dedupe = 8;
|
||||
// SnapshotInterval in minutes, set to 0 to disable snapshots
|
||||
uint32 snapshot_interval = 8;
|
||||
// Volume configuration labels
|
||||
map<string, string> volume_labels = 9;
|
||||
uint32 snapshot_interval = 9;
|
||||
// VolumeLabels configuration labels
|
||||
map<string, string> volume_labels = 10;
|
||||
// Shared is true if this volume can be remotely accessed.
|
||||
bool shared = 10;
|
||||
// ReplicaSet is the desired replicaSet the volume want to be placed.
|
||||
ReplicaSet replica_set = 11;
|
||||
// Specifies the number of parts the volume can be aggregated from.
|
||||
uint32 aggregation_level = 12;
|
||||
bool shared = 11;
|
||||
// ReplicaSet is the desired set of nodes for the volume data.
|
||||
ReplicaSet replica_set = 12;
|
||||
// Aggregatiokn level Specifies the number of parts the volume can be aggregated from.
|
||||
uint32 aggregation_level = 13;
|
||||
// Encrypted is true if this volume will be cryptographically secured.
|
||||
bool encrypted = 13;
|
||||
// User passphrase if this is an encrypted volume
|
||||
string passphrase = 14;
|
||||
// SnapshotSchedule
|
||||
string snapshot_schedule = 15;
|
||||
bool encrypted = 14;
|
||||
// Passphrase for an encrypted volume
|
||||
string passphrase = 15;
|
||||
// SnapshotSchedule a well known string that specifies when snapshots should be taken.
|
||||
string snapshot_schedule = 16;
|
||||
// Scale allows autocreation of volumes.
|
||||
uint32 scale = 16;
|
||||
uint32 scale = 17;
|
||||
// Sticky volumes cannot be deleted until the flag is removed.
|
||||
bool sticky = 18;
|
||||
// Group identifies a consistency group
|
||||
Group group = 21;
|
||||
// GroupEnforced is true if consistency group creation is enforced.
|
||||
bool group_enforced = 22;
|
||||
// Compressed is true if this volume is to be compressed.
|
||||
bool compressed = 23;
|
||||
}
|
||||
|
||||
// Set of machine IDs (nodes) to which part of this volume is erasure coded - for clustered storage arrays
|
||||
// ReplicaSet set of machine IDs (nodes) to which part of this volume is erasure
|
||||
// coded - for clustered storage arrays
|
||||
message ReplicaSet {
|
||||
repeated string nodes = 1;
|
||||
}
|
||||
|
||||
// List of name value mapping of driver specific runtime information.
|
||||
// RuntimeStateMap is a list of name value mapping of driver specific runtime
|
||||
// information.
|
||||
message RuntimeStateMap {
|
||||
map<string, string> runtime_state = 1;
|
||||
}
|
||||
|
||||
// Volume represents a live, created volume.
|
||||
// Volume represents an abstract storage volume.
|
||||
// Volume represents an abstract storage volume.
|
||||
message Volume {
|
||||
// Self referential volume ID
|
||||
// Self referential volume ID.
|
||||
string id = 1;
|
||||
// Source specified seed data for the volume.
|
||||
Source source = 2;
|
||||
bool readonly = 3;
|
||||
// Group volumes in the same group have the same group id.
|
||||
Group group = 3;
|
||||
// Readonly is true if this volume is to be mounted with readonly access.
|
||||
bool readonly = 4;
|
||||
// User specified locator
|
||||
VolumeLocator locator = 4;
|
||||
VolumeLocator locator = 5;
|
||||
// Volume creation time
|
||||
google.protobuf.Timestamp ctime = 5;
|
||||
google.protobuf.Timestamp ctime = 6;
|
||||
// User specified VolumeSpec
|
||||
VolumeSpec spec = 6;
|
||||
// Volume usage
|
||||
uint64 usage = 7;
|
||||
// Time when an integrity check for run
|
||||
google.protobuf.Timestamp last_scan = 8;
|
||||
// Format FSType type if any
|
||||
FSType format = 9;
|
||||
VolumeStatus status = 10;
|
||||
VolumeState state = 11;
|
||||
// Machine ID (node) on which this volume is attached
|
||||
// Machine ID is a node instance identifier for clustered systems.
|
||||
string attached_on = 12;
|
||||
string device_path = 14;
|
||||
repeated string attach_path = 15;
|
||||
// List of ReplicaSets which provide storage for this volume, for clustered storage arrays
|
||||
repeated ReplicaSet replica_sets = 16;
|
||||
// Last recorded error
|
||||
string error = 17;
|
||||
// List of name value mapping of driver specific runtime information.
|
||||
repeated RuntimeStateMap runtime_state = 18;
|
||||
string secure_device_path = 19;
|
||||
// BackgroundProcessing is true if volume is attached but not by the user
|
||||
bool background_processing = 20;
|
||||
VolumeSpec spec = 7;
|
||||
// Usage is bytes consumed by vtheis volume.
|
||||
uint64 usage = 8;
|
||||
// LastScan is the time when an integrity check was run.
|
||||
google.protobuf.Timestamp last_scan = 9;
|
||||
// Format specifies the filesytem for this volume.
|
||||
FSType format = 10;
|
||||
// Status is the availability status of this volume.
|
||||
VolumeStatus status = 11;
|
||||
// State is the current runtime state of this volume.
|
||||
VolumeState state = 12;
|
||||
// AttachedOn is the node instance identifier for clustered systems.
|
||||
string attached_on = 13;
|
||||
// AttachedState shows whether the device is attached for internal or external use.
|
||||
AttachState attached_state = 14;
|
||||
// DevicePath is the device exported by block device implementations.
|
||||
string device_path = 15;
|
||||
// SecureDevicePath is the device path for an encrypted volume.
|
||||
string secure_device_path = 16;
|
||||
// AttachPath is the mounted path in the host namespace.
|
||||
repeated string attach_path = 17;
|
||||
// AttachInfo is a list of name value mappings that provides attach information.
|
||||
map<string, string> attach_info = 18;
|
||||
// ReplicatSets storage for this volumefor clustered storage arrays.
|
||||
repeated ReplicaSet replica_sets = 19;
|
||||
// RuntimeState is a lst of name value mapping of driver specific runtime
|
||||
// information.
|
||||
repeated RuntimeStateMap runtime_state = 20;
|
||||
// Error is the Last recorded error.
|
||||
string error = 21;
|
||||
}
|
||||
|
||||
message Stats {
|
||||
|
@ -308,6 +372,8 @@ message Alert {
|
|||
bool cleared = 8;
|
||||
// TTL in seconds for this Alert
|
||||
uint64 ttl = 9;
|
||||
// UniqueTag helps identify a unique alert for a given resouce
|
||||
string unique_tag = 10;
|
||||
}
|
||||
|
||||
message Alerts {
|
||||
|
@ -339,9 +405,13 @@ message VolumeStateAction {
|
|||
VolumeActionParam attach = 1;
|
||||
// Mount or unmount volume
|
||||
VolumeActionParam mount = 2;
|
||||
// MountPath Path where the device is mounted
|
||||
string mount_path = 3;
|
||||
// Device path returned in attach
|
||||
// DevicePath Path returned in attach
|
||||
string device_path = 4;
|
||||
// UnmountBeforeDetach is used to check whether unmount should be done before
|
||||
// a detach
|
||||
bool unmount_before_detach = 5;
|
||||
}
|
||||
|
||||
message VolumeSetRequest {
|
||||
|
@ -351,6 +421,9 @@ message VolumeSetRequest {
|
|||
VolumeSpec spec = 2;
|
||||
// State modification on this volume.
|
||||
VolumeStateAction action = 3;
|
||||
// additional options
|
||||
// required for the Set operation.
|
||||
map<string, string> options = 4;
|
||||
}
|
||||
|
||||
message VolumeSetResponse {
|
||||
|
|
|
@ -16,7 +16,7 @@ var (
|
|||
)
|
||||
|
||||
// NewClient returns a new REST client for specified server.
|
||||
func NewClient(host string, version string) (*Client, error) {
|
||||
func NewClient(host, version, userAgent string) (*Client, error) {
|
||||
baseURL, err := url.Parse(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -25,14 +25,48 @@ func NewClient(host string, version string) (*Client, error) {
|
|||
baseURL.Path = "/"
|
||||
}
|
||||
unix2HTTP(baseURL)
|
||||
hClient := getHTTPClient(host)
|
||||
if hClient == nil {
|
||||
return nil, fmt.Errorf("Unable to parse provided url: %v", host)
|
||||
}
|
||||
c := &Client{
|
||||
base: baseURL,
|
||||
version: version,
|
||||
httpClient: getHttpClient(host),
|
||||
base: baseURL,
|
||||
version: version,
|
||||
httpClient: hClient,
|
||||
authstring: "",
|
||||
accesstoken: "",
|
||||
userAgent: fmt.Sprintf("%v/%v", userAgent, version),
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// NewAuthClient returns a new REST client for specified server.
|
||||
func NewAuthClient(host, version, authstring, accesstoken, userAgent string) (*Client, error) {
|
||||
baseURL, err := url.Parse(host)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if baseURL.Path == "" {
|
||||
baseURL.Path = "/"
|
||||
}
|
||||
unix2HTTP(baseURL)
|
||||
hClient := getHTTPClient(host)
|
||||
if hClient == nil {
|
||||
return nil, fmt.Errorf("Unable to parse provided url: %v", host)
|
||||
}
|
||||
c := &Client{
|
||||
base: baseURL,
|
||||
version: version,
|
||||
httpClient: hClient,
|
||||
authstring: authstring,
|
||||
accesstoken: accesstoken,
|
||||
userAgent: fmt.Sprintf("%v/%v", userAgent, version),
|
||||
}
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// GetUnixServerPath returns a unix domain socket prepended with the
|
||||
// provided path.
|
||||
func GetUnixServerPath(socketName string, paths ...string) string {
|
||||
serverPath := "unix://"
|
||||
for _, path := range paths {
|
||||
|
@ -42,13 +76,15 @@ func GetUnixServerPath(socketName string, paths ...string) string {
|
|||
return serverPath
|
||||
}
|
||||
|
||||
|
||||
// Client is an HTTP REST wrapper. Use one of Get/Post/Put/Delete to get a request
|
||||
// object.
|
||||
type Client struct {
|
||||
base *url.URL
|
||||
version string
|
||||
httpClient *http.Client
|
||||
base *url.URL
|
||||
version string
|
||||
httpClient *http.Client
|
||||
authstring string
|
||||
accesstoken string
|
||||
userAgent string
|
||||
}
|
||||
|
||||
// Status sends a Status request at the /status REST endpoint.
|
||||
|
@ -58,7 +94,7 @@ func (c *Client) Status() (*Status, error) {
|
|||
return status, err
|
||||
}
|
||||
|
||||
// Version send a request at the /versions REST endpoint.
|
||||
// Versions send a request at the /versions REST endpoint.
|
||||
func (c *Client) Versions(endpoint string) ([]string, error) {
|
||||
versions := []string{}
|
||||
err := c.Get().Resource(endpoint + "/versions").Do().Unmarshal(&versions)
|
||||
|
@ -67,22 +103,22 @@ func (c *Client) Versions(endpoint string) ([]string, error) {
|
|||
|
||||
// Get returns a Request object setup for GET call.
|
||||
func (c *Client) Get() *Request {
|
||||
return NewRequest(c.httpClient, c.base, "GET", c.version)
|
||||
return NewRequest(c.httpClient, c.base, "GET", c.version, c.authstring, c.userAgent)
|
||||
}
|
||||
|
||||
// Post returns a Request object setup for POST call.
|
||||
func (c *Client) Post() *Request {
|
||||
return NewRequest(c.httpClient, c.base, "POST", c.version)
|
||||
return NewRequest(c.httpClient, c.base, "POST", c.version, c.authstring, c.userAgent)
|
||||
}
|
||||
|
||||
// Put returns a Request object setup for PUT call.
|
||||
func (c *Client) Put() *Request {
|
||||
return NewRequest(c.httpClient, c.base, "PUT", c.version)
|
||||
return NewRequest(c.httpClient, c.base, "PUT", c.version, c.authstring, c.userAgent)
|
||||
}
|
||||
|
||||
// Put returns a Request object setup for DELETE call.
|
||||
// Delete returns a Request object setup for DELETE call.
|
||||
func (c *Client) Delete() *Request {
|
||||
return NewRequest(c.httpClient, c.base, "DELETE", c.version)
|
||||
return NewRequest(c.httpClient, c.base, "DELETE", c.version, c.authstring, c.userAgent)
|
||||
}
|
||||
|
||||
func unix2HTTP(u *url.URL) {
|
||||
|
@ -94,7 +130,12 @@ func unix2HTTP(u *url.URL) {
|
|||
}
|
||||
}
|
||||
|
||||
func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration) *http.Client {
|
||||
func newHTTPClient(
|
||||
u *url.URL,
|
||||
tlsConfig *tls.Config,
|
||||
timeout time.Duration,
|
||||
responseTimeout time.Duration,
|
||||
) *http.Client {
|
||||
httpTransport := &http.Transport{
|
||||
TLSClientConfig: tlsConfig,
|
||||
}
|
||||
|
@ -114,28 +155,24 @@ func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration) *ht
|
|||
}
|
||||
}
|
||||
|
||||
return &http.Client{Transport: httpTransport}
|
||||
return &http.Client{Transport: httpTransport, Timeout: responseTimeout}
|
||||
}
|
||||
|
||||
func getHttpClient(host string) *http.Client {
|
||||
func getHTTPClient(host string) *http.Client {
|
||||
cacheLock.Lock()
|
||||
defer cacheLock.Unlock()
|
||||
c, ok := httpCache[host]
|
||||
if !ok {
|
||||
cacheLock.Lock()
|
||||
defer cacheLock.Unlock()
|
||||
c, ok = httpCache[host]
|
||||
if !ok {
|
||||
u, err := url.Parse(host)
|
||||
if err != nil {
|
||||
// TODO(pedge): clean up
|
||||
fmt.Println("Failed to parse into url", host)
|
||||
return nil
|
||||
}
|
||||
if u.Path == "" {
|
||||
u.Path = "/"
|
||||
}
|
||||
c = newHTTPClient(u, nil, 10*time.Second)
|
||||
httpCache[host] = c
|
||||
u, err := url.Parse(host)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if u.Path == "" {
|
||||
u.Path = "/"
|
||||
}
|
||||
c = newHTTPClient(u, nil, 10*time.Second, 5*time.Minute)
|
||||
httpCache[host] = c
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"math/rand"
|
||||
)
|
||||
|
||||
// Request is contructed iteratively by the client and finally dispatched.
|
||||
|
@ -31,6 +32,8 @@ type Request struct {
|
|||
req *http.Request
|
||||
resp *http.Response
|
||||
timeout time.Duration
|
||||
authstring string
|
||||
accesstoken string
|
||||
}
|
||||
|
||||
// Response is a representation of HTTP response received from the server.
|
||||
|
@ -48,14 +51,17 @@ type Status struct {
|
|||
}
|
||||
|
||||
// NewRequest instance
|
||||
func NewRequest(client *http.Client, base *url.URL, verb string, version string) *Request {
|
||||
return &Request{
|
||||
func NewRequest(client *http.Client, base *url.URL, verb string, version string, authstring, userAgent string) *Request {
|
||||
r := &Request{
|
||||
client: client,
|
||||
verb: verb,
|
||||
base: base,
|
||||
path: base.Path,
|
||||
version: version,
|
||||
authstring: authstring,
|
||||
}
|
||||
r.SetHeader("User-Agent", userAgent)
|
||||
return r
|
||||
}
|
||||
|
||||
func checkExists(mustExist string, before string) error {
|
||||
|
@ -251,8 +257,19 @@ func (r *Request) Do() *Response {
|
|||
if r.headers == nil {
|
||||
r.headers = http.Header{}
|
||||
}
|
||||
|
||||
req.Header = r.headers
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Date", time.Now().String())
|
||||
|
||||
if len(r.authstring) > 0 {
|
||||
req.Header.Set("Authorization", "Basic "+ r.authstring)
|
||||
}
|
||||
|
||||
if len(r.accesstoken) > 0 {
|
||||
req.Header.Set("Access-Token", r.accesstoken)
|
||||
}
|
||||
|
||||
resp, err = r.client.Do(req)
|
||||
if err != nil {
|
||||
return &Response{err: err}
|
||||
|
@ -295,10 +312,21 @@ func (r Response) Error() error {
|
|||
return r.err
|
||||
}
|
||||
|
||||
// FormatError formats the error
|
||||
func (r Response) FormatError() error {
|
||||
if len(r.body) == 0 {
|
||||
return fmt.Errorf("Error: %v", r.err)
|
||||
} else {
|
||||
return fmt.Errorf("HTTP-%d: %s", r.statusCode, string(r.body))
|
||||
}
|
||||
return fmt.Errorf("HTTP-%d: %s", r.statusCode, string(r.body))
|
||||
}
|
||||
|
||||
func digest(method string, path string) string {
|
||||
now := time.Now().String()
|
||||
|
||||
s1 := rand.NewSource(time.Now().UnixNano())
|
||||
r1 := rand.New(s1)
|
||||
|
||||
nonce := r1.Intn(10)
|
||||
|
||||
return method + "+" + path + "+" + now + "+" + strconv.Itoa(nonce)
|
||||
}
|
||||
|
|
|
@ -195,6 +195,21 @@ func (v *volumeClient) Snapshot(volumeID string, readonly bool,
|
|||
return "", nil
|
||||
}
|
||||
|
||||
// Restore specified volume to given snapshot state
|
||||
func (v *volumeClient) Restore(volumeID string, snapID string) error {
|
||||
response := &api.VolumeResponse{}
|
||||
req := v.c.Post().Resource(snapPath + "/restore").Instance(volumeID)
|
||||
req.QueryOption(api.OptSnapID, snapID)
|
||||
|
||||
if err := req.Do().Unmarshal(response); err != nil {
|
||||
return err
|
||||
}
|
||||
if response.Error != "" {
|
||||
return errors.New(response.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Stats for specified volume.
|
||||
// Errors ErrEnoEnt may be returned
|
||||
func (v *volumeClient) Stats(
|
||||
|
@ -205,21 +220,20 @@ func (v *volumeClient) Stats(
|
|||
req := v.c.Get().Resource(volumePath + "/stats").Instance(volumeID)
|
||||
req.QueryOption(api.OptCumulative, strconv.FormatBool(cumulative))
|
||||
|
||||
if err := req.Do().Unmarshal(stats); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err := req.Do().Unmarshal(stats)
|
||||
return stats, err
|
||||
|
||||
return stats, nil
|
||||
}
|
||||
|
||||
// Alerts on this volume.
|
||||
// UsedSize returns allocated volume size.
|
||||
// Errors ErrEnoEnt may be returned
|
||||
func (v *volumeClient) Alerts(volumeID string) (*api.Alerts, error) {
|
||||
alerts := &api.Alerts{}
|
||||
if err := v.c.Get().Resource(volumePath + "/alerts").Instance(volumeID).Do().Unmarshal(alerts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return alerts, nil
|
||||
func (v *volumeClient) UsedSize(
|
||||
volumeID string,
|
||||
) (uint64, error) {
|
||||
var usedSize uint64
|
||||
req := v.c.Get().Resource(volumePath + "/usedsize").Instance(volumeID)
|
||||
err := req.Do().Unmarshal(&usedSize)
|
||||
return usedSize, err
|
||||
}
|
||||
|
||||
// Active Requests on all volume.
|
||||
|
@ -289,13 +303,14 @@ func (v *volumeClient) SnapEnumerate(ids []string,
|
|||
// Attach map device to the host.
|
||||
// On success the devicePath specifies location where the device is exported
|
||||
// Errors ErrEnoEnt, ErrVolAttached may be returned.
|
||||
func (v *volumeClient) Attach(volumeID string) (string, error) {
|
||||
func (v *volumeClient) Attach(volumeID string, attachOptions map[string]string) (string, error) {
|
||||
response, err := v.doVolumeSetGetResponse(
|
||||
volumeID,
|
||||
&api.VolumeSetRequest{
|
||||
Action: &api.VolumeStateAction{
|
||||
Attach: api.VolumeActionParam_VOLUME_ACTION_PARAM_ON,
|
||||
},
|
||||
Options: attachOptions,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -313,12 +328,13 @@ func (v *volumeClient) Attach(volumeID string) (string, error) {
|
|||
|
||||
// Detach device from the host.
|
||||
// Errors ErrEnoEnt, ErrVolDetached may be returned.
|
||||
func (v *volumeClient) Detach(volumeID string) error {
|
||||
func (v *volumeClient) Detach(volumeID string, unmountBeforeDetach bool) error {
|
||||
return v.doVolumeSet(
|
||||
volumeID,
|
||||
&api.VolumeSetRequest{
|
||||
Action: &api.VolumeStateAction{
|
||||
Attach: api.VolumeActionParam_VOLUME_ACTION_PARAM_OFF,
|
||||
Attach: api.VolumeActionParam_VOLUME_ACTION_PARAM_OFF,
|
||||
UnmountBeforeDetach: unmountBeforeDetach,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
|
|
@ -2,9 +2,9 @@ package volume
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/libopenstorage/openstorage/api"
|
||||
"github.com/libopenstorage/openstorage/api/client"
|
||||
"github.com/libopenstorage/openstorage/volume"
|
||||
"github.com/libopenstorage/openstorage/api"
|
||||
)
|
||||
|
||||
// VolumeDriver returns a REST wrapper for the VolumeDriver interface.
|
||||
|
@ -12,10 +12,10 @@ func VolumeDriver(c *client.Client) volume.VolumeDriver {
|
|||
return newVolumeClient(c)
|
||||
}
|
||||
|
||||
// NewDriver returns a new REST client of the supplied version for specified driver.
|
||||
// NewAuthDriverClient returns a new REST client of the supplied version for specified driver.
|
||||
// host: REST endpoint [http://<ip>:<port> OR unix://<path-to-unix-socket>]. default: [unix:///var/lib/osd/<driverName>.sock]
|
||||
// version: Volume API version
|
||||
func NewDriverClient(host, driverName, version string) (*client.Client, error) {
|
||||
func NewAuthDriverClient(host, driverName, version, authstring, accesstoken, userAgent string) (*client.Client, error) {
|
||||
if driverName == "" {
|
||||
return nil, fmt.Errorf("Driver Name cannot be empty")
|
||||
}
|
||||
|
@ -26,7 +26,24 @@ func NewDriverClient(host, driverName, version string) (*client.Client, error) {
|
|||
// Set the default version
|
||||
version = volume.APIVersion
|
||||
}
|
||||
return client.NewClient(host, version)
|
||||
return client.NewAuthClient(host, version, authstring, accesstoken, userAgent)
|
||||
}
|
||||
|
||||
// NewDriverClient returns a new REST client of the supplied version for specified driver.
|
||||
// host: REST endpoint [http://<ip>:<port> OR unix://<path-to-unix-socket>]. default: [unix:///var/lib/osd/<driverName>.sock]
|
||||
// version: Volume API version
|
||||
func NewDriverClient(host, driverName, version, userAgent string) (*client.Client, error) {
|
||||
if driverName == "" {
|
||||
return nil, fmt.Errorf("Driver Name cannot be empty")
|
||||
}
|
||||
if host == "" {
|
||||
host = client.GetUnixServerPath(driverName, volume.DriverAPIBase)
|
||||
}
|
||||
if version == "" {
|
||||
// Set the default version
|
||||
version = volume.APIVersion
|
||||
}
|
||||
return client.NewClient(host, version, userAgent)
|
||||
}
|
||||
|
||||
// GetSupportedDriverVersions returns a list of supported versions
|
||||
|
@ -38,7 +55,7 @@ func GetSupportedDriverVersions(driverName, host string) ([]string, error) {
|
|||
host = client.GetUnixServerPath(driverName, volume.DriverAPIBase)
|
||||
}
|
||||
|
||||
client, err := client.NewClient(host, "")
|
||||
client, err := client.NewClient(host, "", "")
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ go_library(
|
|||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/github.com/libopenstorage/openstorage/api:go_default_library",
|
||||
"//vendor/github.com/libopenstorage/openstorage/pkg/parser:go_default_library",
|
||||
"//vendor/github.com/libopenstorage/openstorage/pkg/units:go_default_library",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -4,8 +4,10 @@ import (
|
|||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/libopenstorage/openstorage/api"
|
||||
"github.com/libopenstorage/openstorage/pkg/parser"
|
||||
"github.com/libopenstorage/openstorage/pkg/units"
|
||||
)
|
||||
|
||||
|
@ -16,54 +18,92 @@ type SpecHandler interface {
|
|||
// If the scheduler was unable to pass in the volume spec via the API,
|
||||
// the spec can be passed in via the name in the format:
|
||||
// "key=value;key=value;name=volname"
|
||||
// source is populated if key parent=<volume_id> is specified.
|
||||
// If the spec was parsed, it returns:
|
||||
// (true, parsed_spec, parsed_name)
|
||||
// (true, parsed_spec, locator, source, parsed_name)
|
||||
// If the input string didn't contain the string, it returns:
|
||||
// (false, DefaultSpec(), inputString)
|
||||
SpecFromString(inputString string) (bool, *api.VolumeSpec, string)
|
||||
// (false, DefaultSpec(), nil, nil, inputString)
|
||||
SpecFromString(inputString string) (
|
||||
bool,
|
||||
*api.VolumeSpec,
|
||||
*api.VolumeLocator,
|
||||
*api.Source,
|
||||
string,
|
||||
)
|
||||
|
||||
// SpecFromOpts parses in docker options passed in the the docker run
|
||||
// command of the form --opt name=value
|
||||
// source is populated if --opt parent=<volume_id> is specified.
|
||||
// If the options are validated then it returns:
|
||||
// (resultant_VolumeSpec, nil)
|
||||
// (resultant_VolumeSpec, source, locator, nil)
|
||||
// If the options have invalid values then it returns:
|
||||
// (nil, error)
|
||||
// (nil, nil, nil, error)
|
||||
|
||||
SpecFromOpts(opts map[string]string) (
|
||||
*api.VolumeSpec,
|
||||
*api.VolumeLocator,
|
||||
*api.Source,
|
||||
error,
|
||||
)
|
||||
|
||||
// UpdateSpecFromOpts parses in volume options passed through the opts map and updates given spec, locator & source
|
||||
// If the options are validated then it returns:
|
||||
// (resultant_VolumeSpec, source, locator, nil)
|
||||
// If the options have invalid values then it returns:
|
||||
// (nil, nil, nil, error)
|
||||
UpdateSpecFromOpts(opts map[string]string, spec *api.VolumeSpec, locator *api.VolumeLocator, source *api.Source) (
|
||||
*api.VolumeSpec,
|
||||
*api.VolumeLocator,
|
||||
*api.Source,
|
||||
error,
|
||||
)
|
||||
|
||||
SpecFromOpts(opts map[string]string) (*api.VolumeSpec, error)
|
||||
// Returns a default VolumeSpec if no docker options or string encoding
|
||||
// was provided.
|
||||
DefaultSpec() *api.VolumeSpec
|
||||
}
|
||||
|
||||
var (
|
||||
nameRegex = regexp.MustCompile(api.Name + "=([0-9A-Za-z]+),?")
|
||||
nameRegex = regexp.MustCompile(api.Name + "=([0-9A-Za-z_-]+),?")
|
||||
nodesRegex = regexp.MustCompile(api.SpecNodes + "=([0-9A-Za-z_-]+),?")
|
||||
sizeRegex = regexp.MustCompile(api.SpecSize + "=([0-9A-Za-z]+),?")
|
||||
scaleRegex = regexp.MustCompile(api.SpecScale + "=([0-9A-Za-z]+),?")
|
||||
scaleRegex = regexp.MustCompile(api.SpecScale + "=([0-9]+),?")
|
||||
fsRegex = regexp.MustCompile(api.SpecFilesystem + "=([0-9A-Za-z]+),?")
|
||||
bsRegex = regexp.MustCompile(api.SpecBlockSize + "=([0-9]+),?")
|
||||
haRegex = regexp.MustCompile(api.SpecHaLevel + "=([0-9]+),?")
|
||||
cosRegex = regexp.MustCompile(api.SpecPriority + "=([A-Za-z]+),?")
|
||||
sharedRegex = regexp.MustCompile(api.SpecShared + "=([A-Za-z]+),?")
|
||||
passphraseRegex = regexp.MustCompile(api.SpecPassphrase + "=([0-9A-Za-z_@./#&+-]+),?")
|
||||
stickyRegex = regexp.MustCompile(api.SpecSticky + "=([A-Za-z]+),?")
|
||||
secureRegex = regexp.MustCompile(api.SpecSecure + "=([A-Za-z]+),?")
|
||||
zonesRegex = regexp.MustCompile(api.SpecZones + "=([A-Za-z]+),?")
|
||||
racksRegex = regexp.MustCompile(api.SpecRacks + "=([A-Za-z]+),?")
|
||||
aggrRegex = regexp.MustCompile(api.SpecAggregationLevel + "=([0-9]+|" +
|
||||
api.SpecAutoAggregationValue + "),?")
|
||||
compressedRegex = regexp.MustCompile(api.SpecCompressed + "=([A-Za-z]+),?")
|
||||
snapScheduleRegex = regexp.MustCompile(api.SpecSnapshotSchedule +
|
||||
`=([A-Za-z0-9:;@=#]+),?`)
|
||||
)
|
||||
|
||||
type specHandler struct {
|
||||
}
|
||||
|
||||
// NewSpecHandler returns a new SpecHandler interface
|
||||
func NewSpecHandler() SpecHandler {
|
||||
return &specHandler{}
|
||||
}
|
||||
|
||||
func (d *specHandler) cosLevel(cos string) (uint32, error) {
|
||||
func (d *specHandler) cosLevel(cos string) (api.CosType, error) {
|
||||
cos = strings.ToLower(cos)
|
||||
switch cos {
|
||||
case "high", "3":
|
||||
return uint32(api.CosType_HIGH), nil
|
||||
return api.CosType_HIGH, nil
|
||||
case "medium", "2":
|
||||
return uint32(api.CosType_MEDIUM), nil
|
||||
return api.CosType_MEDIUM, nil
|
||||
case "low", "1", "":
|
||||
return uint32(api.CosType_LOW), nil
|
||||
return api.CosType_LOW, nil
|
||||
}
|
||||
return uint32(api.CosType_LOW),
|
||||
return api.CosType_NONE,
|
||||
fmt.Errorf("Cos must be one of %q | %q | %q", "high", "medium", "low")
|
||||
}
|
||||
|
||||
|
@ -91,30 +131,58 @@ func (d *specHandler) DefaultSpec() *api.VolumeSpec {
|
|||
}
|
||||
}
|
||||
|
||||
func (d *specHandler) SpecFromOpts(
|
||||
opts map[string]string,
|
||||
) (*api.VolumeSpec, error) {
|
||||
spec := d.DefaultSpec()
|
||||
func (d *specHandler) UpdateSpecFromOpts(opts map[string]string, spec *api.VolumeSpec, locator *api.VolumeLocator,
|
||||
source *api.Source) (*api.VolumeSpec, *api.VolumeLocator, *api.Source, error) {
|
||||
nodeList := make([]string, 0)
|
||||
|
||||
if spec == nil {
|
||||
spec = d.DefaultSpec()
|
||||
}
|
||||
|
||||
if source == nil {
|
||||
source = &api.Source{}
|
||||
}
|
||||
|
||||
if locator == nil {
|
||||
locator = &api.VolumeLocator{
|
||||
VolumeLabels: make(map[string]string),
|
||||
}
|
||||
}
|
||||
|
||||
for k, v := range opts {
|
||||
switch k {
|
||||
case api.SpecNodes:
|
||||
inputNodes := strings.Split(v, ",")
|
||||
for _, node := range inputNodes {
|
||||
if len(node) != 0 {
|
||||
nodeList = append(nodeList, node)
|
||||
}
|
||||
}
|
||||
spec.ReplicaSet = &api.ReplicaSet{Nodes: nodeList}
|
||||
case api.SpecParent:
|
||||
source.Parent = v
|
||||
case api.SpecEphemeral:
|
||||
spec.Ephemeral, _ = strconv.ParseBool(v)
|
||||
case api.SpecSize:
|
||||
if size, err := units.Parse(v); err != nil {
|
||||
return nil, err
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.Size = uint64(size)
|
||||
}
|
||||
case api.SpecScale:
|
||||
if scale, err := strconv.ParseUint(v, 10, 64); err == nil {
|
||||
spec.Scale = uint32(scale)
|
||||
}
|
||||
|
||||
case api.SpecFilesystem:
|
||||
if value, err := api.FSTypeSimpleValueOf(v); err != nil {
|
||||
return nil, err
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.Format = value
|
||||
}
|
||||
case api.SpecBlockSize:
|
||||
if blockSize, err := units.Parse(v); err != nil {
|
||||
return nil, err
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.BlockSize = blockSize
|
||||
}
|
||||
|
@ -122,39 +190,108 @@ func (d *specHandler) SpecFromOpts(
|
|||
haLevel, _ := strconv.ParseInt(v, 10, 64)
|
||||
spec.HaLevel = haLevel
|
||||
case api.SpecPriority:
|
||||
cos, _ := api.CosTypeSimpleValueOf(v)
|
||||
cos, err := d.cosLevel(v)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
spec.Cos = cos
|
||||
case api.SpecPriorityAlias:
|
||||
cos, err := d.cosLevel(v)
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
spec.Cos = cos
|
||||
case api.SpecDedupe:
|
||||
spec.Dedupe, _ = strconv.ParseBool(v)
|
||||
case api.SpecSnapshotInterval:
|
||||
snapshotInterval, _ := strconv.ParseUint(v, 10, 32)
|
||||
spec.SnapshotInterval = uint32(snapshotInterval)
|
||||
case api.SpecSnapshotSchedule:
|
||||
spec.SnapshotSchedule = v
|
||||
case api.SpecAggregationLevel:
|
||||
aggregationLevel, _ := strconv.ParseUint(v, 10, 32)
|
||||
spec.AggregationLevel = uint32(aggregationLevel)
|
||||
if v == api.SpecAutoAggregationValue {
|
||||
spec.AggregationLevel = api.AutoAggregation
|
||||
} else {
|
||||
aggregationLevel, _ := strconv.ParseUint(v, 10, 32)
|
||||
spec.AggregationLevel = uint32(aggregationLevel)
|
||||
}
|
||||
case api.SpecShared:
|
||||
if shared, err := strconv.ParseBool(v); err != nil {
|
||||
return nil, err
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.Shared = shared
|
||||
}
|
||||
case api.SpecSticky:
|
||||
if sticky, err := strconv.ParseBool(v); err != nil {
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.Sticky = sticky
|
||||
}
|
||||
case api.SpecSecure:
|
||||
if secure, err := strconv.ParseBool(v); err != nil {
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.Encrypted = secure
|
||||
}
|
||||
case api.SpecPassphrase:
|
||||
spec.Encrypted = true
|
||||
spec.Passphrase = v
|
||||
case api.SpecGroup:
|
||||
spec.Group = &api.Group{Id: v}
|
||||
case api.SpecGroupEnforce:
|
||||
if groupEnforced, err := strconv.ParseBool(v); err != nil {
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.GroupEnforced = groupEnforced
|
||||
}
|
||||
case api.SpecZones, api.SpecRacks:
|
||||
locator.VolumeLabels[k] = v
|
||||
case api.SpecCompressed:
|
||||
if compressed, err := strconv.ParseBool(v); err != nil {
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.Compressed = compressed
|
||||
}
|
||||
case api.SpecLabels:
|
||||
if labels, err := parser.LabelsFromString(v); err != nil {
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
for k, v := range labels {
|
||||
locator.VolumeLabels[k] = v
|
||||
}
|
||||
}
|
||||
case api.SpecIoProfile:
|
||||
if ioProfile, err := api.IoProfileSimpleValueOf(v); err != nil {
|
||||
return nil, nil, nil, err
|
||||
} else {
|
||||
spec.IoProfile = ioProfile
|
||||
}
|
||||
default:
|
||||
spec.VolumeLabels[k] = v
|
||||
}
|
||||
}
|
||||
return spec, nil
|
||||
return spec, locator, source, nil
|
||||
}
|
||||
|
||||
func (d *specHandler) SpecFromOpts(
|
||||
opts map[string]string,
|
||||
) (*api.VolumeSpec, *api.VolumeLocator, *api.Source, error) {
|
||||
source := &api.Source{}
|
||||
locator := &api.VolumeLocator{
|
||||
VolumeLabels: make(map[string]string),
|
||||
}
|
||||
|
||||
spec := d.DefaultSpec()
|
||||
return d.UpdateSpecFromOpts(opts, spec, locator, source)
|
||||
}
|
||||
|
||||
func (d *specHandler) SpecFromString(
|
||||
str string,
|
||||
) (bool, *api.VolumeSpec, string) {
|
||||
) (bool, *api.VolumeSpec, *api.VolumeLocator, *api.Source, string) {
|
||||
// If we can't parse the name, the rest of the spec is invalid.
|
||||
ok, name := d.getVal(nameRegex, str)
|
||||
if !ok {
|
||||
return false, d.DefaultSpec(), str
|
||||
return false, d.DefaultSpec(), nil, nil, str
|
||||
}
|
||||
|
||||
opts := make(map[string]string)
|
||||
|
@ -162,6 +299,9 @@ func (d *specHandler) SpecFromString(
|
|||
if ok, sz := d.getVal(sizeRegex, str); ok {
|
||||
opts[api.SpecSize] = sz
|
||||
}
|
||||
if ok, nodes := d.getVal(nodesRegex, str); ok {
|
||||
opts[api.SpecNodes] = nodes
|
||||
}
|
||||
if ok, scale := d.getVal(scaleRegex, str); ok {
|
||||
opts[api.SpecScale] = scale
|
||||
}
|
||||
|
@ -180,13 +320,34 @@ func (d *specHandler) SpecFromString(
|
|||
if ok, shared := d.getVal(sharedRegex, str); ok {
|
||||
opts[api.SpecShared] = shared
|
||||
}
|
||||
if ok, sticky := d.getVal(stickyRegex, str); ok {
|
||||
opts[api.SpecSticky] = sticky
|
||||
}
|
||||
if ok, secure := d.getVal(secureRegex, str); ok {
|
||||
opts[api.SpecSecure] = secure
|
||||
}
|
||||
if ok, passphrase := d.getVal(passphraseRegex, str); ok {
|
||||
opts[api.SpecPassphrase] = passphrase
|
||||
}
|
||||
|
||||
spec, err := d.SpecFromOpts(opts)
|
||||
if err != nil {
|
||||
return false, d.DefaultSpec(), name
|
||||
if ok, zones := d.getVal(zonesRegex, str); ok {
|
||||
opts[api.SpecZones] = zones
|
||||
}
|
||||
return true, spec, name
|
||||
if ok, racks := d.getVal(racksRegex, str); ok {
|
||||
opts[api.SpecRacks] = racks
|
||||
}
|
||||
if ok, aggregationLvl := d.getVal(aggrRegex, str); ok {
|
||||
opts[api.SpecAggregationLevel] = aggregationLvl
|
||||
}
|
||||
if ok, compressed := d.getVal(compressedRegex, str); ok {
|
||||
opts[api.SpecCompressed] = compressed
|
||||
}
|
||||
if ok, sched := d.getVal(snapScheduleRegex, str); ok {
|
||||
opts[api.SpecSnapshotSchedule] = strings.Replace(sched, "#", ",", -1)
|
||||
}
|
||||
|
||||
spec, locator, source, err := d.SpecFromOpts(opts)
|
||||
if err != nil {
|
||||
return false, d.DefaultSpec(), nil, nil, name
|
||||
}
|
||||
return true, spec, locator, source, name
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package api
|
||||
|
||||
// StatusKind indicates the severity of a status
|
||||
type StatusKind int32
|
||||
|
||||
const (
|
||||
|
@ -12,32 +13,35 @@ const (
|
|||
)
|
||||
|
||||
var statusToStatusKind = map[Status]StatusKind{
|
||||
Status_STATUS_NONE: StatusSeverityHigh,
|
||||
Status_STATUS_INIT: StatusSeverityMedium,
|
||||
Status_STATUS_OK: StatusSeverityLow,
|
||||
Status_STATUS_OFFLINE: StatusSeverityHigh,
|
||||
Status_STATUS_ERROR: StatusSeverityHigh,
|
||||
Status_STATUS_NOT_IN_QUORUM: StatusSeverityHigh,
|
||||
Status_STATUS_DECOMMISSION: StatusSeverityHigh,
|
||||
Status_STATUS_MAINTENANCE: StatusSeverityHigh,
|
||||
Status_STATUS_STORAGE_DOWN: StatusSeverityHigh,
|
||||
Status_STATUS_STORAGE_DEGRADED: StatusSeverityHigh,
|
||||
Status_STATUS_NEEDS_REBOOT: StatusSeverityHigh,
|
||||
Status_STATUS_STORAGE_REBALANCE: StatusSeverityMedium,
|
||||
Status_STATUS_STORAGE_DRIVE_REPLACE: StatusSeverityMedium,
|
||||
Status_STATUS_NONE: StatusSeverityHigh,
|
||||
Status_STATUS_INIT: StatusSeverityMedium,
|
||||
Status_STATUS_OK: StatusSeverityLow,
|
||||
Status_STATUS_OFFLINE: StatusSeverityHigh,
|
||||
Status_STATUS_ERROR: StatusSeverityHigh,
|
||||
Status_STATUS_NOT_IN_QUORUM: StatusSeverityHigh,
|
||||
Status_STATUS_DECOMMISSION: StatusSeverityHigh,
|
||||
Status_STATUS_MAINTENANCE: StatusSeverityHigh,
|
||||
Status_STATUS_STORAGE_DOWN: StatusSeverityHigh,
|
||||
Status_STATUS_STORAGE_DEGRADED: StatusSeverityHigh,
|
||||
Status_STATUS_NEEDS_REBOOT: StatusSeverityHigh,
|
||||
Status_STATUS_STORAGE_REBALANCE: StatusSeverityMedium,
|
||||
Status_STATUS_STORAGE_DRIVE_REPLACE: StatusSeverityMedium,
|
||||
// Add statuses before MAX
|
||||
Status_STATUS_MAX: StatusSeverityHigh,
|
||||
}
|
||||
|
||||
// StatusSimpleValueOf returns the string format of Status
|
||||
func StatusSimpleValueOf(s string) (Status, error) {
|
||||
obj, err := simpleValueOf("status", Status_value, s)
|
||||
return Status(obj), err
|
||||
}
|
||||
|
||||
// SimpleString returns the string format of Status
|
||||
func (x Status) SimpleString() string {
|
||||
return simpleString("status", Status_name, int32(x))
|
||||
}
|
||||
|
||||
// StatusKind returns the king of status
|
||||
func (x Status) StatusKind() StatusKind {
|
||||
statusType, _ := statusToStatusKind[x]
|
||||
return statusType
|
||||
|
|
|
@ -2,21 +2,8 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
|||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = [
|
||||
"any.pb.go",
|
||||
"api.pb.go",
|
||||
"duration.pb.go",
|
||||
"empty.pb.go",
|
||||
"field_mask.pb.go",
|
||||
"protobuf.gen.go",
|
||||
"source_context.pb.go",
|
||||
"struct.pb.go",
|
||||
"timestamp.pb.go",
|
||||
"type.pb.go",
|
||||
"wrappers.pb.go",
|
||||
],
|
||||
srcs = ["labels.go"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//vendor/github.com/golang/protobuf/proto:go_default_library"],
|
||||
)
|
||||
|
||||
filegroup(
|
|
@ -0,0 +1,74 @@
|
|||
package parser
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
NoLabel = "NoLabel"
|
||||
)
|
||||
|
||||
func LabelsFromString(str string) (map[string]string, error) {
|
||||
if len(str) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
labels := strings.Split(str, ",")
|
||||
m := make(map[string]string, len(labels))
|
||||
for _, v := range labels {
|
||||
if strings.Contains(v, "=") {
|
||||
label := strings.SplitN(v, "=", 2)
|
||||
if len(label) != 2 {
|
||||
return m, fmt.Errorf("Malformed label: %s", v)
|
||||
}
|
||||
if _, ok := m[label[0]]; ok {
|
||||
return m, fmt.Errorf("Duplicate label: %s", v)
|
||||
}
|
||||
m[label[0]] = label[1]
|
||||
} else if len(v) != 0 {
|
||||
m[v] = ""
|
||||
}
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func LabelsToString(labels map[string]string) string {
|
||||
l := ""
|
||||
for k, v := range labels {
|
||||
if len(l) != 0 {
|
||||
l += ","
|
||||
}
|
||||
if len(v) != 0 {
|
||||
l += k + "=" + v
|
||||
} else if len(k) != 0 {
|
||||
l += k
|
||||
}
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
func MergeLabels(old map[string]string, new map[string]string) map[string]string {
|
||||
if old == nil {
|
||||
return new
|
||||
}
|
||||
if new == nil {
|
||||
return old
|
||||
}
|
||||
m := make(map[string]string, len(old)+len(new))
|
||||
for k, v := range old {
|
||||
m[k] = v
|
||||
}
|
||||
for k, v := range new {
|
||||
m[k] = v
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func HasLabels(set map[string]string, subset map[string]string) bool {
|
||||
for k, v1 := range subset {
|
||||
if v2, ok := set[k]; !ok || v1 != v2 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
|
@ -40,16 +40,16 @@ var (
|
|||
"B": 1,
|
||||
"b": 1,
|
||||
|
||||
"KB": KB,
|
||||
"kb": KB,
|
||||
"MB": MB,
|
||||
"mb": MB,
|
||||
"GB": GB,
|
||||
"gb": GB,
|
||||
"TB": TB,
|
||||
"tb": TB,
|
||||
"PB": PB,
|
||||
"pb": PB,
|
||||
"KB": KiB,
|
||||
"kb": KiB,
|
||||
"MB": MiB,
|
||||
"mb": MiB,
|
||||
"GB": GiB,
|
||||
"gb": GiB,
|
||||
"TB": TiB,
|
||||
"tb": TiB,
|
||||
"PB": PiB,
|
||||
"pb": PiB,
|
||||
|
||||
"K": KiB,
|
||||
"k": KiB,
|
||||
|
|
|
@ -7,30 +7,67 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
ErrAlreadyShutdown = errors.New("VolumeDriverProvider already shutdown")
|
||||
ErrExist = errors.New("Driver already exists")
|
||||
ErrDriverNotFound = errors.New("Driver implementation not found")
|
||||
ErrDriverInitializing = errors.New("Driver is initializing")
|
||||
ErrEnoEnt = errors.New("Volume does not exist.")
|
||||
ErrEnomem = errors.New("Out of memory.")
|
||||
ErrEinval = errors.New("Invalid argument")
|
||||
ErrVolDetached = errors.New("Volume is detached")
|
||||
ErrVolAttached = errors.New("Volume is attached")
|
||||
// ErrAlreadyShutdown returned when driver is shutdown
|
||||
ErrAlreadyShutdown = errors.New("VolumeDriverProvider already shutdown")
|
||||
// ErrExit returned when driver already registered
|
||||
ErrExist = errors.New("Already exists")
|
||||
// ErrDriverNotFound returned when a driver is not registered
|
||||
ErrDriverNotFound = errors.New("Driver implementation not found")
|
||||
// ErrDriverInitializing returned when a driver is initializing
|
||||
ErrDriverInitializing = errors.New("Driver is initializing")
|
||||
// ErrEnoEnt returned when volume does not exist
|
||||
ErrEnoEnt = errors.New("Volume does not exist.")
|
||||
// ErrEnomem returned when we are out of memory
|
||||
ErrEnomem = errors.New("Out of memory.")
|
||||
// ErrEinval returned when an invalid input is provided
|
||||
ErrEinval = errors.New("Invalid argument")
|
||||
// ErrVolDetached returned when volume is in detached state
|
||||
ErrVolDetached = errors.New("Volume is detached")
|
||||
// ErrVolAttached returned when volume is in attached state
|
||||
ErrVolAttached = errors.New("Volume is attached")
|
||||
// ErrVolAttachedOnRemoteNode returned when volume is in attached on different node
|
||||
ErrVolAttachedOnRemoteNode = errors.New("Volume is attached on another node")
|
||||
ErrVolAttachedScale = errors.New("Volume is attached but can be scaled")
|
||||
ErrVolHasSnaps = errors.New("Volume has snapshots associated")
|
||||
ErrNotSupported = errors.New("Operation not supported")
|
||||
// ErrVolAttachedScale returned when volume is attached and can be scaled
|
||||
ErrVolAttachedScale = errors.New("Volume is attached on another node." +
|
||||
" Increase scale factor to create more instances")
|
||||
// ErrVolHasSnaps returned when volume has previous snapshots
|
||||
ErrVolHasSnaps = errors.New("Volume has snapshots associated")
|
||||
// ErrNotSupported returned when the operation is not supported
|
||||
ErrNotSupported = errors.New("Operation not supported")
|
||||
// ErrVolBusy returned when volume is in busy state
|
||||
ErrVolBusy = errors.New("Volume is busy")
|
||||
)
|
||||
|
||||
// Constants used by the VolumeDriver
|
||||
const (
|
||||
APIVersion = "v1"
|
||||
// APIVersion for the volume management apis
|
||||
APIVersion = "v1"
|
||||
// PluginAPIBase where the docker unix socket resides
|
||||
PluginAPIBase = "/run/docker/plugins/"
|
||||
// DriverAPIBase where the osd unix socket resides
|
||||
DriverAPIBase = "/var/lib/osd/driver/"
|
||||
MountBase = "/var/lib/osd/mounts/"
|
||||
VolumeBase = "/var/lib/osd/"
|
||||
// MountBase for osd mountpoints
|
||||
MountBase = "/var/lib/osd/mounts/"
|
||||
// VolumeBase for osd volumes
|
||||
VolumeBase = "/var/lib/osd/"
|
||||
)
|
||||
|
||||
const (
|
||||
// LocationConstaint is a label that specifies data location constraint.
|
||||
LocationConstraint = "LocationConstraint"
|
||||
// LocalNode is an alias for this node - similar to localhost.
|
||||
LocalNode = "LocalNode"
|
||||
)
|
||||
|
||||
// AttachOptionsKey specifies a key type from a key-value pair
|
||||
// that will be passed in to the Attach api
|
||||
type AttachOptionsKey string
|
||||
|
||||
const (
|
||||
AttachOptionsSecret = AttachOptionsKey("SECRET_KEY")
|
||||
)
|
||||
|
||||
// Store defines the interface for basic volume store operations
|
||||
type Store interface {
|
||||
// Lock volume specified by volumeID.
|
||||
Lock(volumeID string) (interface{}, error)
|
||||
|
@ -68,16 +105,34 @@ type IODriver interface {
|
|||
Flush(volumeID string) error
|
||||
}
|
||||
|
||||
// SnapshotDriver interfaces provides snapshot capability
|
||||
type SnapshotDriver interface {
|
||||
// Snapshot create volume snapshot.
|
||||
// Errors ErrEnoEnt may be returned
|
||||
Snapshot(volumeID string, readonly bool, locator *api.VolumeLocator) (string, error)
|
||||
// Restore restores volume to specified snapshot.
|
||||
Restore(volumeID string, snapshotID string) error
|
||||
}
|
||||
|
||||
// StatsDriver interface provides stats features
|
||||
type StatsDriver interface {
|
||||
// Stats for specified volume.
|
||||
// cumulative stats are /proc/diskstats style stats.
|
||||
// nonCumulative stats are stats for specific duration.
|
||||
// Errors ErrEnoEnt may be returned
|
||||
Stats(volumeID string, cumulative bool) (*api.Stats, error)
|
||||
// UsedSize returns currently used volume size.
|
||||
// Errors ErrEnoEnt may be returned.
|
||||
UsedSize(volumeID string) (uint64, error)
|
||||
// GetActiveRequests get active requests
|
||||
GetActiveRequests() (*api.ActiveRequests, error)
|
||||
}
|
||||
|
||||
// ProtoDriver must be implemented by all volume drivers. It specifies the
|
||||
// most basic functionality, such as creating and deleting volumes.
|
||||
type ProtoDriver interface {
|
||||
SnapshotDriver
|
||||
StatsDriver
|
||||
// Name returns the name of the driver.
|
||||
Name() string
|
||||
// Type of this driver
|
||||
|
@ -99,16 +154,6 @@ type ProtoDriver interface {
|
|||
// Update not all fields of the spec are supported, ErrNotSupported will be thrown for unsupported
|
||||
// updates.
|
||||
Set(volumeID string, locator *api.VolumeLocator, spec *api.VolumeSpec) error
|
||||
// Stats for specified volume.
|
||||
// cumulative stats are /proc/diskstats style stats.
|
||||
// nonCumulative stats are stats for specific duration.
|
||||
// Errors ErrEnoEnt may be returned
|
||||
Stats(volumeID string, cumulative bool) (*api.Stats, error)
|
||||
// Alerts on this volume.
|
||||
// Errors ErrEnoEnt may be returned
|
||||
Alerts(volumeID string) (*api.Alerts, error)
|
||||
// GetActiveRequests get active requests
|
||||
GetActiveRequests() (*api.ActiveRequests, error)
|
||||
// Status returns a set of key-value pairs which give low
|
||||
// level diagnostic status about this driver.
|
||||
Status() [][2]string
|
||||
|
@ -128,6 +173,7 @@ type Enumerator interface {
|
|||
SnapEnumerate(volID []string, snapLabels map[string]string) ([]*api.Volume, error)
|
||||
}
|
||||
|
||||
// StoreEnumerator combines Store and Enumerator capabilities
|
||||
type StoreEnumerator interface {
|
||||
Store
|
||||
Enumerator
|
||||
|
@ -139,10 +185,10 @@ type BlockDriver interface {
|
|||
// Attach map device to the host.
|
||||
// On success the devicePath specifies location where the device is exported
|
||||
// Errors ErrEnoEnt, ErrVolAttached may be returned.
|
||||
Attach(volumeID string) (string, error)
|
||||
Attach(volumeID string, attachOptions map[string]string) (string, error)
|
||||
// Detach device from the host.
|
||||
// Errors ErrEnoEnt, ErrVolDetached may be returned.
|
||||
Detach(volumeID string) error
|
||||
Detach(volumeID string, unmountBeforeDetach bool) error
|
||||
}
|
||||
|
||||
// VolumeDriverProvider provides VolumeDrivers.
|
||||
|
@ -165,7 +211,7 @@ type VolumeDriverRegistry interface {
|
|||
Add(name string, init func(map[string]string) (VolumeDriver, error)) error
|
||||
}
|
||||
|
||||
// VolumeDriverRegistry constructs a new VolumeDriverRegistry.
|
||||
// NewVolumeDriverRegistry constructs a new VolumeDriverRegistry.
|
||||
func NewVolumeDriverRegistry(nameToInitFunc map[string]func(map[string]string) (VolumeDriver, error)) VolumeDriverRegistry {
|
||||
return newVolumeDriverRegistry(nameToInitFunc)
|
||||
}
|
||||
|
|
|
@ -8,19 +8,24 @@ var (
|
|||
// BlockNotSupported is a default (null) block driver implementation. This can be
|
||||
// used by drivers that do not want to (or care about) implementing the attach,
|
||||
// format and detach interfaces.
|
||||
BlockNotSupported = &blockNotSupported{}
|
||||
BlockNotSupported = &blockNotSupported{}
|
||||
// SnapshotNotSupported is a null snapshot driver implementation. This can be used
|
||||
// by drivers that do not want to implement the snapshot interface
|
||||
SnapshotNotSupported = &snapshotNotSupported{}
|
||||
IONotSupported = &ioNotSupported{}
|
||||
// IONotSupported is a null IODriver interface
|
||||
IONotSupported = &ioNotSupported{}
|
||||
// StatsNotSupported is a null stats driver implementation. This can be used
|
||||
// by drivers that do not want to implement the stats interface.
|
||||
StatsNotSupported = &statsNotSupported{}
|
||||
)
|
||||
|
||||
|
||||
type blockNotSupported struct{}
|
||||
|
||||
func (b *blockNotSupported) Attach(volumeID string) (string, error) {
|
||||
func (b *blockNotSupported) Attach(volumeID string, attachOptions map[string]string) (string, error) {
|
||||
return "", ErrNotSupported
|
||||
}
|
||||
|
||||
func (b *blockNotSupported) Detach(volumeID string) error {
|
||||
func (b *blockNotSupported) Detach(volumeID string, unmountBeforeDetach bool) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
|
@ -30,6 +35,10 @@ func (s *snapshotNotSupported) Snapshot(volumeID string, readonly bool, locator
|
|||
return "", ErrNotSupported
|
||||
}
|
||||
|
||||
func (s *snapshotNotSupported) Restore(volumeID, snapshotID string) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
type ioNotSupported struct{}
|
||||
|
||||
func (i *ioNotSupported) Read(volumeID string, buffer []byte, size uint64, offset int64) (int64, error) {
|
||||
|
@ -43,3 +52,23 @@ func (i *ioNotSupported) Write(volumeID string, buffer []byte, size uint64, offs
|
|||
func (i *ioNotSupported) Flush(volumeID string) error {
|
||||
return ErrNotSupported
|
||||
}
|
||||
|
||||
type statsNotSupported struct{}
|
||||
|
||||
// Stats returns stats
|
||||
func (s *statsNotSupported) Stats(
|
||||
volumeID string,
|
||||
cumulative bool,
|
||||
) (*api.Stats, error) {
|
||||
return nil, ErrNotSupported
|
||||
}
|
||||
|
||||
// UsedSize returns allocated size
|
||||
func (s *statsNotSupported) UsedSize(volumeID string) (uint64, error) {
|
||||
return 0, ErrNotSupported
|
||||
}
|
||||
|
||||
// GetActiveRequests gets active requests
|
||||
func (s *statsNotSupported) GetActiveRequests() (*api.ActiveRequests, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*~
|
||||
*.out
|
||||
*.log
|
|
@ -0,0 +1,11 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- tip
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
||||
script:
|
||||
- go test ./...
|
|
@ -0,0 +1,21 @@
|
|||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["deepcopy.go"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "package-srcs",
|
||||
srcs = glob(["**"]),
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
name = "all-srcs",
|
||||
srcs = [":package-srcs"],
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Peter Edge
|
||||
Copyright (c) 2014 Joel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
deepCopy
|
||||
========
|
||||
[![GoDoc](https://godoc.org/github.com/mohae/deepcopy?status.svg)](https://godoc.org/github.com/mohae/deepcopy)[![Build Status](https://travis-ci.org/mohae/deepcopy.png)](https://travis-ci.org/mohae/deepcopy)
|
||||
|
||||
DeepCopy makes deep copies of things: unexported field values are not copied.
|
||||
|
||||
## Usage
|
||||
cpy := deepcopy.Copy(orig)
|
|
@ -0,0 +1,112 @@
|
|||
// deepcopy makes deep copies of things. A standard copy will copy the
|
||||
// pointers: deep copy copies the values pointed to. Unexported field
|
||||
// values are not copied.
|
||||
//
|
||||
// Copyright (c)2014-2016, Joel Scoble (github.com/mohae), all rights reserved.
|
||||
// License: MIT, for more details check the included LICENSE file.
|
||||
package deepcopy
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Iface is an alias to Copy; this exists for backwards compatibility reasons.
|
||||
func Iface(iface interface{}) interface{} {
|
||||
return Copy(iface)
|
||||
}
|
||||
|
||||
// Copy creates a deep copy of whatever is passed to it and returns the copy
|
||||
// in an interface{}. The returned value will need to be asserted to the
|
||||
// correct type.
|
||||
func Copy(src interface{}) interface{} {
|
||||
if src == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Make the interface a reflect.Value
|
||||
original := reflect.ValueOf(src)
|
||||
|
||||
// Make a copy of the same type as the original.
|
||||
cpy := reflect.New(original.Type()).Elem()
|
||||
|
||||
// Recursively copy the original.
|
||||
copyRecursive(original, cpy)
|
||||
|
||||
// Return the copy as an interface.
|
||||
return cpy.Interface()
|
||||
}
|
||||
|
||||
// copyRecursive does the actual copying of the interface. It currently has
|
||||
// limited support for what it can handle. Add as needed.
|
||||
func copyRecursive(original, cpy reflect.Value) {
|
||||
// handle according to original's Kind
|
||||
switch original.Kind() {
|
||||
case reflect.Ptr:
|
||||
// Get the actual value being pointed to.
|
||||
originalValue := original.Elem()
|
||||
|
||||
// if it isn't valid, return.
|
||||
if !originalValue.IsValid() {
|
||||
return
|
||||
}
|
||||
cpy.Set(reflect.New(originalValue.Type()))
|
||||
copyRecursive(originalValue, cpy.Elem())
|
||||
|
||||
case reflect.Interface:
|
||||
// If this is a nil, don't do anything
|
||||
if original.IsNil() {
|
||||
return
|
||||
}
|
||||
// Get the value for the interface, not the pointer.
|
||||
originalValue := original.Elem()
|
||||
|
||||
// Get the value by calling Elem().
|
||||
copyValue := reflect.New(originalValue.Type()).Elem()
|
||||
copyRecursive(originalValue, copyValue)
|
||||
cpy.Set(copyValue)
|
||||
|
||||
case reflect.Struct:
|
||||
t, ok := original.Interface().(time.Time)
|
||||
if ok {
|
||||
cpy.Set(reflect.ValueOf(t))
|
||||
return
|
||||
}
|
||||
// Go through each field of the struct and copy it.
|
||||
for i := 0; i < original.NumField(); i++ {
|
||||
// The Type's StructField for a given field is checked to see if StructField.PkgPath
|
||||
// is set to determine if the field is exported or not because CanSet() returns false
|
||||
// for settable fields. I'm not sure why. -mohae
|
||||
if original.Type().Field(i).PkgPath != "" {
|
||||
continue
|
||||
}
|
||||
copyRecursive(original.Field(i), cpy.Field(i))
|
||||
}
|
||||
|
||||
case reflect.Slice:
|
||||
if original.IsNil() {
|
||||
return
|
||||
}
|
||||
// Make a new slice and copy each element.
|
||||
cpy.Set(reflect.MakeSlice(original.Type(), original.Len(), original.Cap()))
|
||||
for i := 0; i < original.Len(); i++ {
|
||||
copyRecursive(original.Index(i), cpy.Index(i))
|
||||
}
|
||||
|
||||
case reflect.Map:
|
||||
if original.IsNil() {
|
||||
return
|
||||
}
|
||||
cpy.Set(reflect.MakeMap(original.Type()))
|
||||
for _, key := range original.MapKeys() {
|
||||
originalValue := original.MapIndex(key)
|
||||
copyValue := reflect.New(originalValue.Type()).Elem()
|
||||
copyRecursive(originalValue, copyValue)
|
||||
copyKey := Copy(key.Interface())
|
||||
cpy.SetMapIndex(reflect.ValueOf(copyKey), copyValue)
|
||||
}
|
||||
|
||||
default:
|
||||
cpy.Set(original)
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/any.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// `Any` contains an arbitrary serialized message along with a URL
|
||||
// that describes the type of the serialized message.
|
||||
//
|
||||
//
|
||||
// JSON
|
||||
// ====
|
||||
// The JSON representation of an `Any` value uses the regular
|
||||
// representation of the deserialized, embedded message, with an
|
||||
// additional field `@type` which contains the type URL. Example:
|
||||
//
|
||||
// package google.profile;
|
||||
// message Person {
|
||||
// string first_name = 1;
|
||||
// string last_name = 2;
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// "@type": "type.googleapis.com/google.profile.Person",
|
||||
// "firstName": <string>,
|
||||
// "lastName": <string>
|
||||
// }
|
||||
//
|
||||
// If the embedded message type is well-known and has a custom JSON
|
||||
// representation, that representation will be embedded adding a field
|
||||
// `value` which holds the custom JSON in addition to the `@type`
|
||||
// field. Example (for message [google.protobuf.Duration][]):
|
||||
//
|
||||
// {
|
||||
// "@type": "type.googleapis.com/google.protobuf.Duration",
|
||||
// "value": "1.212s"
|
||||
// }
|
||||
//
|
||||
type Any struct {
|
||||
// A URL/resource name whose content describes the type of the
|
||||
// serialized message.
|
||||
//
|
||||
// For URLs which use the schema `http`, `https`, or no schema, the
|
||||
// following restrictions and interpretations apply:
|
||||
//
|
||||
// * If no schema is provided, `https` is assumed.
|
||||
// * The last segment of the URL's path must represent the fully
|
||||
// qualified name of the type (as in `path/google.protobuf.Duration`).
|
||||
// * An HTTP GET on the URL must yield a [google.protobuf.Type][]
|
||||
// value in binary format, or produce an error.
|
||||
// * Applications are allowed to cache lookup results based on the
|
||||
// URL, or have them precompiled into a binary to avoid any
|
||||
// lookup. Therefore, binary compatibility needs to be preserved
|
||||
// on changes to types. (Use versioned type names to manage
|
||||
// breaking changes.)
|
||||
//
|
||||
// Schemas other than `http`, `https` (or the empty schema) might be
|
||||
// used with implementation specific semantics.
|
||||
//
|
||||
TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl" json:"type_url,omitempty"`
|
||||
// Must be valid serialized data of the above specified type.
|
||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Any) Reset() { *m = Any{} }
|
||||
func (m *Any) String() string { return proto.CompactTextString(m) }
|
||||
func (*Any) ProtoMessage() {}
|
||||
func (*Any) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (*Any) XXX_WellKnownType() string { return "Any" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Any)(nil), "google.protobuf.Any")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 160 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4,
|
||||
0x03, 0x73, 0x84, 0xf8, 0x21, 0x52, 0x7a, 0x30, 0x29, 0x25, 0x33, 0x2e, 0x66, 0xc7, 0xbc, 0x4a,
|
||||
0x21, 0x49, 0x2e, 0x8e, 0x92, 0xca, 0x82, 0xd4, 0xf8, 0xd2, 0xa2, 0x1c, 0x09, 0x46, 0x05, 0x46,
|
||||
0x0d, 0xce, 0x20, 0x76, 0x10, 0x3f, 0xb4, 0x28, 0x47, 0x48, 0x84, 0x8b, 0xb5, 0x2c, 0x31, 0xa7,
|
||||
0x34, 0x55, 0x82, 0x09, 0x28, 0xce, 0x13, 0x04, 0xe1, 0x38, 0x79, 0x73, 0x09, 0x27, 0xe7, 0xe7,
|
||||
0xea, 0xa1, 0x19, 0xe7, 0xc4, 0x01, 0x34, 0x2c, 0x00, 0xc4, 0x09, 0x60, 0x5c, 0xc0, 0xc8, 0xb8,
|
||||
0x88, 0x89, 0xd9, 0x3d, 0xc0, 0x69, 0x15, 0x93, 0x9c, 0x3b, 0x44, 0x59, 0x00, 0x54, 0x99, 0x5e,
|
||||
0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0xd0, 0x92, 0xe2, 0x24, 0x36, 0xb0,
|
||||
0x7e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0x49, 0xa8, 0x53, 0xb9, 0x00, 0x00, 0x00,
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/api.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Api is a light-weight descriptor for a protocol buffer service.
|
||||
type Api struct {
|
||||
// The fully qualified name of this api, including package name
|
||||
// followed by the api's simple name.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The methods of this api, in unspecified order.
|
||||
Methods []*Method `protobuf:"bytes,2,rep,name=methods" json:"methods,omitempty"`
|
||||
// Any metadata attached to the API.
|
||||
Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"`
|
||||
// A version string for this api. If specified, must have the form
|
||||
// `major-version.minor-version`, as in `1.10`. If the minor version
|
||||
// is omitted, it defaults to zero. If the entire version field is
|
||||
// empty, the major version is derived from the package name, as
|
||||
// outlined below. If the field is not empty, the version in the
|
||||
// package name will be verified to be consistent with what is
|
||||
// provided here.
|
||||
//
|
||||
// The versioning schema uses [semantic
|
||||
// versioning](http://semver.org) where the major version number
|
||||
// indicates a breaking change and the minor version an additive,
|
||||
// non-breaking change. Both version numbers are signals to users
|
||||
// what to expect from different versions, and should be carefully
|
||||
// chosen based on the product plan.
|
||||
//
|
||||
// The major version is also reflected in the package name of the
|
||||
// API, which must end in `v<major-version>`, as in
|
||||
// `google.feature.v1`. For major versions 0 and 1, the suffix can
|
||||
// be omitted. Zero major versions must only be used for
|
||||
// experimental, none-GA apis.
|
||||
//
|
||||
//
|
||||
Version string `protobuf:"bytes,4,opt,name=version" json:"version,omitempty"`
|
||||
// Source context for the protocol buffer service represented by this
|
||||
// message.
|
||||
SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"`
|
||||
// Included APIs. See [Mixin][].
|
||||
Mixins []*Mixin `protobuf:"bytes,6,rep,name=mixins" json:"mixins,omitempty"`
|
||||
// The source syntax of the service.
|
||||
Syntax Syntax `protobuf:"varint,7,opt,name=syntax,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Api) Reset() { *m = Api{} }
|
||||
func (m *Api) String() string { return proto.CompactTextString(m) }
|
||||
func (*Api) ProtoMessage() {}
|
||||
func (*Api) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
func (m *Api) GetMethods() []*Method {
|
||||
if m != nil {
|
||||
return m.Methods
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Api) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Api) GetSourceContext() *SourceContext {
|
||||
if m != nil {
|
||||
return m.SourceContext
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Api) GetMixins() []*Mixin {
|
||||
if m != nil {
|
||||
return m.Mixins
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Method represents a method of an api.
|
||||
type Method struct {
|
||||
// The simple name of this method.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// A URL of the input message type.
|
||||
RequestTypeUrl string `protobuf:"bytes,2,opt,name=request_type_url,json=requestTypeUrl" json:"request_type_url,omitempty"`
|
||||
// If true, the request is streamed.
|
||||
RequestStreaming bool `protobuf:"varint,3,opt,name=request_streaming,json=requestStreaming" json:"request_streaming,omitempty"`
|
||||
// The URL of the output message type.
|
||||
ResponseTypeUrl string `protobuf:"bytes,4,opt,name=response_type_url,json=responseTypeUrl" json:"response_type_url,omitempty"`
|
||||
// If true, the response is streamed.
|
||||
ResponseStreaming bool `protobuf:"varint,5,opt,name=response_streaming,json=responseStreaming" json:"response_streaming,omitempty"`
|
||||
// Any metadata attached to the method.
|
||||
Options []*Option `protobuf:"bytes,6,rep,name=options" json:"options,omitempty"`
|
||||
// The source syntax of this method.
|
||||
Syntax Syntax `protobuf:"varint,7,opt,name=syntax,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Method) Reset() { *m = Method{} }
|
||||
func (m *Method) String() string { return proto.CompactTextString(m) }
|
||||
func (*Method) ProtoMessage() {}
|
||||
func (*Method) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
func (m *Method) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Declares an API to be included in this API. The including API must
|
||||
// redeclare all the methods from the included API, but documentation
|
||||
// and options are inherited as follows:
|
||||
//
|
||||
// - If after comment and whitespace stripping, the documentation
|
||||
// string of the redeclared method is empty, it will be inherited
|
||||
// from the original method.
|
||||
//
|
||||
// - Each annotation belonging to the service config (http,
|
||||
// visibility) which is not set in the redeclared method will be
|
||||
// inherited.
|
||||
//
|
||||
// - If an http annotation is inherited, the path pattern will be
|
||||
// modified as follows. Any version prefix will be replaced by the
|
||||
// version of the including API plus the [root][] path if specified.
|
||||
//
|
||||
// Example of a simple mixin:
|
||||
//
|
||||
// package google.acl.v1;
|
||||
// service AccessControl {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v1/{resource=**}:getAcl";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// package google.storage.v2;
|
||||
// service Storage {
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl);
|
||||
//
|
||||
// // Get a data record.
|
||||
// rpc GetData(GetDataRequest) returns (Data) {
|
||||
// option (google.api.http).get = "/v2/{resource=**}";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Example of a mixin configuration:
|
||||
//
|
||||
// apis:
|
||||
// - name: google.storage.v2.Storage
|
||||
// mixins:
|
||||
// - name: google.acl.v1.AccessControl
|
||||
//
|
||||
// The mixin construct implies that all methods in `AccessControl` are
|
||||
// also declared with same name and request/response types in
|
||||
// `Storage`. A documentation generator or annotation processor will
|
||||
// see the effective `Storage.GetAcl` method after inherting
|
||||
// documentation and annotations as follows:
|
||||
//
|
||||
// service Storage {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v2/{resource=**}:getAcl";
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// Note how the version in the path pattern changed from `v1` to `v2`.
|
||||
//
|
||||
// If the `root` field in the mixin is specified, it should be a
|
||||
// relative path under which inherited HTTP paths are placed. Example:
|
||||
//
|
||||
// apis:
|
||||
// - name: google.storage.v2.Storage
|
||||
// mixins:
|
||||
// - name: google.acl.v1.AccessControl
|
||||
// root: acls
|
||||
//
|
||||
// This implies the following inherited HTTP annotation:
|
||||
//
|
||||
// service Storage {
|
||||
// // Get the underlying ACL object.
|
||||
// rpc GetAcl(GetAclRequest) returns (Acl) {
|
||||
// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
|
||||
// }
|
||||
// ...
|
||||
// }
|
||||
type Mixin struct {
|
||||
// The fully qualified name of the API which is included.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// If non-empty specifies a path under which inherited HTTP paths
|
||||
// are rooted.
|
||||
Root string `protobuf:"bytes,2,opt,name=root" json:"root,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Mixin) Reset() { *m = Mixin{} }
|
||||
func (m *Mixin) String() string { return proto.CompactTextString(m) }
|
||||
func (*Mixin) ProtoMessage() {}
|
||||
func (*Mixin) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Api)(nil), "google.protobuf.Api")
|
||||
proto.RegisterType((*Method)(nil), "google.protobuf.Method")
|
||||
proto.RegisterType((*Mixin)(nil), "google.protobuf.Mixin")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/api.proto", fileDescriptor1) }
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 408 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x92, 0xd1, 0x4e, 0xc2, 0x30,
|
||||
0x14, 0x86, 0xb3, 0x0d, 0x06, 0x96, 0x08, 0x5a, 0x13, 0x9d, 0x5c, 0x10, 0x42, 0xbc, 0x58, 0x34,
|
||||
0x6e, 0x11, 0x9f, 0x40, 0x8c, 0xe1, 0x82, 0x18, 0x97, 0xa1, 0xf1, 0x92, 0x0c, 0xac, 0xb8, 0x64,
|
||||
0x5b, 0x67, 0xdb, 0x29, 0xbc, 0x8d, 0xf1, 0xd2, 0x4b, 0xdf, 0xc0, 0x37, 0xb3, 0xeb, 0x56, 0xc0,
|
||||
0x81, 0x89, 0xde, 0xf5, 0x9c, 0xff, 0xeb, 0xdf, 0x73, 0xfe, 0x0d, 0x1c, 0x4e, 0x31, 0x9e, 0x06,
|
||||
0xc8, 0x8e, 0x09, 0x66, 0x78, 0x9c, 0x3c, 0xda, 0x5e, 0xec, 0x5b, 0xa2, 0x80, 0x8d, 0x4c, 0xb2,
|
||||
0xa4, 0xd4, 0x3c, 0x2a, 0xb2, 0x14, 0x27, 0x64, 0x82, 0x46, 0x13, 0x1c, 0x31, 0x34, 0x63, 0x19,
|
||||
0xd8, 0x6c, 0x16, 0x29, 0x36, 0x8f, 0x73, 0x93, 0xce, 0x97, 0x0a, 0xb4, 0x8b, 0xd8, 0x87, 0x10,
|
||||
0x94, 0x22, 0x2f, 0x44, 0x86, 0xd2, 0x56, 0xcc, 0x2d, 0x57, 0x9c, 0xe1, 0x19, 0xa8, 0x84, 0x88,
|
||||
0x3d, 0xe1, 0x07, 0x6a, 0xa8, 0x6d, 0xcd, 0xac, 0x75, 0x0f, 0xac, 0xc2, 0x00, 0xd6, 0xb5, 0xd0,
|
||||
0x5d, 0xc9, 0xa5, 0x57, 0x70, 0xcc, 0x7c, 0x1c, 0x51, 0x43, 0xfb, 0xe5, 0xca, 0x8d, 0xd0, 0x5d,
|
||||
0xc9, 0x41, 0x03, 0x54, 0x5e, 0x10, 0xa1, 0xfc, 0x6c, 0x94, 0xc4, 0xe3, 0xb2, 0x84, 0x57, 0xa0,
|
||||
0xfe, 0x73, 0x1f, 0xa3, 0xcc, 0x81, 0x5a, 0xb7, 0xb5, 0xe6, 0x39, 0x14, 0xd8, 0x65, 0x46, 0xb9,
|
||||
0xdb, 0x74, 0xb5, 0x84, 0x16, 0xd0, 0x43, 0x7f, 0xe6, 0xf3, 0x91, 0x74, 0x31, 0xd2, 0xfe, 0xfa,
|
||||
0x16, 0xa9, 0xec, 0xe6, 0x14, 0xb4, 0x81, 0x4e, 0xe7, 0x11, 0xf3, 0x66, 0x46, 0x85, 0x3f, 0x57,
|
||||
0xdf, 0xb0, 0xc2, 0x50, 0xc8, 0x6e, 0x8e, 0x75, 0x3e, 0x55, 0xa0, 0x67, 0x41, 0x6c, 0x8c, 0xd1,
|
||||
0x04, 0x3b, 0x04, 0x3d, 0x27, 0x88, 0xb2, 0x51, 0x1a, 0xfc, 0x28, 0x21, 0x01, 0xcf, 0x33, 0xd5,
|
||||
0xeb, 0x79, 0xff, 0x96, 0xb7, 0xef, 0x48, 0x00, 0x4f, 0xc0, 0xae, 0x24, 0x29, 0x23, 0xc8, 0x0b,
|
||||
0xfd, 0x68, 0xca, 0x73, 0x54, 0xcc, 0xaa, 0x2b, 0x2d, 0x86, 0xb2, 0x0f, 0x8f, 0x53, 0x98, 0xc6,
|
||||
0x3c, 0x42, 0xb4, 0xf4, 0xcd, 0x12, 0x6c, 0x48, 0x41, 0x1a, 0x9f, 0x02, 0xb8, 0x60, 0x97, 0xce,
|
||||
0x65, 0xe1, 0xbc, 0x70, 0x59, 0x5a, 0xaf, 0x7c, 0x45, 0xfd, 0x8f, 0x5f, 0xf1, 0xdf, 0xa1, 0xd9,
|
||||
0xa0, 0x2c, 0x62, 0xdf, 0x18, 0x19, 0xef, 0x11, 0x8c, 0x59, 0x1e, 0x93, 0x38, 0xf7, 0x06, 0x60,
|
||||
0x6f, 0x82, 0xc3, 0xa2, 0x6d, 0xaf, 0xca, 0xff, 0x5e, 0x27, 0x2d, 0x1c, 0xe5, 0x4d, 0x51, 0xde,
|
||||
0x55, 0xad, 0xef, 0xf4, 0x3e, 0xd4, 0x56, 0x3f, 0xc3, 0x1c, 0xf9, 0xfa, 0x3d, 0x0a, 0x82, 0x41,
|
||||
0x84, 0x5f, 0xa3, 0x34, 0x12, 0x3a, 0xd6, 0xc5, 0xfd, 0xf3, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||
0xa4, 0x45, 0xd6, 0xc6, 0x6d, 0x03, 0x00, 0x00,
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/duration.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// A Duration represents a signed, fixed-length span of time represented
|
||||
// as a count of seconds and fractions of seconds at nanosecond
|
||||
// resolution. It is independent of any calendar and concepts like "day"
|
||||
// or "month". It is related to Timestamp in that the difference between
|
||||
// two Timestamp values is a Duration and it can be added or subtracted
|
||||
// from a Timestamp. Range is approximately +-10,000 years.
|
||||
//
|
||||
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
||||
//
|
||||
// Timestamp start = ...;
|
||||
// Timestamp end = ...;
|
||||
// Duration duration = ...;
|
||||
//
|
||||
// duration.seconds = end.seconds - start.seconds;
|
||||
// duration.nanos = end.nanos - start.nanos;
|
||||
//
|
||||
// if (duration.seconds < 0 && duration.nanos > 0) {
|
||||
// duration.seconds += 1;
|
||||
// duration.nanos -= 1000000000;
|
||||
// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
||||
// duration.seconds -= 1;
|
||||
// duration.nanos += 1000000000;
|
||||
// }
|
||||
//
|
||||
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
||||
//
|
||||
// Timestamp start = ...;
|
||||
// Duration duration = ...;
|
||||
// Timestamp end = ...;
|
||||
//
|
||||
// end.seconds = start.seconds + duration.seconds;
|
||||
// end.nanos = start.nanos + duration.nanos;
|
||||
//
|
||||
// if (end.nanos < 0) {
|
||||
// end.seconds -= 1;
|
||||
// end.nanos += 1000000000;
|
||||
// } else if (end.nanos >= 1000000000) {
|
||||
// end.seconds += 1;
|
||||
// end.nanos -= 1000000000;
|
||||
// }
|
||||
//
|
||||
type Duration struct {
|
||||
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||
// to +315,576,000,000 inclusive.
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"`
|
||||
// Signed fractions of a second at nanosecond resolution of the span
|
||||
// of time. Durations less than one second are represented with a 0
|
||||
// `seconds` field and a positive or negative `nanos` field. For durations
|
||||
// of one second or more, a non-zero value for the `nanos` field must be
|
||||
// of the same sign as the `seconds` field. Must be from -999,999,999
|
||||
// to +999,999,999 inclusive.
|
||||
Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Duration) Reset() { *m = Duration{} }
|
||||
func (m *Duration) String() string { return proto.CompactTextString(m) }
|
||||
func (*Duration) ProtoMessage() {}
|
||||
func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
func (*Duration) XXX_WellKnownType() string { return "Duration" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Duration)(nil), "google.protobuf.Duration")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor2) }
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 161 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a,
|
||||
0x2c, 0xc9, 0xcc, 0xcf, 0xd3, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0x56,
|
||||
0x5c, 0x1c, 0x2e, 0x50, 0x25, 0x42, 0x12, 0x5c, 0xec, 0xc5, 0xa9, 0xc9, 0xf9, 0x79, 0x29, 0xc5,
|
||||
0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0x30, 0xae, 0x90, 0x08, 0x17, 0x6b, 0x5e, 0x62, 0x5e,
|
||||
0x7e, 0xb1, 0x04, 0x13, 0x50, 0x9c, 0x35, 0x08, 0xc2, 0x71, 0x0a, 0xe0, 0x12, 0x4e, 0xce, 0xcf,
|
||||
0xd5, 0x43, 0x33, 0xd2, 0x89, 0x17, 0x66, 0x60, 0x00, 0x48, 0x24, 0x80, 0x71, 0x01, 0x23, 0xe3,
|
||||
0x22, 0x26, 0x66, 0xf7, 0x00, 0xa7, 0x55, 0x4c, 0x72, 0xee, 0x10, 0xb5, 0x01, 0x50, 0xb5, 0x7a,
|
||||
0xe1, 0xa9, 0x39, 0x39, 0xde, 0x79, 0xf9, 0xe5, 0x79, 0x21, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c,
|
||||
0x60, 0x43, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5b, 0xa9, 0x05, 0xfd, 0xc7, 0x00, 0x00,
|
||||
0x00,
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/empty.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// A generic empty message that you can re-use to avoid defining duplicated
|
||||
// empty messages in your APIs. A typical example is to use it as the request
|
||||
// or the response type of an API method. For instance:
|
||||
//
|
||||
// service Foo {
|
||||
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
||||
// }
|
||||
//
|
||||
// The JSON representation for `Empty` is empty JSON object `{}`.
|
||||
type Empty struct {
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
|
||||
func (*Empty) XXX_WellKnownType() string { return "Empty" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Empty)(nil), "google.protobuf.Empty")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/empty.proto", fileDescriptor3) }
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 124 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcd, 0x2d, 0x28,
|
||||
0xa9, 0xd4, 0x03, 0x73, 0x85, 0xf8, 0x21, 0x92, 0x7a, 0x30, 0x49, 0x25, 0x76, 0x2e, 0x56, 0x57,
|
||||
0x90, 0xbc, 0x53, 0x00, 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x9a, 0xbc, 0x13, 0x17, 0x58, 0x36,
|
||||
0x00, 0xc4, 0x0d, 0x60, 0x5c, 0xc0, 0xc8, 0xf8, 0x83, 0x91, 0x71, 0x11, 0x13, 0xb3, 0x7b, 0x80,
|
||||
0xd3, 0x2a, 0x26, 0x39, 0x77, 0x88, 0xda, 0x00, 0xa8, 0x5a, 0xbd, 0xf0, 0xd4, 0x9c, 0x1c, 0xef,
|
||||
0xbc, 0xfc, 0xf2, 0xbc, 0x90, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x21, 0xc6, 0x80, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xac, 0xca, 0x5b, 0xd0, 0x91, 0x00, 0x00, 0x00,
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/field_mask.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// `FieldMask` represents a set of symbolic field paths, for example:
|
||||
//
|
||||
// paths: "f.a"
|
||||
// paths: "f.b.d"
|
||||
//
|
||||
// Here `f` represents a field in some root message, `a` and `b`
|
||||
// fields in the message found in `f`, and `d` a field found in the
|
||||
// message in `f.b`.
|
||||
//
|
||||
// Field masks are used to specify a subset of fields that should be
|
||||
// returned by a get operation or modified by an update operation.
|
||||
// Field masks also have a custom JSON encoding (see below).
|
||||
//
|
||||
// # Field Masks in Projections
|
||||
//
|
||||
// When used in the context of a projection, a response message or
|
||||
// sub-message is filtered by the API to only contain those fields as
|
||||
// specified in the mask. For example, if the mask in the previous
|
||||
// example is applied to a response message as follows:
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// x : 2
|
||||
// }
|
||||
// y : 13
|
||||
// }
|
||||
// z: 8
|
||||
//
|
||||
// The result will not contain specific values for fields x,y and z
|
||||
// (their value will be set to the default, and omitted in proto text
|
||||
// output):
|
||||
//
|
||||
//
|
||||
// f {
|
||||
// a : 22
|
||||
// b {
|
||||
// d : 1
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// A repeated field is not allowed except at the last position of a
|
||||
// field mask.
|
||||
//
|
||||
// If a FieldMask object is not present in a get operation, the
|
||||
// operation applies to all fields (as if a FieldMask of all fields
|
||||
// had been specified).
|
||||
//
|
||||
// Note that a field mask does not necessarily applies to the
|
||||
// top-level response message. In case of a REST get operation, the
|
||||
// field mask applies directly to the response, but in case of a REST
|
||||
// list operation, the mask instead applies to each individual message
|
||||
// in the returned resource list. In case of a REST custom method,
|
||||
// other definitions may be used. Where the mask applies will be
|
||||
// clearly documented together with its declaration in the API. In
|
||||
// any case, the effect on the returned resource/resources is required
|
||||
// behavior for APIs.
|
||||
//
|
||||
// # Field Masks in Update Operations
|
||||
//
|
||||
// A field mask in update operations specifies which fields of the
|
||||
// targeted resource are going to be updated. The API is required
|
||||
// to only change the values of the fields as specified in the mask
|
||||
// and leave the others untouched. If a resource is passed in to
|
||||
// describe the updated values, the API ignores the values of all
|
||||
// fields not covered by the mask.
|
||||
//
|
||||
// In order to reset a field's value to the default, the field must
|
||||
// be in the mask and set to the default value in the provided resource.
|
||||
// Hence, in order to reset all fields of a resource, provide a default
|
||||
// instance of the resource and set all fields in the mask, or do
|
||||
// not provide a mask as described below.
|
||||
//
|
||||
// If a field mask is not present on update, the operation applies to
|
||||
// all fields (as if a field mask of all fields has been specified).
|
||||
// Note that in the presence of schema evolution, this may mean that
|
||||
// fields the client does not know and has therefore not filled into
|
||||
// the request will be reset to their default. If this is unwanted
|
||||
// behavior, a specific service may require a client to always specify
|
||||
// a field mask, producing an error if not.
|
||||
//
|
||||
// As with get operations, the location of the resource which
|
||||
// describes the updated values in the request message depends on the
|
||||
// operation kind. In any case, the effect of the field mask is
|
||||
// required to be honored by the API.
|
||||
//
|
||||
// ## Considerations for HTTP REST
|
||||
//
|
||||
// The HTTP kind of an update operation which uses a field mask must
|
||||
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
||||
// (PUT must only be used for full updates).
|
||||
//
|
||||
// # JSON Encoding of Field Masks
|
||||
//
|
||||
// In JSON, a field mask is encoded as a single string where paths are
|
||||
// separated by a comma. Fields name in each path are converted
|
||||
// to/from lower-camel naming conventions.
|
||||
//
|
||||
// As an example, consider the following message declarations:
|
||||
//
|
||||
// message Profile {
|
||||
// User user = 1;
|
||||
// Photo photo = 2;
|
||||
// }
|
||||
// message User {
|
||||
// string display_name = 1;
|
||||
// string address = 2;
|
||||
// }
|
||||
//
|
||||
// In proto a field mask for `Profile` may look as such:
|
||||
//
|
||||
// mask {
|
||||
// paths: "user.display_name"
|
||||
// paths: "photo"
|
||||
// }
|
||||
//
|
||||
// In JSON, the same mask is represented as below:
|
||||
//
|
||||
// {
|
||||
// mask: "user.displayName,photo"
|
||||
// }
|
||||
//
|
||||
type FieldMask struct {
|
||||
// The set of field mask paths.
|
||||
Paths []string `protobuf:"bytes,1,rep,name=paths" json:"paths,omitempty"`
|
||||
}
|
||||
|
||||
func (m *FieldMask) Reset() { *m = FieldMask{} }
|
||||
func (m *FieldMask) String() string { return proto.CompactTextString(m) }
|
||||
func (*FieldMask) ProtoMessage() {}
|
||||
func (*FieldMask) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/field_mask.proto", fileDescriptor4) }
|
||||
|
||||
var fileDescriptor4 = []byte{
|
||||
// 147 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcb, 0x4c, 0xcd,
|
||||
0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x03, 0x8b, 0x09, 0xf1, 0x43, 0x54, 0xe8, 0xc1, 0x54,
|
||||
0x28, 0x29, 0x72, 0x71, 0xba, 0x81, 0x14, 0xf9, 0x02, 0xd5, 0x08, 0x89, 0x70, 0xb1, 0x16, 0x24,
|
||||
0x96, 0x64, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x4e, 0x81, 0x5c, 0xc2,
|
||||
0xc9, 0xf9, 0xb9, 0x7a, 0x68, 0x3a, 0x9d, 0xf8, 0xe0, 0xfa, 0x02, 0x40, 0x42, 0x01, 0x8c, 0x0b,
|
||||
0x18, 0x19, 0x17, 0x31, 0x31, 0xbb, 0x07, 0x38, 0xad, 0x62, 0x92, 0x73, 0x87, 0x28, 0x0e, 0x80,
|
||||
0x2a, 0xd6, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce, 0xcb, 0x2f, 0xcf, 0x0b, 0xa9, 0x2c, 0x48, 0x2d,
|
||||
0x4e, 0x62, 0x03, 0x9b, 0x62, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x21, 0xb1, 0xe8, 0x01, 0xb1,
|
||||
0x00, 0x00, 0x00,
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package google_protobuf
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
// EmptyInstance is an instance of Empty.
|
||||
EmptyInstance = &Empty{}
|
||||
)
|
||||
|
||||
// Now returns the current time as a protobuf Timestamp.
|
||||
func Now() *Timestamp {
|
||||
return TimeToProto(time.Now().UTC())
|
||||
}
|
||||
|
||||
// TimeToProto converts a go Time to a protobuf Timestamp.
|
||||
func TimeToProto(t time.Time) *Timestamp {
|
||||
return &Timestamp{
|
||||
Seconds: t.UnixNano() / int64(time.Second),
|
||||
Nanos: int32(t.UnixNano() % int64(time.Second)),
|
||||
}
|
||||
}
|
||||
|
||||
// GoTime converts a protobuf Timestamp to a go Time.
|
||||
func (t *Timestamp) GoTime() time.Time {
|
||||
if t == nil {
|
||||
return time.Unix(0, 0).UTC()
|
||||
}
|
||||
return time.Unix(
|
||||
t.Seconds,
|
||||
int64(t.Nanos),
|
||||
).UTC()
|
||||
}
|
||||
|
||||
// Before returns true if t is before j.
|
||||
func (t *Timestamp) Before(j *Timestamp) bool {
|
||||
if j == nil {
|
||||
return false
|
||||
}
|
||||
if t == nil {
|
||||
return true
|
||||
}
|
||||
if t.Seconds < j.Seconds {
|
||||
return true
|
||||
}
|
||||
if t.Seconds > j.Seconds {
|
||||
return false
|
||||
}
|
||||
return t.Nanos < j.Nanos
|
||||
}
|
||||
|
||||
// DurationToProto converts a go Duration to a protobuf Duration.
|
||||
func DurationToProto(d time.Duration) *Duration {
|
||||
return &Duration{
|
||||
Seconds: int64(d) / int64(time.Second),
|
||||
Nanos: int32(int64(d) % int64(time.Second)),
|
||||
}
|
||||
}
|
||||
|
||||
// GoDuration converts a protobuf Duration to a go Duration.
|
||||
func (d *Duration) GoDuration() time.Duration {
|
||||
if d == nil {
|
||||
return 0
|
||||
}
|
||||
return time.Duration((d.Seconds * int64(time.Second)) + int64(d.Nanos))
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/source_context.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// `SourceContext` represents information about the source of a
|
||||
// protobuf element, like the file in which it is defined.
|
||||
type SourceContext struct {
|
||||
// The path-qualified name of the .proto file that contained the associated
|
||||
// protobuf element. For example: `"google/protobuf/source.proto"`.
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName" json:"file_name,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SourceContext) Reset() { *m = SourceContext{} }
|
||||
func (m *SourceContext) String() string { return proto.CompactTextString(m) }
|
||||
func (*SourceContext) ProtoMessage() {}
|
||||
func (*SourceContext) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*SourceContext)(nil), "google.protobuf.SourceContext")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/source_context.proto", fileDescriptor5) }
|
||||
|
||||
var fileDescriptor5 = []byte{
|
||||
// 159 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x49, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xce, 0x2f, 0x2d,
|
||||
0x4a, 0x4e, 0x8d, 0x4f, 0xce, 0xcf, 0x2b, 0x49, 0xad, 0x28, 0xd1, 0x03, 0x8b, 0x0b, 0xf1, 0x43,
|
||||
0x54, 0xe9, 0xc1, 0x54, 0x29, 0xe9, 0x70, 0xf1, 0x06, 0x83, 0x15, 0x3a, 0x43, 0xd4, 0x09, 0x49,
|
||||
0x73, 0x71, 0xa6, 0x65, 0xe6, 0xa4, 0xc6, 0xe7, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, 0x6a,
|
||||
0x70, 0x06, 0x71, 0x80, 0x04, 0xfc, 0x80, 0x7c, 0xa7, 0x50, 0x2e, 0xe1, 0xe4, 0xfc, 0x5c, 0x3d,
|
||||
0x34, 0x43, 0x9c, 0x84, 0x50, 0x8c, 0x08, 0x00, 0x09, 0x07, 0x30, 0x2e, 0x60, 0x64, 0x5c, 0xc4,
|
||||
0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0xa2, 0x21, 0x00, 0xaa, 0x41, 0x2f, 0x3c,
|
||||
0x35, 0x27, 0xc7, 0x3b, 0x2f, 0xbf, 0x3c, 0x2f, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c,
|
||||
0x92, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x80, 0x1f, 0xc2, 0xc4, 0x00, 0x00, 0x00,
|
||||
}
|
|
@ -1,361 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/struct.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// `NullValue` is a singleton enumeration to represent the null value for the
|
||||
// `Value` type union.
|
||||
//
|
||||
// The JSON representation for `NullValue` is JSON `null`.
|
||||
type NullValue int32
|
||||
|
||||
const (
|
||||
// Null value.
|
||||
NullValue_NULL_VALUE NullValue = 0
|
||||
)
|
||||
|
||||
var NullValue_name = map[int32]string{
|
||||
0: "NULL_VALUE",
|
||||
}
|
||||
var NullValue_value = map[string]int32{
|
||||
"NULL_VALUE": 0,
|
||||
}
|
||||
|
||||
func (x NullValue) String() string {
|
||||
return proto.EnumName(NullValue_name, int32(x))
|
||||
}
|
||||
func (NullValue) EnumDescriptor() ([]byte, []int) { return fileDescriptor6, []int{0} }
|
||||
func (NullValue) XXX_WellKnownType() string { return "NullValue" }
|
||||
|
||||
// `Struct` represents a structured data value, consisting of fields
|
||||
// which map to dynamically typed values. In some languages, `Struct`
|
||||
// might be supported by a native representation. For example, in
|
||||
// scripting languages like JS a struct is represented as an
|
||||
// object. The details of that representation are described together
|
||||
// with the proto support for the language.
|
||||
//
|
||||
// The JSON representation for `Struct` is JSON object.
|
||||
type Struct struct {
|
||||
// Map of dynamically typed values.
|
||||
Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
}
|
||||
|
||||
func (m *Struct) Reset() { *m = Struct{} }
|
||||
func (m *Struct) String() string { return proto.CompactTextString(m) }
|
||||
func (*Struct) ProtoMessage() {}
|
||||
func (*Struct) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{0} }
|
||||
func (*Struct) XXX_WellKnownType() string { return "Struct" }
|
||||
|
||||
func (m *Struct) GetFields() map[string]*Value {
|
||||
if m != nil {
|
||||
return m.Fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// `Value` represents a dynamically typed value which can be either
|
||||
// null, a number, a string, a boolean, a recursive struct value, or a
|
||||
// list of values. A producer of value is expected to set one of that
|
||||
// variants, absence of any variant indicates an error.
|
||||
//
|
||||
// The JSON representation for `Value` is JSON value.
|
||||
type Value struct {
|
||||
// The kind of value.
|
||||
//
|
||||
// Types that are valid to be assigned to Kind:
|
||||
// *Value_NullValue
|
||||
// *Value_NumberValue
|
||||
// *Value_StringValue
|
||||
// *Value_BoolValue
|
||||
// *Value_StructValue
|
||||
// *Value_ListValue
|
||||
Kind isValue_Kind `protobuf_oneof:"kind"`
|
||||
}
|
||||
|
||||
func (m *Value) Reset() { *m = Value{} }
|
||||
func (m *Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Value) ProtoMessage() {}
|
||||
func (*Value) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{1} }
|
||||
func (*Value) XXX_WellKnownType() string { return "Value" }
|
||||
|
||||
type isValue_Kind interface {
|
||||
isValue_Kind()
|
||||
}
|
||||
|
||||
type Value_NullValue struct {
|
||||
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof"`
|
||||
}
|
||||
type Value_NumberValue struct {
|
||||
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,oneof"`
|
||||
}
|
||||
type Value_StringValue struct {
|
||||
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,oneof"`
|
||||
}
|
||||
type Value_BoolValue struct {
|
||||
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,oneof"`
|
||||
}
|
||||
type Value_StructValue struct {
|
||||
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"`
|
||||
}
|
||||
type Value_ListValue struct {
|
||||
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"`
|
||||
}
|
||||
|
||||
func (*Value_NullValue) isValue_Kind() {}
|
||||
func (*Value_NumberValue) isValue_Kind() {}
|
||||
func (*Value_StringValue) isValue_Kind() {}
|
||||
func (*Value_BoolValue) isValue_Kind() {}
|
||||
func (*Value_StructValue) isValue_Kind() {}
|
||||
func (*Value_ListValue) isValue_Kind() {}
|
||||
|
||||
func (m *Value) GetKind() isValue_Kind {
|
||||
if m != nil {
|
||||
return m.Kind
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Value) GetNullValue() NullValue {
|
||||
if x, ok := m.GetKind().(*Value_NullValue); ok {
|
||||
return x.NullValue
|
||||
}
|
||||
return NullValue_NULL_VALUE
|
||||
}
|
||||
|
||||
func (m *Value) GetNumberValue() float64 {
|
||||
if x, ok := m.GetKind().(*Value_NumberValue); ok {
|
||||
return x.NumberValue
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Value) GetStringValue() string {
|
||||
if x, ok := m.GetKind().(*Value_StringValue); ok {
|
||||
return x.StringValue
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *Value) GetBoolValue() bool {
|
||||
if x, ok := m.GetKind().(*Value_BoolValue); ok {
|
||||
return x.BoolValue
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Value) GetStructValue() *Struct {
|
||||
if x, ok := m.GetKind().(*Value_StructValue); ok {
|
||||
return x.StructValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Value) GetListValue() *ListValue {
|
||||
if x, ok := m.GetKind().(*Value_ListValue); ok {
|
||||
return x.ListValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _Value_OneofMarshaler, _Value_OneofUnmarshaler, _Value_OneofSizer, []interface{}{
|
||||
(*Value_NullValue)(nil),
|
||||
(*Value_NumberValue)(nil),
|
||||
(*Value_StringValue)(nil),
|
||||
(*Value_BoolValue)(nil),
|
||||
(*Value_StructValue)(nil),
|
||||
(*Value_ListValue)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*Value)
|
||||
// kind
|
||||
switch x := m.Kind.(type) {
|
||||
case *Value_NullValue:
|
||||
b.EncodeVarint(1<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(uint64(x.NullValue))
|
||||
case *Value_NumberValue:
|
||||
b.EncodeVarint(2<<3 | proto.WireFixed64)
|
||||
b.EncodeFixed64(math.Float64bits(x.NumberValue))
|
||||
case *Value_StringValue:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.StringValue)
|
||||
case *Value_BoolValue:
|
||||
t := uint64(0)
|
||||
if x.BoolValue {
|
||||
t = 1
|
||||
}
|
||||
b.EncodeVarint(4<<3 | proto.WireVarint)
|
||||
b.EncodeVarint(t)
|
||||
case *Value_StructValue:
|
||||
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.StructValue); err != nil {
|
||||
return err
|
||||
}
|
||||
case *Value_ListValue:
|
||||
b.EncodeVarint(6<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ListValue); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("Value.Kind has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*Value)
|
||||
switch tag {
|
||||
case 1: // kind.null_value
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Kind = &Value_NullValue{NullValue(x)}
|
||||
return true, err
|
||||
case 2: // kind.number_value
|
||||
if wire != proto.WireFixed64 {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeFixed64()
|
||||
m.Kind = &Value_NumberValue{math.Float64frombits(x)}
|
||||
return true, err
|
||||
case 3: // kind.string_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Kind = &Value_StringValue{x}
|
||||
return true, err
|
||||
case 4: // kind.bool_value
|
||||
if wire != proto.WireVarint {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeVarint()
|
||||
m.Kind = &Value_BoolValue{x != 0}
|
||||
return true, err
|
||||
case 5: // kind.struct_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Struct)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Kind = &Value_StructValue{msg}
|
||||
return true, err
|
||||
case 6: // kind.list_value
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ListValue)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Kind = &Value_ListValue{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _Value_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*Value)
|
||||
// kind
|
||||
switch x := m.Kind.(type) {
|
||||
case *Value_NullValue:
|
||||
n += proto.SizeVarint(1<<3 | proto.WireVarint)
|
||||
n += proto.SizeVarint(uint64(x.NullValue))
|
||||
case *Value_NumberValue:
|
||||
n += proto.SizeVarint(2<<3 | proto.WireFixed64)
|
||||
n += 8
|
||||
case *Value_StringValue:
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(len(x.StringValue)))
|
||||
n += len(x.StringValue)
|
||||
case *Value_BoolValue:
|
||||
n += proto.SizeVarint(4<<3 | proto.WireVarint)
|
||||
n += 1
|
||||
case *Value_StructValue:
|
||||
s := proto.Size(x.StructValue)
|
||||
n += proto.SizeVarint(5<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *Value_ListValue:
|
||||
s := proto.Size(x.ListValue)
|
||||
n += proto.SizeVarint(6<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// `ListValue` is a wrapper around a repeated field of values.
|
||||
//
|
||||
// The JSON representation for `ListValue` is JSON array.
|
||||
type ListValue struct {
|
||||
// Repeated field of dynamically typed values.
|
||||
Values []*Value `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ListValue) Reset() { *m = ListValue{} }
|
||||
func (m *ListValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*ListValue) ProtoMessage() {}
|
||||
func (*ListValue) Descriptor() ([]byte, []int) { return fileDescriptor6, []int{2} }
|
||||
func (*ListValue) XXX_WellKnownType() string { return "ListValue" }
|
||||
|
||||
func (m *ListValue) GetValues() []*Value {
|
||||
if m != nil {
|
||||
return m.Values
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Struct)(nil), "google.protobuf.Struct")
|
||||
proto.RegisterType((*Value)(nil), "google.protobuf.Value")
|
||||
proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue")
|
||||
proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor6) }
|
||||
|
||||
var fileDescriptor6 = []byte{
|
||||
// 378 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0x4b, 0x4f, 0xe2, 0x50,
|
||||
0x14, 0xc7, 0xb9, 0x2d, 0x34, 0xd3, 0xd3, 0x09, 0x43, 0x3a, 0xc9, 0x0c, 0x61, 0x26, 0x6a, 0x60,
|
||||
0x43, 0x8c, 0x29, 0x09, 0x6e, 0x8c, 0xb8, 0xb1, 0x09, 0x62, 0x62, 0x43, 0x6a, 0x15, 0x5c, 0x12,
|
||||
0x0b, 0x85, 0x34, 0x5c, 0xee, 0x25, 0x7d, 0x68, 0xf8, 0x26, 0x2e, 0x8d, 0x4b, 0x97, 0x7e, 0x42,
|
||||
0xef, 0xa3, 0xad, 0x06, 0xc2, 0xee, 0x9e, 0xff, 0xf9, 0x9d, 0xff, 0x79, 0x5c, 0xf8, 0xbf, 0xa0,
|
||||
0x74, 0x81, 0x83, 0xce, 0x3a, 0xa2, 0x09, 0xf5, 0xd3, 0x79, 0x27, 0x4e, 0xa2, 0x74, 0x9a, 0x58,
|
||||
0x22, 0x36, 0x7f, 0xc9, 0xac, 0x95, 0x67, 0x9b, 0x2f, 0x08, 0xb4, 0x3b, 0x41, 0x98, 0x3d, 0xd0,
|
||||
0xe6, 0x61, 0x80, 0x67, 0x71, 0x1d, 0x1d, 0xa9, 0x6d, 0xa3, 0xdb, 0xb2, 0xb6, 0x60, 0x4b, 0x82,
|
||||
0xd6, 0x95, 0xa0, 0xfa, 0x24, 0x89, 0x36, 0x5e, 0x56, 0xd2, 0xb8, 0x05, 0xe3, 0x9b, 0x6c, 0xd6,
|
||||
0x40, 0x5d, 0x06, 0x1b, 0x66, 0x84, 0xda, 0xba, 0xc7, 0x9f, 0xe6, 0x09, 0x54, 0x9e, 0x1e, 0x71,
|
||||
0x1a, 0xd4, 0x15, 0xa6, 0x19, 0xdd, 0x3f, 0x3b, 0xe6, 0x63, 0x9e, 0xf5, 0x24, 0x74, 0xae, 0x9c,
|
||||
0xa1, 0xe6, 0x87, 0x02, 0x15, 0x21, 0xb2, 0xc9, 0x80, 0xa4, 0x18, 0x4f, 0xa4, 0x01, 0x37, 0xad,
|
||||
0x76, 0x1b, 0x3b, 0x06, 0x43, 0x86, 0x08, 0xfe, 0xba, 0xe4, 0xe9, 0x24, 0x0f, 0xcc, 0x16, 0xfc,
|
||||
0x24, 0xe9, 0xca, 0x0f, 0xa2, 0xc9, 0x57, 0x7f, 0xc4, 0x10, 0x43, 0xaa, 0x05, 0xc4, 0xee, 0x14,
|
||||
0x92, 0x45, 0x06, 0xa9, 0x7c, 0x70, 0x0e, 0x49, 0x55, 0x42, 0x87, 0x00, 0x3e, 0xa5, 0xf9, 0x18,
|
||||
0x65, 0x86, 0xfc, 0xe0, 0xad, 0xb8, 0x26, 0x81, 0x0b, 0xe1, 0xc2, 0x4e, 0x94, 0x21, 0x15, 0xb1,
|
||||
0xea, 0xdf, 0x3d, 0x77, 0xcc, 0xec, 0xd9, 0xab, 0xd8, 0x12, 0x87, 0x71, 0x5e, 0xab, 0x89, 0xda,
|
||||
0xdd, 0x2d, 0x1d, 0x86, 0x14, 0x5b, 0xe2, 0x3c, 0xb0, 0x35, 0x28, 0x2f, 0x43, 0x32, 0x6b, 0xf6,
|
||||
0x40, 0x2f, 0x08, 0xd3, 0x02, 0x4d, 0x98, 0xe5, 0x3f, 0xba, 0xef, 0xe8, 0x19, 0x75, 0xfc, 0x0f,
|
||||
0xf4, 0xe2, 0x88, 0x66, 0x15, 0x60, 0x38, 0x72, 0x9c, 0xc9, 0xf8, 0xd2, 0x19, 0xf5, 0x6b, 0x25,
|
||||
0x7b, 0x08, 0xbf, 0xa7, 0x74, 0xb5, 0xed, 0x60, 0x1b, 0x72, 0x19, 0x97, 0xc7, 0x2e, 0x7a, 0x45,
|
||||
0xe8, 0x4d, 0x51, 0x07, 0xae, 0xfd, 0xae, 0x1c, 0x0c, 0x24, 0xe9, 0xe6, 0xbd, 0x1e, 0x02, 0x8c,
|
||||
0x6f, 0x08, 0x7d, 0x26, 0xf7, 0x9b, 0x75, 0x10, 0xfb, 0x9a, 0xb0, 0x38, 0xfd, 0x0c, 0x00, 0x00,
|
||||
0xff, 0xff, 0x08, 0x22, 0x4f, 0xb6, 0xb1, 0x02, 0x00, 0x00,
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/timestamp.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// A Timestamp represents a point in time independent of any time zone
|
||||
// or calendar, represented as seconds and fractions of seconds at
|
||||
// nanosecond resolution in UTC Epoch time. It is encoded using the
|
||||
// Proleptic Gregorian Calendar which extends the Gregorian calendar
|
||||
// backwards to year one. It is encoded assuming all minutes are 60
|
||||
// seconds long, i.e. leap seconds are "smeared" so that no leap second
|
||||
// table is needed for interpretation. Range is from
|
||||
// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
|
||||
// By restricting to that range, we ensure that we can convert to
|
||||
// and from RFC 3339 date strings.
|
||||
// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
|
||||
//
|
||||
// Example 1: Compute Timestamp from POSIX `time()`.
|
||||
//
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds(time(NULL));
|
||||
// timestamp.set_nanos(0);
|
||||
//
|
||||
// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
|
||||
//
|
||||
// struct timeval tv;
|
||||
// gettimeofday(&tv, NULL);
|
||||
//
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds(tv.tv_sec);
|
||||
// timestamp.set_nanos(tv.tv_usec * 1000);
|
||||
//
|
||||
// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
|
||||
//
|
||||
// FILETIME ft;
|
||||
// GetSystemTimeAsFileTime(&ft);
|
||||
// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
|
||||
//
|
||||
// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
|
||||
// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
|
||||
// Timestamp timestamp;
|
||||
// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
|
||||
// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
|
||||
//
|
||||
// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
|
||||
//
|
||||
// long millis = System.currentTimeMillis();
|
||||
//
|
||||
// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
|
||||
// .setNanos((int) ((millis % 1000) * 1000000)).build();
|
||||
//
|
||||
//
|
||||
// Example 5: Compute Timestamp from current time in Python.
|
||||
//
|
||||
// now = time.time()
|
||||
// seconds = int(now)
|
||||
// nanos = int((now - seconds) * 10**9)
|
||||
// timestamp = Timestamp(seconds=seconds, nanos=nanos)
|
||||
//
|
||||
//
|
||||
type Timestamp struct {
|
||||
// Represents seconds of UTC time since Unix epoch
|
||||
// 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to
|
||||
// 9999-12-31T23:59:59Z inclusive.
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"`
|
||||
// Non-negative fractions of a second at nanosecond resolution. Negative
|
||||
// second values with fractions must still have non-negative nanos values
|
||||
// that count forward in time. Must be from 0 to 999,999,999
|
||||
// inclusive.
|
||||
Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Timestamp) Reset() { *m = Timestamp{} }
|
||||
func (m *Timestamp) String() string { return proto.CompactTextString(m) }
|
||||
func (*Timestamp) ProtoMessage() {}
|
||||
func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor7, []int{0} }
|
||||
func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor7) }
|
||||
|
||||
var fileDescriptor7 = []byte{
|
||||
// 165 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d,
|
||||
0x2d, 0x2e, 0x49, 0xcc, 0x2d, 0xd0, 0x03, 0x0b, 0x09, 0xf1, 0x43, 0x14, 0xe8, 0xc1, 0x14, 0x28,
|
||||
0x59, 0x73, 0x71, 0x86, 0xc0, 0xd4, 0x08, 0x49, 0x70, 0xb1, 0x17, 0xa7, 0x26, 0xe7, 0xe7, 0xa5,
|
||||
0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x30, 0x07, 0xc1, 0xb8, 0x42, 0x22, 0x5c, 0xac, 0x79, 0x89,
|
||||
0x79, 0xf9, 0xc5, 0x12, 0x4c, 0x40, 0x71, 0xd6, 0x20, 0x08, 0xc7, 0x29, 0x84, 0x4b, 0x38, 0x39,
|
||||
0x3f, 0x57, 0x0f, 0xcd, 0x4c, 0x27, 0x3e, 0xb8, 0x89, 0x01, 0x20, 0xa1, 0x00, 0xc6, 0x05, 0x8c,
|
||||
0x8c, 0x3f, 0x18, 0x19, 0x17, 0x31, 0x31, 0xbb, 0x07, 0x38, 0xad, 0x62, 0x92, 0x73, 0x87, 0xa8,
|
||||
0x0f, 0x80, 0xaa, 0xd7, 0x0b, 0x4f, 0xcd, 0xc9, 0xf1, 0xce, 0xcb, 0x2f, 0xcf, 0x0b, 0xa9, 0x2c,
|
||||
0x48, 0x2d, 0x4e, 0x62, 0x03, 0x1b, 0x64, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x10, 0x2f, 0xb9,
|
||||
0x47, 0xcd, 0x00, 0x00, 0x00,
|
||||
}
|
|
@ -1,390 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/type.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// The syntax in which a protocol buffer element is defined.
|
||||
type Syntax int32
|
||||
|
||||
const (
|
||||
// Syntax `proto2`.
|
||||
Syntax_SYNTAX_PROTO2 Syntax = 0
|
||||
// Syntax `proto3`.
|
||||
Syntax_SYNTAX_PROTO3 Syntax = 1
|
||||
)
|
||||
|
||||
var Syntax_name = map[int32]string{
|
||||
0: "SYNTAX_PROTO2",
|
||||
1: "SYNTAX_PROTO3",
|
||||
}
|
||||
var Syntax_value = map[string]int32{
|
||||
"SYNTAX_PROTO2": 0,
|
||||
"SYNTAX_PROTO3": 1,
|
||||
}
|
||||
|
||||
func (x Syntax) String() string {
|
||||
return proto.EnumName(Syntax_name, int32(x))
|
||||
}
|
||||
func (Syntax) EnumDescriptor() ([]byte, []int) { return fileDescriptor8, []int{0} }
|
||||
|
||||
// Basic field types.
|
||||
type Field_Kind int32
|
||||
|
||||
const (
|
||||
// Field type unknown.
|
||||
Field_TYPE_UNKNOWN Field_Kind = 0
|
||||
// Field type double.
|
||||
Field_TYPE_DOUBLE Field_Kind = 1
|
||||
// Field type float.
|
||||
Field_TYPE_FLOAT Field_Kind = 2
|
||||
// Field type int64.
|
||||
Field_TYPE_INT64 Field_Kind = 3
|
||||
// Field type uint64.
|
||||
Field_TYPE_UINT64 Field_Kind = 4
|
||||
// Field type int32.
|
||||
Field_TYPE_INT32 Field_Kind = 5
|
||||
// Field type fixed64.
|
||||
Field_TYPE_FIXED64 Field_Kind = 6
|
||||
// Field type fixed32.
|
||||
Field_TYPE_FIXED32 Field_Kind = 7
|
||||
// Field type bool.
|
||||
Field_TYPE_BOOL Field_Kind = 8
|
||||
// Field type string.
|
||||
Field_TYPE_STRING Field_Kind = 9
|
||||
// Field type group. Proto2 syntax only, and deprecated.
|
||||
Field_TYPE_GROUP Field_Kind = 10
|
||||
// Field type message.
|
||||
Field_TYPE_MESSAGE Field_Kind = 11
|
||||
// Field type bytes.
|
||||
Field_TYPE_BYTES Field_Kind = 12
|
||||
// Field type uint32.
|
||||
Field_TYPE_UINT32 Field_Kind = 13
|
||||
// Field type enum.
|
||||
Field_TYPE_ENUM Field_Kind = 14
|
||||
// Field type sfixed32.
|
||||
Field_TYPE_SFIXED32 Field_Kind = 15
|
||||
// Field type sfixed64.
|
||||
Field_TYPE_SFIXED64 Field_Kind = 16
|
||||
// Field type sint32.
|
||||
Field_TYPE_SINT32 Field_Kind = 17
|
||||
// Field type sint64.
|
||||
Field_TYPE_SINT64 Field_Kind = 18
|
||||
)
|
||||
|
||||
var Field_Kind_name = map[int32]string{
|
||||
0: "TYPE_UNKNOWN",
|
||||
1: "TYPE_DOUBLE",
|
||||
2: "TYPE_FLOAT",
|
||||
3: "TYPE_INT64",
|
||||
4: "TYPE_UINT64",
|
||||
5: "TYPE_INT32",
|
||||
6: "TYPE_FIXED64",
|
||||
7: "TYPE_FIXED32",
|
||||
8: "TYPE_BOOL",
|
||||
9: "TYPE_STRING",
|
||||
10: "TYPE_GROUP",
|
||||
11: "TYPE_MESSAGE",
|
||||
12: "TYPE_BYTES",
|
||||
13: "TYPE_UINT32",
|
||||
14: "TYPE_ENUM",
|
||||
15: "TYPE_SFIXED32",
|
||||
16: "TYPE_SFIXED64",
|
||||
17: "TYPE_SINT32",
|
||||
18: "TYPE_SINT64",
|
||||
}
|
||||
var Field_Kind_value = map[string]int32{
|
||||
"TYPE_UNKNOWN": 0,
|
||||
"TYPE_DOUBLE": 1,
|
||||
"TYPE_FLOAT": 2,
|
||||
"TYPE_INT64": 3,
|
||||
"TYPE_UINT64": 4,
|
||||
"TYPE_INT32": 5,
|
||||
"TYPE_FIXED64": 6,
|
||||
"TYPE_FIXED32": 7,
|
||||
"TYPE_BOOL": 8,
|
||||
"TYPE_STRING": 9,
|
||||
"TYPE_GROUP": 10,
|
||||
"TYPE_MESSAGE": 11,
|
||||
"TYPE_BYTES": 12,
|
||||
"TYPE_UINT32": 13,
|
||||
"TYPE_ENUM": 14,
|
||||
"TYPE_SFIXED32": 15,
|
||||
"TYPE_SFIXED64": 16,
|
||||
"TYPE_SINT32": 17,
|
||||
"TYPE_SINT64": 18,
|
||||
}
|
||||
|
||||
func (x Field_Kind) String() string {
|
||||
return proto.EnumName(Field_Kind_name, int32(x))
|
||||
}
|
||||
func (Field_Kind) EnumDescriptor() ([]byte, []int) { return fileDescriptor8, []int{1, 0} }
|
||||
|
||||
// Whether a field is optional, required, or repeated.
|
||||
type Field_Cardinality int32
|
||||
|
||||
const (
|
||||
// For fields with unknown cardinality.
|
||||
Field_CARDINALITY_UNKNOWN Field_Cardinality = 0
|
||||
// For optional fields.
|
||||
Field_CARDINALITY_OPTIONAL Field_Cardinality = 1
|
||||
// For required fields. Proto2 syntax only.
|
||||
Field_CARDINALITY_REQUIRED Field_Cardinality = 2
|
||||
// For repeated fields.
|
||||
Field_CARDINALITY_REPEATED Field_Cardinality = 3
|
||||
)
|
||||
|
||||
var Field_Cardinality_name = map[int32]string{
|
||||
0: "CARDINALITY_UNKNOWN",
|
||||
1: "CARDINALITY_OPTIONAL",
|
||||
2: "CARDINALITY_REQUIRED",
|
||||
3: "CARDINALITY_REPEATED",
|
||||
}
|
||||
var Field_Cardinality_value = map[string]int32{
|
||||
"CARDINALITY_UNKNOWN": 0,
|
||||
"CARDINALITY_OPTIONAL": 1,
|
||||
"CARDINALITY_REQUIRED": 2,
|
||||
"CARDINALITY_REPEATED": 3,
|
||||
}
|
||||
|
||||
func (x Field_Cardinality) String() string {
|
||||
return proto.EnumName(Field_Cardinality_name, int32(x))
|
||||
}
|
||||
func (Field_Cardinality) EnumDescriptor() ([]byte, []int) { return fileDescriptor8, []int{1, 1} }
|
||||
|
||||
// A protocol buffer message type.
|
||||
type Type struct {
|
||||
// The fully qualified message name.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The list of fields.
|
||||
Fields []*Field `protobuf:"bytes,2,rep,name=fields" json:"fields,omitempty"`
|
||||
// The list of types appearing in `oneof` definitions in this type.
|
||||
Oneofs []string `protobuf:"bytes,3,rep,name=oneofs" json:"oneofs,omitempty"`
|
||||
// The protocol buffer options.
|
||||
Options []*Option `protobuf:"bytes,4,rep,name=options" json:"options,omitempty"`
|
||||
// The source context.
|
||||
SourceContext *SourceContext `protobuf:"bytes,5,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"`
|
||||
// The source syntax.
|
||||
Syntax Syntax `protobuf:"varint,6,opt,name=syntax,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Type) Reset() { *m = Type{} }
|
||||
func (m *Type) String() string { return proto.CompactTextString(m) }
|
||||
func (*Type) ProtoMessage() {}
|
||||
func (*Type) Descriptor() ([]byte, []int) { return fileDescriptor8, []int{0} }
|
||||
|
||||
func (m *Type) GetFields() []*Field {
|
||||
if m != nil {
|
||||
return m.Fields
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Type) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Type) GetSourceContext() *SourceContext {
|
||||
if m != nil {
|
||||
return m.SourceContext
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A single field of a message type.
|
||||
type Field struct {
|
||||
// The field type.
|
||||
Kind Field_Kind `protobuf:"varint,1,opt,name=kind,enum=google.protobuf.Field_Kind" json:"kind,omitempty"`
|
||||
// The field cardinality.
|
||||
Cardinality Field_Cardinality `protobuf:"varint,2,opt,name=cardinality,enum=google.protobuf.Field_Cardinality" json:"cardinality,omitempty"`
|
||||
// The field number.
|
||||
Number int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"`
|
||||
// The field name.
|
||||
Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
|
||||
// The field type URL, without the scheme, for message or enumeration
|
||||
// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
|
||||
TypeUrl string `protobuf:"bytes,6,opt,name=type_url,json=typeUrl" json:"type_url,omitempty"`
|
||||
// The index of the field type in `Type.oneofs`, for message or enumeration
|
||||
// types. The first type has index 1; zero means the type is not in the list.
|
||||
OneofIndex int32 `protobuf:"varint,7,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"`
|
||||
// Whether to use alternative packed wire representation.
|
||||
Packed bool `protobuf:"varint,8,opt,name=packed" json:"packed,omitempty"`
|
||||
// The protocol buffer options.
|
||||
Options []*Option `protobuf:"bytes,9,rep,name=options" json:"options,omitempty"`
|
||||
// The field JSON name.
|
||||
JsonName string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"`
|
||||
// The string value of the default value of this field. Proto2 syntax only.
|
||||
DefaultValue string `protobuf:"bytes,11,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Field) Reset() { *m = Field{} }
|
||||
func (m *Field) String() string { return proto.CompactTextString(m) }
|
||||
func (*Field) ProtoMessage() {}
|
||||
func (*Field) Descriptor() ([]byte, []int) { return fileDescriptor8, []int{1} }
|
||||
|
||||
func (m *Field) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Enum type definition.
|
||||
type Enum struct {
|
||||
// Enum type name.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Enum value definitions.
|
||||
Enumvalue []*EnumValue `protobuf:"bytes,2,rep,name=enumvalue" json:"enumvalue,omitempty"`
|
||||
// Protocol buffer options.
|
||||
Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"`
|
||||
// The source context.
|
||||
SourceContext *SourceContext `protobuf:"bytes,4,opt,name=source_context,json=sourceContext" json:"source_context,omitempty"`
|
||||
// The source syntax.
|
||||
Syntax Syntax `protobuf:"varint,5,opt,name=syntax,enum=google.protobuf.Syntax" json:"syntax,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Enum) Reset() { *m = Enum{} }
|
||||
func (m *Enum) String() string { return proto.CompactTextString(m) }
|
||||
func (*Enum) ProtoMessage() {}
|
||||
func (*Enum) Descriptor() ([]byte, []int) { return fileDescriptor8, []int{2} }
|
||||
|
||||
func (m *Enum) GetEnumvalue() []*EnumValue {
|
||||
if m != nil {
|
||||
return m.Enumvalue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Enum) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Enum) GetSourceContext() *SourceContext {
|
||||
if m != nil {
|
||||
return m.SourceContext
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Enum value definition.
|
||||
type EnumValue struct {
|
||||
// Enum value name.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Enum value number.
|
||||
Number int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"`
|
||||
// Protocol buffer options.
|
||||
Options []*Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"`
|
||||
}
|
||||
|
||||
func (m *EnumValue) Reset() { *m = EnumValue{} }
|
||||
func (m *EnumValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*EnumValue) ProtoMessage() {}
|
||||
func (*EnumValue) Descriptor() ([]byte, []int) { return fileDescriptor8, []int{3} }
|
||||
|
||||
func (m *EnumValue) GetOptions() []*Option {
|
||||
if m != nil {
|
||||
return m.Options
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A protocol buffer option, which can be attached to a message, field,
|
||||
// enumeration, etc.
|
||||
type Option struct {
|
||||
// The option's name. For example, `"java_package"`.
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// The option's value. For example, `"com.google.protobuf"`.
|
||||
Value *Any `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Option) Reset() { *m = Option{} }
|
||||
func (m *Option) String() string { return proto.CompactTextString(m) }
|
||||
func (*Option) ProtoMessage() {}
|
||||
func (*Option) Descriptor() ([]byte, []int) { return fileDescriptor8, []int{4} }
|
||||
|
||||
func (m *Option) GetValue() *Any {
|
||||
if m != nil {
|
||||
return m.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Type)(nil), "google.protobuf.Type")
|
||||
proto.RegisterType((*Field)(nil), "google.protobuf.Field")
|
||||
proto.RegisterType((*Enum)(nil), "google.protobuf.Enum")
|
||||
proto.RegisterType((*EnumValue)(nil), "google.protobuf.EnumValue")
|
||||
proto.RegisterType((*Option)(nil), "google.protobuf.Option")
|
||||
proto.RegisterEnum("google.protobuf.Syntax", Syntax_name, Syntax_value)
|
||||
proto.RegisterEnum("google.protobuf.Field_Kind", Field_Kind_name, Field_Kind_value)
|
||||
proto.RegisterEnum("google.protobuf.Field_Cardinality", Field_Cardinality_name, Field_Cardinality_value)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/type.proto", fileDescriptor8) }
|
||||
|
||||
var fileDescriptor8 = []byte{
|
||||
// 768 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x6e, 0xda, 0x58,
|
||||
0x14, 0x1e, 0x83, 0x31, 0xf8, 0x38, 0x10, 0xe7, 0x26, 0x4a, 0x1c, 0x22, 0x65, 0x22, 0x66, 0x16,
|
||||
0x51, 0x16, 0x44, 0x43, 0x46, 0xa3, 0xd9, 0x42, 0x70, 0x18, 0x2b, 0xc4, 0xf6, 0x5c, 0x4c, 0x13,
|
||||
0x56, 0xc8, 0x01, 0x13, 0x91, 0x38, 0x36, 0xc2, 0xa6, 0x0d, 0x0f, 0xd1, 0x77, 0xa8, 0xba, 0xec,
|
||||
0xba, 0x0f, 0xd1, 0xb7, 0x6a, 0xef, 0xbd, 0x06, 0x63, 0x7e, 0x2a, 0xa5, 0xed, 0x8e, 0xf3, 0x7d,
|
||||
0xdf, 0xf9, 0xbd, 0xc7, 0x07, 0x28, 0x3e, 0xf8, 0xfe, 0x83, 0xeb, 0x9c, 0x8f, 0xc6, 0x7e, 0xe8,
|
||||
0xdf, 0x4f, 0x06, 0xe7, 0xe1, 0x74, 0xe4, 0x94, 0x99, 0x85, 0xb6, 0x23, 0xae, 0x3c, 0xe7, 0x8a,
|
||||
0x87, 0xab, 0x62, 0xdb, 0x9b, 0x46, 0x6c, 0xf1, 0xcf, 0x55, 0x2a, 0xf0, 0x27, 0xe3, 0x9e, 0xd3,
|
||||
0xed, 0xf9, 0x5e, 0xe8, 0xbc, 0x84, 0x91, 0xaa, 0xf4, 0x3e, 0x05, 0xbc, 0x45, 0x12, 0x20, 0x04,
|
||||
0xbc, 0x67, 0x3f, 0x3b, 0x0a, 0x77, 0xc2, 0x9d, 0x8a, 0x98, 0xfd, 0x46, 0x65, 0x10, 0x06, 0x43,
|
||||
0xc7, 0xed, 0x07, 0x4a, 0xea, 0x24, 0x7d, 0x2a, 0x55, 0xf6, 0xcb, 0x2b, 0xf9, 0xcb, 0x57, 0x94,
|
||||
0xc6, 0x33, 0x15, 0xda, 0x07, 0xc1, 0xf7, 0x1c, 0x7f, 0x10, 0x28, 0x69, 0xa2, 0x17, 0xf1, 0xcc,
|
||||
0x42, 0x7f, 0x41, 0xd6, 0x1f, 0x85, 0x43, 0xdf, 0x0b, 0x14, 0x9e, 0x05, 0x3a, 0x58, 0x0b, 0x64,
|
||||
0x30, 0x1e, 0xcf, 0x75, 0x48, 0x85, 0xc2, 0x72, 0xbd, 0x4a, 0x86, 0x14, 0x26, 0x55, 0x8e, 0xd7,
|
||||
0x3c, 0x5b, 0x4c, 0x76, 0x19, 0xa9, 0x70, 0x3e, 0x48, 0x9a, 0xe8, 0x1c, 0x84, 0x60, 0xea, 0x85,
|
||||
0xf6, 0x8b, 0x22, 0x10, 0xf7, 0xc2, 0x86, 0xc4, 0x2d, 0x46, 0xe3, 0x99, 0xac, 0xf4, 0x59, 0x80,
|
||||
0x0c, 0x6b, 0x8a, 0xb8, 0xf2, 0x4f, 0x43, 0xaf, 0xcf, 0x06, 0x52, 0xa8, 0x1c, 0x6d, 0x6e, 0xbd,
|
||||
0x7c, 0x4d, 0x24, 0x98, 0x09, 0x51, 0x1d, 0xa4, 0x9e, 0x3d, 0xee, 0x0f, 0x3d, 0xdb, 0x1d, 0x86,
|
||||
0x53, 0x32, 0x32, 0xea, 0x57, 0xfa, 0x8e, 0xdf, 0xe5, 0x42, 0x89, 0x93, 0x6e, 0x74, 0x86, 0xde,
|
||||
0xe4, 0xf9, 0xde, 0x19, 0x93, 0x19, 0x72, 0xa7, 0x19, 0x3c, 0xb3, 0xe2, 0xf7, 0xe1, 0x13, 0xef,
|
||||
0x73, 0x08, 0x39, 0xba, 0x1c, 0xdd, 0xc9, 0xd8, 0x65, 0xfd, 0x89, 0x38, 0x4b, 0xed, 0xf6, 0xd8,
|
||||
0x45, 0xbf, 0x83, 0xc4, 0x86, 0xdf, 0x25, 0x95, 0x39, 0x2f, 0x4a, 0x96, 0xc5, 0x02, 0x06, 0x69,
|
||||
0x14, 0xa1, 0x79, 0x46, 0x76, 0xef, 0xc9, 0xe9, 0x2b, 0x39, 0xc2, 0xe5, 0xf0, 0xcc, 0x4a, 0xbe,
|
||||
0x95, 0xf8, 0xca, 0xb7, 0x3a, 0x02, 0xf1, 0x31, 0xf0, 0xbd, 0x2e, 0xab, 0x0f, 0x58, 0x1d, 0x39,
|
||||
0x0a, 0xe8, 0xb4, 0xc6, 0x3f, 0x20, 0xdf, 0x77, 0x06, 0xf6, 0xc4, 0x0d, 0xbb, 0x6f, 0x6d, 0x77,
|
||||
0xe2, 0x28, 0x12, 0x13, 0x6c, 0xcd, 0xc0, 0x37, 0x14, 0x2b, 0x7d, 0x21, 0x5b, 0x48, 0x27, 0x89,
|
||||
0x64, 0xd8, 0xb2, 0x3a, 0xa6, 0xda, 0x6d, 0xeb, 0xd7, 0xba, 0x71, 0xab, 0xcb, 0xbf, 0xa1, 0x6d,
|
||||
0x90, 0x18, 0x52, 0x37, 0xda, 0xb5, 0xa6, 0x2a, 0x73, 0xa8, 0x00, 0xc0, 0x80, 0xab, 0xa6, 0x51,
|
||||
0xb5, 0xe4, 0x54, 0x6c, 0x6b, 0xba, 0xf5, 0xcf, 0xdf, 0x72, 0x3a, 0x76, 0x68, 0x47, 0x00, 0x9f,
|
||||
0x14, 0x5c, 0x54, 0xe4, 0x4c, 0x9c, 0xe3, 0x4a, 0xbb, 0x53, 0xeb, 0x44, 0x21, 0x2c, 0x23, 0x44,
|
||||
0x93, 0x45, 0x79, 0x10, 0x19, 0x52, 0x33, 0x8c, 0xa6, 0x9c, 0x8b, 0x63, 0xb6, 0x2c, 0xac, 0xe9,
|
||||
0x0d, 0x59, 0x8c, 0x63, 0x36, 0xb0, 0xd1, 0x36, 0x65, 0x88, 0x23, 0xdc, 0xa8, 0xad, 0x56, 0xb5,
|
||||
0xa1, 0xca, 0x52, 0xac, 0xa8, 0x75, 0x2c, 0xb5, 0x25, 0x6f, 0x2d, 0x95, 0x45, 0x52, 0xe4, 0xe3,
|
||||
0x14, 0xaa, 0xde, 0xbe, 0x91, 0x0b, 0x68, 0x07, 0xf2, 0x51, 0x8a, 0x79, 0x11, 0xdb, 0x2b, 0x10,
|
||||
0xa9, 0x54, 0x5e, 0x14, 0x12, 0x45, 0xd9, 0x59, 0x02, 0x88, 0x02, 0x95, 0x42, 0x90, 0x12, 0xbb,
|
||||
0x85, 0x0e, 0x60, 0xf7, 0xb2, 0x8a, 0xeb, 0x9a, 0x5e, 0x6d, 0x6a, 0x56, 0x27, 0x31, 0x57, 0x05,
|
||||
0xf6, 0x92, 0x84, 0x61, 0x5a, 0x9a, 0x41, 0x7e, 0x93, 0x01, 0xaf, 0x30, 0x58, 0xfd, 0xbf, 0xad,
|
||||
0x61, 0xb5, 0x4e, 0x46, 0xbd, 0xc6, 0x98, 0x6a, 0xd5, 0x22, 0x4c, 0xba, 0xf4, 0x95, 0x03, 0x5e,
|
||||
0x25, 0x9b, 0xba, 0xf1, 0x8c, 0xfc, 0x0b, 0xa2, 0x43, 0xb8, 0xe8, 0xf9, 0xa3, 0x4b, 0x52, 0x5c,
|
||||
0x5b, 0x2a, 0xea, 0xcd, 0x96, 0x01, 0x2f, 0xc4, 0xc9, 0x65, 0x4c, 0xff, 0xf4, 0xe1, 0xe0, 0x7f,
|
||||
0xed, 0x70, 0x64, 0x5e, 0x77, 0x38, 0x1e, 0x41, 0x8c, 0x5b, 0xd8, 0x38, 0x85, 0xc5, 0x87, 0x9d,
|
||||
0x5a, 0xfa, 0xb0, 0x7f, 0xbc, 0xc7, 0xd2, 0x7f, 0x20, 0x44, 0xd0, 0xc6, 0x44, 0x67, 0x90, 0x99,
|
||||
0x8f, 0x9a, 0x36, 0xbe, 0xb7, 0x16, 0xae, 0xea, 0x4d, 0x71, 0x24, 0x39, 0x23, 0x17, 0x3e, 0xea,
|
||||
0x83, 0x2e, 0x5b, 0xab, 0xa3, 0x5b, 0xd5, 0xbb, 0xae, 0x89, 0x0d, 0xcb, 0xa8, 0x90, 0x15, 0x59,
|
||||
0x81, 0x2e, 0x64, 0xae, 0xd6, 0x84, 0xdd, 0x9e, 0xff, 0xbc, 0x1a, 0xb1, 0x26, 0xd2, 0xbf, 0x10,
|
||||
0x93, 0x5a, 0x26, 0xf7, 0x81, 0xe3, 0x3e, 0xa6, 0xd2, 0x0d, 0xb3, 0xf6, 0x29, 0x75, 0xdc, 0x88,
|
||||
0x74, 0xe6, 0x3c, 0xf3, 0xad, 0xe3, 0xba, 0xd7, 0x9e, 0xff, 0xce, 0xa3, 0xfa, 0xe0, 0x5e, 0x60,
|
||||
0x01, 0x2e, 0xbe, 0x05, 0x00, 0x00, 0xff, 0xff, 0x95, 0xbb, 0xeb, 0x52, 0xf3, 0x06, 0x00, 0x00,
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
// Code generated by protoc-gen-go.
|
||||
// source: google/protobuf/wrappers.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package google_protobuf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Wrapper message for `double`.
|
||||
//
|
||||
// The JSON representation for `DoubleValue` is JSON number.
|
||||
type DoubleValue struct {
|
||||
// The double value.
|
||||
Value float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DoubleValue) Reset() { *m = DoubleValue{} }
|
||||
func (m *DoubleValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*DoubleValue) ProtoMessage() {}
|
||||
func (*DoubleValue) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{0} }
|
||||
func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" }
|
||||
|
||||
// Wrapper message for `float`.
|
||||
//
|
||||
// The JSON representation for `FloatValue` is JSON number.
|
||||
type FloatValue struct {
|
||||
// The float value.
|
||||
Value float32 `protobuf:"fixed32,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *FloatValue) Reset() { *m = FloatValue{} }
|
||||
func (m *FloatValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*FloatValue) ProtoMessage() {}
|
||||
func (*FloatValue) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{1} }
|
||||
func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" }
|
||||
|
||||
// Wrapper message for `int64`.
|
||||
//
|
||||
// The JSON representation for `Int64Value` is JSON string.
|
||||
type Int64Value struct {
|
||||
// The int64 value.
|
||||
Value int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Int64Value) Reset() { *m = Int64Value{} }
|
||||
func (m *Int64Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int64Value) ProtoMessage() {}
|
||||
func (*Int64Value) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{2} }
|
||||
func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" }
|
||||
|
||||
// Wrapper message for `uint64`.
|
||||
//
|
||||
// The JSON representation for `UInt64Value` is JSON string.
|
||||
type UInt64Value struct {
|
||||
// The uint64 value.
|
||||
Value uint64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UInt64Value) Reset() { *m = UInt64Value{} }
|
||||
func (m *UInt64Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*UInt64Value) ProtoMessage() {}
|
||||
func (*UInt64Value) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{3} }
|
||||
func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" }
|
||||
|
||||
// Wrapper message for `int32`.
|
||||
//
|
||||
// The JSON representation for `Int32Value` is JSON number.
|
||||
type Int32Value struct {
|
||||
// The int32 value.
|
||||
Value int32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Int32Value) Reset() { *m = Int32Value{} }
|
||||
func (m *Int32Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*Int32Value) ProtoMessage() {}
|
||||
func (*Int32Value) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{4} }
|
||||
func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" }
|
||||
|
||||
// Wrapper message for `uint32`.
|
||||
//
|
||||
// The JSON representation for `UInt32Value` is JSON number.
|
||||
type UInt32Value struct {
|
||||
// The uint32 value.
|
||||
Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UInt32Value) Reset() { *m = UInt32Value{} }
|
||||
func (m *UInt32Value) String() string { return proto.CompactTextString(m) }
|
||||
func (*UInt32Value) ProtoMessage() {}
|
||||
func (*UInt32Value) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{5} }
|
||||
func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" }
|
||||
|
||||
// Wrapper message for `bool`.
|
||||
//
|
||||
// The JSON representation for `BoolValue` is JSON `true` and `false`.
|
||||
type BoolValue struct {
|
||||
// The bool value.
|
||||
Value bool `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BoolValue) Reset() { *m = BoolValue{} }
|
||||
func (m *BoolValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*BoolValue) ProtoMessage() {}
|
||||
func (*BoolValue) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{6} }
|
||||
func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" }
|
||||
|
||||
// Wrapper message for `string`.
|
||||
//
|
||||
// The JSON representation for `StringValue` is JSON string.
|
||||
type StringValue struct {
|
||||
// The string value.
|
||||
Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StringValue) Reset() { *m = StringValue{} }
|
||||
func (m *StringValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*StringValue) ProtoMessage() {}
|
||||
func (*StringValue) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{7} }
|
||||
func (*StringValue) XXX_WellKnownType() string { return "StringValue" }
|
||||
|
||||
// Wrapper message for `bytes`.
|
||||
//
|
||||
// The JSON representation for `BytesValue` is JSON string.
|
||||
type BytesValue struct {
|
||||
// The bytes value.
|
||||
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *BytesValue) Reset() { *m = BytesValue{} }
|
||||
func (m *BytesValue) String() string { return proto.CompactTextString(m) }
|
||||
func (*BytesValue) ProtoMessage() {}
|
||||
func (*BytesValue) Descriptor() ([]byte, []int) { return fileDescriptor9, []int{8} }
|
||||
func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue")
|
||||
proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue")
|
||||
proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value")
|
||||
proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value")
|
||||
proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value")
|
||||
proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value")
|
||||
proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue")
|
||||
proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue")
|
||||
proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor9) }
|
||||
|
||||
var fileDescriptor9 = []byte{
|
||||
// 233 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f,
|
||||
0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c,
|
||||
0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca,
|
||||
0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c,
|
||||
0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5,
|
||||
0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13,
|
||||
0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x80, 0x96, 0x85, 0xe2, 0x52, 0xc4, 0x82, 0x6a, 0x90, 0xb1, 0x11,
|
||||
0x16, 0x35, 0xac, 0x68, 0x06, 0x61, 0x55, 0xc4, 0x0b, 0x53, 0xa4, 0xc8, 0xc5, 0xe9, 0x94, 0x9f,
|
||||
0x9f, 0x83, 0x45, 0x09, 0x07, 0x92, 0x39, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x58, 0x14, 0x71,
|
||||
0x22, 0x39, 0xc8, 0xa9, 0xb2, 0x24, 0xb5, 0x18, 0x8b, 0x1a, 0x1e, 0xa8, 0x1a, 0xa7, 0x60, 0x2e,
|
||||
0xe1, 0xe4, 0xfc, 0x5c, 0x3d, 0xb4, 0xd0, 0x75, 0xe2, 0x0d, 0x87, 0x06, 0x7f, 0x00, 0x48, 0x24,
|
||||
0x80, 0x71, 0x01, 0x23, 0xe3, 0x0f, 0x46, 0xc6, 0x45, 0x4c, 0xcc, 0xee, 0x01, 0x4e, 0xab, 0x98,
|
||||
0xe4, 0xdc, 0x21, 0xca, 0x03, 0xa0, 0xca, 0xf5, 0xc2, 0x53, 0x73, 0x72, 0xbc, 0xf3, 0xf2, 0xcb,
|
||||
0xf3, 0x42, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xe6, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff,
|
||||
0xff, 0xd8, 0xa5, 0x6f, 0xc9, 0xd5, 0x01, 0x00, 0x00,
|
||||
}
|
Loading…
Reference in New Issue