mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-17 18:29:30 +00:00
Merge pull request #105 from mcronce/csi-v1.0.0
[WIP] Updated to CSI v1.0.0
This commit is contained in:
commit
3fd0557550
81
Gopkg.lock
generated
81
Gopkg.lock
generated
@ -2,12 +2,12 @@
|
||||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cf4f5171128e62b46299b0a7cd79543f50e62f483d2ca9364e4957c7bbee7a38"
|
||||
digest = "1:93147eb1d6f08d39f2c0efe3d29ee043bda72be7a8b3b367eb08c72c18524638"
|
||||
name = "github.com/container-storage-interface/spec"
|
||||
packages = ["lib/go/csi/v0"]
|
||||
packages = ["lib/go/csi"]
|
||||
pruneopts = ""
|
||||
revision = "2178fdeea87f1150a17a63252eee28d4d8141f72"
|
||||
version = "v0.3.0"
|
||||
revision = "ed0bb0e1557548aa028307f48728767cfe8f6345"
|
||||
version = "v1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@ -18,10 +18,11 @@
|
||||
revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f958a1c137db276e52f0b50efee41a1a389dcdded59a69711f3e872757dab34b"
|
||||
digest = "1:3dd078fda7500c341bc26cfbc6c6a34614f295a2457149fc1045cab767cbcf18"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"proto",
|
||||
"protoc-gen-go/descriptor",
|
||||
"ptypes",
|
||||
"ptypes/any",
|
||||
"ptypes/duration",
|
||||
@ -29,24 +30,32 @@
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a25a2c5ae694b01713fb6cd03c3b1ac1ccc1902b9f0a922680a88ec254f968e1"
|
||||
name = "github.com/google/uuid"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "9b3b1e0f5f99ae461456d768e7d301a7acdaa2d8"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:941f9605aec45f9e849500c1d315662401982efe492277d1a3bbf5488567321d"
|
||||
digest = "1:01f6264649510cce626f907688df44f80c8ba788d064756701d85c51f21eb0d6"
|
||||
name = "github.com/kubernetes-csi/drivers"
|
||||
packages = ["pkg/csi-common"]
|
||||
pruneopts = ""
|
||||
revision = "d8f283cd941f1e24e20e62653476a3722633f43e"
|
||||
revision = "8a7f2d3a4057ddcff31b7898bd4413dfdf3a3b67"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:63e142fc50307bcb3c57494913cfc9c12f6061160bdf97a678f78c71615f939b"
|
||||
digest = "1:a5484d4fa43127138ae6e7b2299a6a52ae006c7f803d98d717f60abf3e97192e"
|
||||
name = "github.com/pborman/uuid"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53"
|
||||
version = "v1.1"
|
||||
revision = "adf5a7427709b9deb95d29d3fa8a2bf9cfd388f1"
|
||||
version = "v1.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:7365acd48986e205ccb8652cc746f09c8b7876030d53710ea6ef7d0bd0dcd7ca"
|
||||
@ -58,7 +67,7 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:96d281cfaaa12ac602772da38ac85f00d59b1d3aa7bfe69d8ba334d6ee41e3e6"
|
||||
digest = "1:ea539c13b066dac72a940b62f37600a20ab8e88057397c78f3197c1a48475425"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
@ -70,15 +79,15 @@
|
||||
"trace",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "3673e40ba22529d22c3fd7c93e97b0ce50fa7bdd"
|
||||
revision = "351d144fa1fc0bd934e2408202be0c29f25e35a0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:0e1506f3caef942bf9d08a91ebbe8bd87d263e7e440f8e0427b2f85b44eac3f7"
|
||||
digest = "1:f358024b019f87eecaadcb098113a40852c94fe58ea670ef3c3e2d2c7bd93db1"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
pruneopts = ""
|
||||
revision = "e072cadbbdc8dd3d3ffa82b8b4b9304c261d9311"
|
||||
revision = "4ed8d59d0b35e1e29334a206d1b3f38b1e5dfb31"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5acd3512b047305d49e8763eef7ba423901e85d5dd2fd1e71778a0ea8de10bd4"
|
||||
@ -105,14 +114,14 @@
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:282b4a7158a161508e442b0a1c24fcf771c66ada2c93921f4b8ddc6b0a5e0c9b"
|
||||
digest = "1:5fc6c317675b746d0c641b29aa0aab5fcb403c0d07afdbf0de86b0d447a0502a"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = ["googleapis/rpc/status"]
|
||||
pruneopts = ""
|
||||
revision = "2a72893556e4d1f6c795a4c039314c9fa751eedb"
|
||||
revision = "bd91e49a0898e27abb88c339b432fa53d7497ac0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5f31b45ee9da7a87f140bef3ed0a7ca34ea2a6d38eb888123b8e28170e8aa4f2"
|
||||
digest = "1:1293087271e314cfa2b3decededba2ecba0ff327e7b7809e00f73f616449191c"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
@ -128,7 +137,9 @@
|
||||
"internal",
|
||||
"internal/backoff",
|
||||
"internal/channelz",
|
||||
"internal/envconfig",
|
||||
"internal/grpcrand",
|
||||
"internal/transport",
|
||||
"keepalive",
|
||||
"metadata",
|
||||
"naming",
|
||||
@ -139,14 +150,13 @@
|
||||
"stats",
|
||||
"status",
|
||||
"tap",
|
||||
"transport",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "168a6198bcb0ef175f7dacec0b8691fc141dc9b8"
|
||||
version = "v1.13.0"
|
||||
revision = "2e463a05d100327ca47ac218281906921038fd95"
|
||||
version = "v1.16.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:9b07c796baf391a2dfa8c64bd5ddc28cbeb00723389f2f3da2e3d09b961f2e31"
|
||||
digest = "1:66b0292f815d508d11ed5fe94fdeb0bcc5a988703a08e73bf3cb3a415de676cf"
|
||||
name = "k8s.io/apimachinery"
|
||||
packages = [
|
||||
"pkg/util/runtime",
|
||||
@ -154,11 +164,19 @@
|
||||
"pkg/util/wait",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "302974c03f7e50f16561ba237db776ab93594ef6"
|
||||
version = "kubernetes-1.10.0-beta.1"
|
||||
revision = "2b1284ed4c93a43499e781493253e2ac5959c4fd"
|
||||
version = "kubernetes-1.13.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:7107d2e83c67ac0dbd9b62e8e2bfe1a75b194864ea4fe30778f4842151cd356d"
|
||||
digest = "1:4f5eb833037cc0ba0bf8fe9cae6be9df62c19dd1c869415275c708daa8ccfda5"
|
||||
name = "k8s.io/klog"
|
||||
packages = ["."]
|
||||
pruneopts = ""
|
||||
revision = "a5bc97fbc634d635061f3146511332c7e313a55a"
|
||||
version = "v0.1.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a53c39a815a31aceb509f9987d7d8c65e74fcb1fcd5077eaf723a8defec1af90"
|
||||
name = "k8s.io/kubernetes"
|
||||
packages = [
|
||||
"pkg/util/file",
|
||||
@ -168,23 +186,24 @@
|
||||
"pkg/util/nsenter",
|
||||
]
|
||||
pruneopts = ""
|
||||
revision = "b1b29978270dc22fecc592ac55d903350454310a"
|
||||
version = "v1.11.1"
|
||||
revision = "ddf47ac13c1a9483ea035a79cd7c10005ff21a6d"
|
||||
version = "v1.13.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a0b7738ed2e717bbbe69bd9f86f2b038d7639e3704491d53696c06d5e84eda55"
|
||||
digest = "1:bea542e853f98bfcc80ecbe8fe0f32bc52c97664102aacdd7dca676354ef2faa"
|
||||
name = "k8s.io/utils"
|
||||
packages = ["exec"]
|
||||
pruneopts = ""
|
||||
revision = "66066c83e385e385ccc3c964b44fd7dcd413d0ed"
|
||||
revision = "0d26856f57b32ec3398579285e5c8a2bfe8c5243"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
input-imports = [
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0",
|
||||
"github.com/container-storage-interface/spec/lib/go/csi",
|
||||
"github.com/golang/glog",
|
||||
"github.com/golang/protobuf/ptypes/timestamp",
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common",
|
||||
"github.com/pborman/uuid",
|
||||
"github.com/pkg/errors",
|
||||
@ -195,6 +214,8 @@
|
||||
"k8s.io/apimachinery/pkg/util/wait",
|
||||
"k8s.io/kubernetes/pkg/util/keymutex",
|
||||
"k8s.io/kubernetes/pkg/util/mount",
|
||||
"k8s.io/kubernetes/pkg/util/nsenter",
|
||||
"k8s.io/utils/exec",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
@ -1,6 +1,6 @@
|
||||
[[constraint]]
|
||||
name = "github.com/container-storage-interface/spec"
|
||||
version = "~0.3.0"
|
||||
version = "~1.0.0"
|
||||
|
||||
[[constraint]]
|
||||
branch = "master"
|
||||
@ -19,15 +19,15 @@
|
||||
version = "1.10.0"
|
||||
|
||||
[[constraint]]
|
||||
version = "kubernetes-1.10.0-beta.1"
|
||||
version = "kubernetes-1.13.0"
|
||||
name = "k8s.io/apimachinery"
|
||||
|
||||
[[constraint]]
|
||||
name = "k8s.io/kubernetes"
|
||||
version = "v1.10.0-beta.1"
|
||||
version = "v1.13.0"
|
||||
|
||||
[[override]]
|
||||
version = "kubernetes-1.10.0-beta.1"
|
||||
version = "kubernetes-1.13.0"
|
||||
name = "k8s.io/api"
|
||||
|
||||
[[override]]
|
||||
|
4
Makefile
4
Makefile
@ -15,10 +15,10 @@
|
||||
.PHONY: all rbdplugin cephfsplugin
|
||||
|
||||
RBD_IMAGE_NAME=$(if $(ENV_RBD_IMAGE_NAME),$(ENV_RBD_IMAGE_NAME),quay.io/cephcsi/rbdplugin)
|
||||
RBD_IMAGE_VERSION=$(if $(ENV_RBD_IMAGE_VERSION),$(ENV_RBD_IMAGE_VERSION),v0.3.0)
|
||||
RBD_IMAGE_VERSION=$(if $(ENV_RBD_IMAGE_VERSION),$(ENV_RBD_IMAGE_VERSION),v1.0.0)
|
||||
|
||||
CEPHFS_IMAGE_NAME=$(if $(ENV_CEPHFS_IMAGE_NAME),$(ENV_CEPHFS_IMAGE_NAME),quay.io/cephcsi/cephfsplugin)
|
||||
CEPHFS_IMAGE_VERSION=$(if $(ENV_CEPHFS_IMAGE_VERSION),$(ENV_CEPHFS_IMAGE_VERSION),v0.3.0)
|
||||
CEPHFS_IMAGE_VERSION=$(if $(ENV_CEPHFS_IMAGE_VERSION),$(ENV_CEPHFS_IMAGE_VERSION),v1.0.0)
|
||||
|
||||
$(info rbd image settings: $(RBD_IMAGE_NAME) version $(RBD_IMAGE_VERSION))
|
||||
$(info cephfs image settings: $(CEPHFS_IMAGE_NAME) version $(CEPHFS_IMAGE_VERSION))
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Ceph CSI 0.3.0
|
||||
# Ceph CSI 1.0.0
|
||||
|
||||
[Container Storage Interface (CSI)](https://github.com/container-storage-interface/) driver, provisioner, and attacher for Ceph RBD and CephFS.
|
||||
|
||||
|
@ -27,19 +27,19 @@ spec:
|
||||
serviceAccount: csi-attacher
|
||||
containers:
|
||||
- name: csi-cephfsplugin-attacher
|
||||
image: quay.io/k8scsi/csi-attacher:v0.3.0
|
||||
image: quay.io/k8scsi/csi-attacher:v1.0.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
type: DirectoryOrCreate
|
||||
|
@ -27,20 +27,20 @@ spec:
|
||||
serviceAccount: csi-provisioner
|
||||
containers:
|
||||
- name: csi-provisioner
|
||||
image: quay.io/k8scsi/csi-provisioner:v0.3.0
|
||||
image: quay.io/k8scsi/csi-provisioner:v1.0.0
|
||||
args:
|
||||
- "--provisioner=csi-cephfsplugin"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--v=5"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
type: DirectoryOrCreate
|
||||
|
@ -18,23 +18,23 @@ spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: quay.io/k8scsi/driver-registrar:v0.3.0
|
||||
image: quay.io/k8scsi/driver-registrar:v1.0.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock
|
||||
- name: DRIVER_REG_SOCK_PATH
|
||||
value: /var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock
|
||||
- name: KUBE_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
- name: registration-dir
|
||||
mountPath: /registration
|
||||
- name: csi-cephfsplugin
|
||||
@ -43,7 +43,7 @@ spec:
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
allowPrivilegeEscalation: true
|
||||
image: quay.io/cephcsi/cephfsplugin:v0.3.0
|
||||
image: quay.io/cephcsi/cephfsplugin:v1.0.0
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
@ -55,11 +55,11 @@ spec:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix://var/lib/kubelet/plugins/csi-cephfsplugin/csi.sock
|
||||
value: unix://var/lib/kubelet/plugins_registry/csi-cephfsplugin/csi.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
- name: pods-mount-dir
|
||||
mountPath: /var/lib/kubelet/pods
|
||||
mountPropagation: "Bidirectional"
|
||||
@ -73,11 +73,11 @@ spec:
|
||||
volumes:
|
||||
- name: plugin-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
type: DirectoryOrCreate
|
||||
- name: registration-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/
|
||||
path: /var/lib/kubelet/plugins_registry/
|
||||
type: Directory
|
||||
- name: pods-mount-dir
|
||||
hostPath:
|
||||
@ -85,7 +85,7 @@ spec:
|
||||
type: Directory
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-cephfsplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-cephfsplugin
|
||||
type: DirectoryOrCreate
|
||||
- name: host-sys
|
||||
hostPath:
|
||||
|
@ -27,19 +27,19 @@ spec:
|
||||
serviceAccount: csi-attacher
|
||||
containers:
|
||||
- name: csi-rbdplugin-attacher
|
||||
image: quay.io/k8scsi/csi-attacher:v0.3.0
|
||||
image: quay.io/k8scsi/csi-attacher:v1.0.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
type: DirectoryOrCreate
|
||||
|
@ -27,20 +27,20 @@ spec:
|
||||
serviceAccount: csi-provisioner
|
||||
containers:
|
||||
- name: csi-provisioner
|
||||
image: quay.io/k8scsi/csi-provisioner:v0.3.0
|
||||
image: quay.io/k8scsi/csi-provisioner:v1.0.0
|
||||
args:
|
||||
- "--provisioner=csi-rbdplugin"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--v=5"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
volumes:
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
type: DirectoryOrCreate
|
||||
|
@ -19,23 +19,23 @@ spec:
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
containers:
|
||||
- name: driver-registrar
|
||||
image: quay.io/k8scsi/driver-registrar:v0.3.0
|
||||
image: quay.io/k8scsi/driver-registrar:v1.0.0
|
||||
args:
|
||||
- "--v=5"
|
||||
- "--csi-address=$(ADDRESS)"
|
||||
- "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)"
|
||||
env:
|
||||
- name: ADDRESS
|
||||
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
|
||||
- name: DRIVER_REG_SOCK_PATH
|
||||
value: /var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
|
||||
value: /var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
|
||||
- name: KUBE_NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
volumeMounts:
|
||||
- name: socket-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
- name: registration-dir
|
||||
mountPath: /registration
|
||||
- name: csi-rbdplugin
|
||||
@ -44,7 +44,7 @@ spec:
|
||||
capabilities:
|
||||
add: ["SYS_ADMIN"]
|
||||
allowPrivilegeEscalation: true
|
||||
image: quay.io/cephcsi/rbdplugin:v0.3.0
|
||||
image: quay.io/cephcsi/rbdplugin:v1.0.0
|
||||
args :
|
||||
- "--nodeid=$(NODE_ID)"
|
||||
- "--endpoint=$(CSI_ENDPOINT)"
|
||||
@ -59,11 +59,11 @@ spec:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
- name: CSI_ENDPOINT
|
||||
value: unix://var/lib/kubelet/plugins/csi-rbdplugin/csi.sock
|
||||
value: unix://var/lib/kubelet/plugins_registry/csi-rbdplugin/csi.sock
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
volumeMounts:
|
||||
- name: plugin-dir
|
||||
mountPath: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
mountPath: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
- name: pods-mount-dir
|
||||
mountPath: /var/lib/kubelet/pods
|
||||
mountPropagation: "Bidirectional"
|
||||
@ -79,11 +79,11 @@ spec:
|
||||
volumes:
|
||||
- name: plugin-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
type: DirectoryOrCreate
|
||||
- name: registration-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/
|
||||
path: /var/lib/kubelet/plugins_registry/
|
||||
type: Directory
|
||||
- name: pods-mount-dir
|
||||
hostPath:
|
||||
@ -91,7 +91,7 @@ spec:
|
||||
type: Directory
|
||||
- name: socket-dir
|
||||
hostPath:
|
||||
path: /var/lib/kubelet/plugins/csi-rbdplugin
|
||||
path: /var/lib/kubelet/plugins_registry/csi-rbdplugin
|
||||
type: DirectoryOrCreate
|
||||
- name: host-dev
|
||||
hostPath:
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
@ -37,14 +37,13 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
}
|
||||
|
||||
// Configuration
|
||||
|
||||
volOptions, err := newVolumeOptions(req.GetParameters())
|
||||
if err != nil {
|
||||
glog.Errorf("validation of volume options failed: %v", err)
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
|
||||
volId := newVolumeID()
|
||||
volId := makeVolumeID(req.GetName())
|
||||
|
||||
conf := cephConfigData{Monitors: volOptions.Monitors, VolumeID: volId}
|
||||
if err = conf.writeToFile(); err != nil {
|
||||
@ -57,7 +56,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
if volOptions.ProvisionVolume {
|
||||
// Admin credentials are required
|
||||
|
||||
cr, err := getAdminCredentials(req.GetControllerCreateSecrets())
|
||||
cr, err := getAdminCredentials(req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
}
|
||||
@ -89,9 +88,9 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
|
||||
return &csi.CreateVolumeResponse{
|
||||
Volume: &csi.Volume{
|
||||
Id: string(volId),
|
||||
VolumeId: string(volId),
|
||||
CapacityBytes: req.GetCapacityRange().GetRequiredBytes(),
|
||||
Attributes: req.GetParameters(),
|
||||
VolumeContext: req.GetParameters(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -133,7 +132,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
|
||||
// Deleting a volume requires admin credentials
|
||||
|
||||
cr, err := getAdminCredentials(req.GetControllerDeleteSecrets())
|
||||
cr, err := getAdminCredentials(req.GetSecrets())
|
||||
if err != nil {
|
||||
glog.Errorf("failed to retrieve admin credentials: %v", err)
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
@ -160,8 +159,12 @@ func (cs *controllerServer) ValidateVolumeCapabilities(
|
||||
// Cephfs doesn't support Block volume
|
||||
for _, cap := range req.VolumeCapabilities {
|
||||
if cap.GetBlock() != nil {
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Supported: false, Message: ""}, nil
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil
|
||||
}
|
||||
}
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Supported: true}, nil
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{
|
||||
Confirmed: &csi.ValidateVolumeCapabilitiesResponse_Confirmed{
|
||||
VolumeCapabilities: req.VolumeCapabilities,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
const (
|
||||
PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin"
|
||||
Version = "0.3.0"
|
||||
PluginFolder = "/var/lib/kubelet/plugins_registry/csi-cephfsplugin"
|
||||
Version = "1.0.0"
|
||||
)
|
||||
|
||||
type cephfsDriver struct {
|
||||
|
@ -19,7 +19,7 @@ package cephfs
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
@ -44,7 +44,7 @@ func getCredentialsForVolume(volOptions *volumeOptions, volId volumeID, req *csi
|
||||
|
||||
// First, store admin credentials - those are needed for retrieving the user credentials
|
||||
|
||||
adminCr, err := getAdminCredentials(req.GetNodeStageSecrets())
|
||||
adminCr, err := getAdminCredentials(req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get admin credentials from node stage secrets: %v", err)
|
||||
}
|
||||
@ -64,7 +64,7 @@ func getCredentialsForVolume(volOptions *volumeOptions, volId volumeID, req *csi
|
||||
} else {
|
||||
// The volume is pre-made, credentials are in node stage secrets
|
||||
|
||||
userCr, err = getUserCredentials(req.GetNodeStageSecrets())
|
||||
userCr, err = getUserCredentials(req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get user credentials from node stage secrets: %v", err)
|
||||
}
|
||||
@ -87,7 +87,7 @@ func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
|
||||
stagingTargetPath := req.GetStagingTargetPath()
|
||||
volId := volumeID(req.GetVolumeId())
|
||||
|
||||
volOptions, err := newVolumeOptions(req.GetVolumeAttributes())
|
||||
volOptions, err := newVolumeOptions(req.GetVolumeContext())
|
||||
if err != nil {
|
||||
glog.Errorf("error reading volume options for volume %s: %v", volId, err)
|
||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||
|
@ -26,15 +26,14 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/pborman/uuid"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
)
|
||||
|
||||
type volumeID string
|
||||
|
||||
func newVolumeID() volumeID {
|
||||
return volumeID("csi-cephfs-" + uuid.NewUUID().String())
|
||||
func makeVolumeID(volName string) volumeID {
|
||||
return volumeID("csi-cephfs-" + volName)
|
||||
}
|
||||
|
||||
func execCommand(command string, args ...string) ([]byte, error) {
|
||||
@ -144,7 +143,7 @@ func validateNodeStageVolumeRequest(req *csi.NodeStageVolumeRequest) error {
|
||||
return fmt.Errorf("staging target path missing in request")
|
||||
}
|
||||
|
||||
if req.GetNodeStageSecrets() == nil || len(req.GetNodeStageSecrets()) == 0 {
|
||||
if req.GetSecrets() == nil || len(req.GetSecrets()) == 0 {
|
||||
return fmt.Errorf("stage secrets cannot be nil or empty")
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,9 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/golang/glog"
|
||||
"github.com/golang/protobuf/ptypes/timestamp"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
"github.com/pborman/uuid"
|
||||
"github.com/pkg/errors"
|
||||
@ -69,9 +70,9 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
// TODO (sbezverk) Do I need to make sure that RBD volume still exists?
|
||||
return &csi.CreateVolumeResponse{
|
||||
Volume: &csi.Volume{
|
||||
Id: exVol.VolID,
|
||||
VolumeId: exVol.VolID,
|
||||
CapacityBytes: int64(exVol.VolSize),
|
||||
Attributes: req.GetParameters(),
|
||||
VolumeContext: req.GetParameters(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -103,7 +104,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
volSizeGB := int(volSizeBytes / 1024 / 1024 / 1024)
|
||||
|
||||
// Check if there is already RBD image with requested name
|
||||
found, _, _ := rbdStatus(rbdVol, rbdVol.UserId, req.GetControllerCreateSecrets())
|
||||
found, _, _ := rbdStatus(rbdVol, rbdVol.UserId, req.GetSecrets())
|
||||
if !found {
|
||||
// if VolumeContentSource is not nil, this request is for snapshot
|
||||
if req.VolumeContentSource != nil {
|
||||
@ -112,7 +113,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
return nil, status.Error(codes.InvalidArgument, "Volume Snapshot cannot be empty")
|
||||
}
|
||||
|
||||
snapshotID := snapshot.GetId()
|
||||
snapshotID := snapshot.GetSnapshotId()
|
||||
if len(snapshotID) == 0 {
|
||||
return nil, status.Error(codes.InvalidArgument, "Volume Snapshot ID cannot be empty")
|
||||
}
|
||||
@ -122,13 +123,13 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = restoreSnapshot(rbdVol, rbdSnap, rbdVol.AdminId, req.GetControllerCreateSecrets())
|
||||
err = restoreSnapshot(rbdVol, rbdSnap, rbdVol.AdminId, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
glog.V(4).Infof("create volume %s from snapshot %s", volName, rbdSnap.SnapName)
|
||||
} else {
|
||||
if err := createRBDImage(rbdVol, volSizeGB, rbdVol.AdminId, req.GetControllerCreateSecrets()); err != nil {
|
||||
if err := createRBDImage(rbdVol, volSizeGB, rbdVol.AdminId, req.GetSecrets()); err != nil {
|
||||
if err != nil {
|
||||
glog.Warningf("failed to create volume: %v", err)
|
||||
return nil, err
|
||||
@ -145,9 +146,9 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
||||
rbdVolumes[volumeID] = rbdVol
|
||||
return &csi.CreateVolumeResponse{
|
||||
Volume: &csi.Volume{
|
||||
Id: volumeID,
|
||||
VolumeId: volumeID,
|
||||
CapacityBytes: int64(volSizeBytes),
|
||||
Attributes: req.GetParameters(),
|
||||
VolumeContext: req.GetParameters(),
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -172,7 +173,7 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
volName := rbdVol.VolName
|
||||
// Deleting rbd image
|
||||
glog.V(4).Infof("deleting volume %s", volName)
|
||||
if err := deleteRBDImage(rbdVol, rbdVol.AdminId, req.GetControllerDeleteSecrets()); err != nil {
|
||||
if err := deleteRBDImage(rbdVol, rbdVol.AdminId, req.GetSecrets()); err != nil {
|
||||
// TODO: can we detect "already deleted" situations here and proceed?
|
||||
glog.V(3).Infof("failed to delete rbd image: %s/%s with error: %v", rbdVol.Pool, volName, err)
|
||||
return nil, err
|
||||
@ -189,10 +190,14 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
|
||||
func (cs *controllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
|
||||
for _, cap := range req.VolumeCapabilities {
|
||||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Supported: false, Message: ""}, nil
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil
|
||||
}
|
||||
}
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{Supported: true, Message: ""}, nil
|
||||
return &csi.ValidateVolumeCapabilitiesResponse{
|
||||
Confirmed: &csi.ValidateVolumeCapabilitiesResponse_Confirmed{
|
||||
VolumeCapabilities: req.VolumeCapabilities,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (cs *controllerServer) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
|
||||
@ -227,12 +232,12 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
return &csi.CreateSnapshotResponse{
|
||||
Snapshot: &csi.Snapshot{
|
||||
SizeBytes: exSnap.SizeBytes,
|
||||
Id: exSnap.SnapID,
|
||||
SnapshotId: exSnap.SnapID,
|
||||
SourceVolumeId: exSnap.SourceVolumeID,
|
||||
CreatedAt: exSnap.CreatedAt,
|
||||
Status: &csi.SnapshotStatus{
|
||||
Type: csi.SnapshotStatus_READY,
|
||||
CreationTime: ×tamp.Timestamp{
|
||||
Seconds: exSnap.CreatedAt,
|
||||
},
|
||||
ReadyToUse: true,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -262,7 +267,7 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
rbdSnap.SourceVolumeID = req.GetSourceVolumeId()
|
||||
rbdSnap.SizeBytes = rbdVolume.VolSize
|
||||
|
||||
err = createSnapshot(rbdSnap, rbdSnap.AdminId, req.GetCreateSnapshotSecrets())
|
||||
err = createSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
// if we already have the snapshot, return the snapshot
|
||||
if err != nil {
|
||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
||||
@ -283,10 +288,10 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
}
|
||||
} else {
|
||||
glog.V(4).Infof("create snapshot %s", snapName)
|
||||
err = protectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetCreateSnapshotSecrets())
|
||||
err = protectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
|
||||
if err != nil {
|
||||
err = deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetCreateSnapshotSecrets())
|
||||
err = deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("snapshot is created but failed to protect and delete snapshot: %v", err)
|
||||
}
|
||||
@ -301,14 +306,14 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
glog.Warningf("rbd: failed to store snapInfo with error: %v", err)
|
||||
|
||||
// Unprotect snapshot
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetCreateSnapshotSecrets())
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Unknown, fmt.Sprintf("This Snapshot should be removed but failed to unprotect snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err))
|
||||
}
|
||||
|
||||
// Deleting snapshot
|
||||
glog.V(4).Infof("deleting Snaphot %s", rbdSnap.SnapName)
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetCreateSnapshotSecrets()); err != nil {
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets()); err != nil {
|
||||
return nil, status.Error(codes.Unknown, fmt.Sprintf("This Snapshot should be removed but failed to delete snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err))
|
||||
}
|
||||
|
||||
@ -318,12 +323,12 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
|
||||
return &csi.CreateSnapshotResponse{
|
||||
Snapshot: &csi.Snapshot{
|
||||
SizeBytes: rbdSnap.SizeBytes,
|
||||
Id: snapshotID,
|
||||
SnapshotId: snapshotID,
|
||||
SourceVolumeId: req.GetSourceVolumeId(),
|
||||
CreatedAt: rbdSnap.CreatedAt,
|
||||
Status: &csi.SnapshotStatus{
|
||||
Type: csi.SnapshotStatus_READY,
|
||||
CreationTime: ×tamp.Timestamp{
|
||||
Seconds: rbdSnap.CreatedAt,
|
||||
},
|
||||
ReadyToUse: true,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@ -347,14 +352,14 @@ func (cs *controllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteS
|
||||
}
|
||||
|
||||
// Unprotect snapshot
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetDeleteSnapshotSecrets())
|
||||
err := unprotectSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.FailedPrecondition, fmt.Sprintf("failed to unprotect snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err))
|
||||
}
|
||||
|
||||
// Deleting snapshot
|
||||
glog.V(4).Infof("deleting Snaphot %s", rbdSnap.SnapName)
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetDeleteSnapshotSecrets()); err != nil {
|
||||
if err := deleteSnapshot(rbdSnap, rbdSnap.AdminId, req.GetSecrets()); err != nil {
|
||||
return nil, status.Error(codes.FailedPrecondition, fmt.Sprintf("failed to delete snapshot: %s/%s with error: %v", rbdSnap.Pool, rbdSnap.SnapName, err))
|
||||
}
|
||||
|
||||
@ -391,12 +396,12 @@ func (cs *controllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnap
|
||||
{
|
||||
Snapshot: &csi.Snapshot{
|
||||
SizeBytes: rbdSnap.SizeBytes,
|
||||
Id: rbdSnap.SnapID,
|
||||
SnapshotId: rbdSnap.SnapID,
|
||||
SourceVolumeId: rbdSnap.SourceVolumeID,
|
||||
CreatedAt: rbdSnap.CreatedAt,
|
||||
Status: &csi.SnapshotStatus{
|
||||
Type: csi.SnapshotStatus_READY,
|
||||
CreationTime: ×tamp.Timestamp{
|
||||
Seconds: rbdSnap.CreatedAt,
|
||||
},
|
||||
ReadyToUse: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -415,12 +420,12 @@ func (cs *controllerServer) ListSnapshots(ctx context.Context, req *csi.ListSnap
|
||||
entries = append(entries, &csi.ListSnapshotsResponse_Entry{
|
||||
Snapshot: &csi.Snapshot{
|
||||
SizeBytes: rbdSnap.SizeBytes,
|
||||
Id: rbdSnap.SnapID,
|
||||
SnapshotId: rbdSnap.SnapID,
|
||||
SourceVolumeId: rbdSnap.SourceVolumeID,
|
||||
CreatedAt: rbdSnap.CreatedAt,
|
||||
Status: &csi.SnapshotStatus{
|
||||
Type: csi.SnapshotStatus_READY,
|
||||
CreationTime: ×tamp.Timestamp{
|
||||
Seconds: rbdSnap.CreatedAt,
|
||||
},
|
||||
ReadyToUse: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ package rbd
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
)
|
||||
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
@ -65,13 +65,13 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
if !notMnt {
|
||||
return &csi.NodePublishVolumeResponse{}, nil
|
||||
}
|
||||
volOptions, err := getRBDVolumeOptions(req.VolumeAttributes)
|
||||
volOptions, err := getRBDVolumeOptions(req.GetVolumeContext())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
volOptions.VolName = volName
|
||||
// Mapping RBD image
|
||||
devicePath, err := attachRBDImage(volOptions, volOptions.UserId, req.GetNodePublishSecrets())
|
||||
devicePath, err := attachRBDImage(volOptions, volOptions.UserId, req.GetSecrets())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -79,7 +79,7 @@ func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
fsType := req.GetVolumeCapability().GetMount().GetFsType()
|
||||
|
||||
readOnly := req.GetReadonly()
|
||||
attrib := req.GetVolumeAttributes()
|
||||
attrib := req.GetVolumeContext()
|
||||
mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()
|
||||
|
||||
glog.V(4).Infof("target %v\nfstype %v\ndevice %v\nreadonly %v\nattributes %v\n mountflags %v\n",
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
|
||||
"github.com/golang/glog"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi/v0"
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/kubernetes-csi/drivers/pkg/csi-common"
|
||||
|
||||
"k8s.io/kubernetes/pkg/util/mount"
|
||||
@ -35,7 +35,7 @@ import (
|
||||
|
||||
// PluginFolder defines the location of rbdplugin
|
||||
const (
|
||||
PluginFolder = "/var/lib/kubelet/plugins/csi-rbdplugin"
|
||||
PluginFolder = "/var/lib/kubelet/plugins_registry/csi-rbdplugin"
|
||||
rbdDefaultAdminId = "admin"
|
||||
rbdDefaultUserId = rbdDefaultAdminId
|
||||
)
|
||||
@ -53,7 +53,7 @@ type rbd struct {
|
||||
|
||||
var (
|
||||
rbdDriver *rbd
|
||||
version = "0.3.0"
|
||||
version = "1.0.0"
|
||||
)
|
||||
|
||||
var rbdVolumes map[string]*rbdVolume
|
||||
@ -101,7 +101,7 @@ func loadExSnapshots() {
|
||||
}
|
||||
fp, err := os.Open(path.Join(PluginFolder, "controller-snap", f.Name()))
|
||||
if err != nil {
|
||||
glog.Infof("rbd: open file: %s err %%v", f.Name(), err)
|
||||
glog.Infof("rbd: open file: %s err %v", f.Name(), err)
|
||||
continue
|
||||
}
|
||||
decoder := json.NewDecoder(fp)
|
||||
@ -130,7 +130,7 @@ func loadExVolumes() {
|
||||
}
|
||||
fp, err := os.Open(path.Join(PluginFolder, "controller", f.Name()))
|
||||
if err != nil {
|
||||
glog.Infof("rbd: open file: %s err %%v", f.Name(), err)
|
||||
glog.Infof("rbd: open file: %s err %v", f.Name(), err)
|
||||
continue
|
||||
}
|
||||
decoder := json.NewDecoder(fp)
|
||||
@ -196,7 +196,7 @@ func (rbd *rbd) Run(driverName, nodeID, endpoint string, containerized bool) {
|
||||
rbd.ids = NewIdentityServer(rbd.driver)
|
||||
rbd.ns, err = NewNodeServer(rbd.driver, containerized)
|
||||
if err != nil {
|
||||
glog.Fatalln("failed to start node server, err %v", err)
|
||||
glog.Fatalf("failed to start node server, err %v\n", err)
|
||||
}
|
||||
rbd.cs = NewControllerServer(rbd.driver)
|
||||
s := csicommon.NewNonBlockingGRPCServer()
|
||||
|
@ -76,17 +76,17 @@ type rbdSnapshot struct {
|
||||
|
||||
var (
|
||||
// serializes operations based on "<rbd pool>/<rbd image>" as key
|
||||
attachdetachMutex = keymutex.NewKeyMutex()
|
||||
attachdetachMutex = keymutex.NewHashed(0)
|
||||
// serializes operations based on "volume name" as key
|
||||
volumeNameMutex = keymutex.NewKeyMutex()
|
||||
volumeNameMutex = keymutex.NewHashed(0)
|
||||
// serializes operations based on "volume id" as key
|
||||
volumeIDMutex = keymutex.NewKeyMutex()
|
||||
volumeIDMutex = keymutex.NewHashed(0)
|
||||
// serializes operations based on "snapshot name" as key
|
||||
snapshotNameMutex = keymutex.NewKeyMutex()
|
||||
snapshotNameMutex = keymutex.NewHashed(0)
|
||||
// serializes operations based on "snapshot id" as key
|
||||
snapshotIDMutex = keymutex.NewKeyMutex()
|
||||
snapshotIDMutex = keymutex.NewHashed(0)
|
||||
// serializes operations based on "mount target path" as key
|
||||
targetPathMutex = keymutex.NewKeyMutex()
|
||||
targetPathMutex = keymutex.NewHashed(0)
|
||||
|
||||
supportedFeatures = sets.NewString("layering")
|
||||
)
|
||||
|
1
vendor/github.com/container-storage-interface/spec/.gitignore
generated
vendored
1
vendor/github.com/container-storage-interface/spec/.gitignore
generated
vendored
@ -1,3 +1,4 @@
|
||||
*.tmp
|
||||
.DS_Store
|
||||
.build
|
||||
*.swp
|
||||
|
2
vendor/github.com/container-storage-interface/spec/.travis.yml
generated
vendored
2
vendor/github.com/container-storage-interface/spec/.travis.yml
generated
vendored
@ -29,7 +29,7 @@ jobs:
|
||||
# Lang stage: Go
|
||||
- stage: lang
|
||||
language: go
|
||||
go: 1.9.5
|
||||
go: 1.10.4
|
||||
go_import_path: github.com/container-storage-interface/spec
|
||||
install:
|
||||
- make -C lib/go protoc
|
||||
|
BIN
vendor/github.com/container-storage-interface/spec/CCLA.pdf
generated
vendored
Normal file
BIN
vendor/github.com/container-storage-interface/spec/CCLA.pdf
generated
vendored
Normal file
Binary file not shown.
3
vendor/github.com/container-storage-interface/spec/CONTRIBUTING.md
generated
vendored
3
vendor/github.com/container-storage-interface/spec/CONTRIBUTING.md
generated
vendored
@ -1,6 +1,9 @@
|
||||
# How to Contribute
|
||||
|
||||
CSI is under [Apache 2.0](LICENSE) and accepts contributions via GitHub pull requests.
|
||||
|
||||
Contributions require signing an individual or Corporate CLA available [here](https://github.com/container-storage-interface/spec/blob/master/CCLA.pdf) which should be signed and mailed to the [mailing list]( https://groups.google.com/forum/#!topic/container-storage-interface-community/).
|
||||
|
||||
This document outlines some of the conventions on development workflow, commit message formatting, contact points and other resources to make it easier to get your contribution accepted.
|
||||
|
||||
## Markdown style
|
||||
|
4
vendor/github.com/container-storage-interface/spec/OWNERS
generated
vendored
4
vendor/github.com/container-storage-interface/spec/OWNERS
generated
vendored
@ -3,8 +3,8 @@ approvers:
|
||||
- thockin # Representing Kubernetes
|
||||
- jieyu # Representing Mesos
|
||||
- jdef # Representing Mesos
|
||||
- cpuguy83 # Representing Docker
|
||||
- mycure # Representing Docker
|
||||
- anusha-ragunathan # Representing Docker
|
||||
- ddebroy # Representing Docker
|
||||
- julian-hj # Representing Cloud Foundry
|
||||
- paulcwarren # Representing Cloud Foundry
|
||||
reviewers:
|
||||
|
2
vendor/github.com/container-storage-interface/spec/README.md
generated
vendored
2
vendor/github.com/container-storage-interface/spec/README.md
generated
vendored
@ -8,6 +8,6 @@ This project contains the CSI [specification](spec.md) and [protobuf](csi.proto)
|
||||
|
||||
### Container Orchestrators (CO)
|
||||
|
||||
* [Cloud Foundry](https://github.com/cloudfoundry/csi-local-volume-release)
|
||||
* [Cloud Foundry](https://github.com/cloudfoundry/csi-plugins-release/blob/master/CSI_SUPPORT.md)
|
||||
* [Kubernetes](https://kubernetes-csi.github.io/docs/)
|
||||
* [Mesos](http://mesos.apache.org/documentation/latest/csi/)
|
||||
|
2
vendor/github.com/container-storage-interface/spec/VERSION
generated
vendored
2
vendor/github.com/container-storage-interface/spec/VERSION
generated
vendored
@ -1 +1 @@
|
||||
0.3.0
|
||||
1.0.0
|
||||
|
480
vendor/github.com/container-storage-interface/spec/csi.proto
generated
vendored
480
vendor/github.com/container-storage-interface/spec/csi.proto
generated
vendored
@ -1,10 +1,18 @@
|
||||
// Code generated by make; DO NOT EDIT.
|
||||
syntax = "proto3";
|
||||
package csi.v0;
|
||||
package csi.v1;
|
||||
|
||||
import "google/protobuf/descriptor.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
option go_package = "csi";
|
||||
|
||||
extend google.protobuf.FieldOptions {
|
||||
// Indicates that a field MAY contain information that is sensitive
|
||||
// and MUST be treated as such (e.g. not logged).
|
||||
bool csi_secret = 1059;
|
||||
}
|
||||
service Identity {
|
||||
rpc GetPluginInfo(GetPluginInfoRequest)
|
||||
returns (GetPluginInfoResponse) {}
|
||||
@ -64,20 +72,12 @@ service Node {
|
||||
rpc NodeUnpublishVolume (NodeUnpublishVolumeRequest)
|
||||
returns (NodeUnpublishVolumeResponse) {}
|
||||
|
||||
// NodeGetId is being deprecated in favor of NodeGetInfo and will be
|
||||
// removed in CSI 1.0. Existing drivers, however, may depend on this
|
||||
// RPC call and hence this RPC call MUST be implemented by the CSI
|
||||
// plugin prior to v1.0.
|
||||
rpc NodeGetId (NodeGetIdRequest)
|
||||
returns (NodeGetIdResponse) {
|
||||
option deprecated = true;
|
||||
}
|
||||
rpc NodeGetVolumeStats (NodeGetVolumeStatsRequest)
|
||||
returns (NodeGetVolumeStatsResponse) {}
|
||||
|
||||
rpc NodeGetCapabilities (NodeGetCapabilitiesRequest)
|
||||
returns (NodeGetCapabilitiesResponse) {}
|
||||
|
||||
// Prior to CSI 1.0 - CSI plugins MUST implement both NodeGetId and
|
||||
// NodeGetInfo RPC calls.
|
||||
rpc NodeGetInfo (NodeGetInfoRequest)
|
||||
returns (NodeGetInfoResponse) {}
|
||||
}
|
||||
@ -86,13 +86,13 @@ message GetPluginInfoRequest {
|
||||
}
|
||||
|
||||
message GetPluginInfoResponse {
|
||||
// The name MUST follow reverse domain name notation format
|
||||
// (https://en.wikipedia.org/wiki/Reverse_domain_name_notation).
|
||||
// It SHOULD include the plugin's host company name and the plugin
|
||||
// name, to minimize the possibility of collisions. It MUST be 63
|
||||
// The name MUST follow domain name notation format
|
||||
// (https://tools.ietf.org/html/rfc1035#section-2.3.1). It SHOULD
|
||||
// include the plugin's host company name and the plugin name,
|
||||
// to minimize the possibility of collisions. It MUST be 63
|
||||
// characters or less, beginning and ending with an alphanumeric
|
||||
// character ([a-z0-9A-Z]) with dashes (-), underscores (_),
|
||||
// dots (.), and alphanumerics between. This field is REQUIRED.
|
||||
// character ([a-z0-9A-Z]) with dashes (-), dots (.), and
|
||||
// alphanumerics between. This field is REQUIRED.
|
||||
string name = 1;
|
||||
|
||||
// This field is REQUIRED. Value of this field is opaque to the CO.
|
||||
@ -108,7 +108,7 @@ message GetPluginCapabilitiesRequest {
|
||||
message GetPluginCapabilitiesResponse {
|
||||
// All the capabilities that the controller service supports. This
|
||||
// field is OPTIONAL.
|
||||
repeated PluginCapability capabilities = 2;
|
||||
repeated PluginCapability capabilities = 1;
|
||||
}
|
||||
|
||||
// Specifies a capability of the plugin.
|
||||
@ -119,7 +119,7 @@ message PluginCapability {
|
||||
|
||||
// CONTROLLER_SERVICE indicates that the Plugin provides RPCs for
|
||||
// the ControllerService. Plugins SHOULD provide this capability.
|
||||
// In rare cases certain plugins may wish to omit the
|
||||
// In rare cases certain plugins MAY wish to omit the
|
||||
// ControllerService entirely from their implementation, but such
|
||||
// SHOULD NOT be the common case.
|
||||
// The presence of this capability determines whether the CO will
|
||||
@ -127,13 +127,13 @@ message PluginCapability {
|
||||
// as specific RPCs as indicated by ControllerGetCapabilities.
|
||||
CONTROLLER_SERVICE = 1;
|
||||
|
||||
// ACCESSIBILITY_CONSTRAINTS indicates that the volumes for this
|
||||
// plugin may not be equally accessible by all nodes in the
|
||||
// VOLUME_ACCESSIBILITY_CONSTRAINTS indicates that the volumes for
|
||||
// this plugin MAY NOT be equally accessible by all nodes in the
|
||||
// cluster. The CO MUST use the topology information returned by
|
||||
// CreateVolumeRequest along with the topology information
|
||||
// returned by NodeGetInfo to ensure that a given volume is
|
||||
// accessible from a given node when scheduling workloads.
|
||||
ACCESSIBILITY_CONSTRAINTS = 2;
|
||||
VOLUME_ACCESSIBILITY_CONSTRAINTS = 2;
|
||||
}
|
||||
Type type = 1;
|
||||
}
|
||||
@ -174,37 +174,53 @@ message CreateVolumeRequest {
|
||||
// The suggested name for the storage space. This field is REQUIRED.
|
||||
// It serves two purposes:
|
||||
// 1) Idempotency - This name is generated by the CO to achieve
|
||||
// idempotency. If `CreateVolume` fails, the volume may or may not
|
||||
// be provisioned. In this case, the CO may call `CreateVolume`
|
||||
// again, with the same name, to ensure the volume exists. The
|
||||
// Plugin should ensure that multiple `CreateVolume` calls for the
|
||||
// same name do not result in more than one piece of storage
|
||||
// provisioned corresponding to that name. If a Plugin is unable to
|
||||
// enforce idempotency, the CO's error recovery logic could result
|
||||
// in multiple (unused) volumes being provisioned.
|
||||
// idempotency. The Plugin SHOULD ensure that multiple
|
||||
// `CreateVolume` calls for the same name do not result in more
|
||||
// than one piece of storage provisioned corresponding to that
|
||||
// name. If a Plugin is unable to enforce idempotency, the CO's
|
||||
// error recovery logic could result in multiple (unused) volumes
|
||||
// being provisioned.
|
||||
// In the case of error, the CO MUST handle the gRPC error codes
|
||||
// per the recovery behavior defined in the "CreateVolume Errors"
|
||||
// section below.
|
||||
// The CO is responsible for cleaning up volumes it provisioned
|
||||
// that it no longer needs. If the CO is uncertain whether a volume
|
||||
// was provisioned or not when a `CreateVolume` call fails, the CO
|
||||
// MAY call `CreateVolume` again, with the same name, to ensure the
|
||||
// volume exists and to retrieve the volume's `volume_id` (unless
|
||||
// otherwise prohibited by "CreateVolume Errors").
|
||||
// 2) Suggested name - Some storage systems allow callers to specify
|
||||
// an identifier by which to refer to the newly provisioned
|
||||
// storage. If a storage system supports this, it can optionally
|
||||
// use this name as the identifier for the new volume.
|
||||
// Any Unicode string that conforms to the length limit is allowed
|
||||
// except those containing the following banned characters:
|
||||
// U+0000-U+0008, U+000B, U+000C, U+000E-U+001F, U+007F-U+009F.
|
||||
// (These are control characters other than commonly used whitespace.)
|
||||
string name = 1;
|
||||
|
||||
// This field is OPTIONAL. This allows the CO to specify the capacity
|
||||
// requirement of the volume to be provisioned. If not specified, the
|
||||
// Plugin MAY choose an implementation-defined capacity range. If
|
||||
// specified it MUST always be honored, even when creating volumes
|
||||
// from a source; which may force some backends to internally extend
|
||||
// from a source; which MAY force some backends to internally extend
|
||||
// the volume after creating it.
|
||||
|
||||
CapacityRange capacity_range = 2;
|
||||
|
||||
// The capabilities that the provisioned volume MUST have: the Plugin
|
||||
// MUST provision a volume that could satisfy ALL of the
|
||||
// capabilities specified in this list. The Plugin MUST assume that
|
||||
// the CO MAY use the provisioned volume later with ANY of the
|
||||
// capabilities specified in this list. This also enables the CO to do
|
||||
// early validation: if ANY of the specified volume capabilities are
|
||||
// not supported by the Plugin, the call SHALL fail. This field is
|
||||
// REQUIRED.
|
||||
// The capabilities that the provisioned volume MUST have. SP MUST
|
||||
// provision a volume that will satisfy ALL of the capabilities
|
||||
// specified in this list. Otherwise SP MUST return the appropriate
|
||||
// gRPC error code.
|
||||
// The Plugin MUST assume that the CO MAY use the provisioned volume
|
||||
// with ANY of the capabilities specified in this list.
|
||||
// For example, a CO MAY specify two volume capabilities: one with
|
||||
// access mode SINGLE_NODE_WRITER and another with access mode
|
||||
// MULTI_NODE_READER_ONLY. In this case, the SP MUST verify that the
|
||||
// provisioned volume can be used in either mode.
|
||||
// This also enables the CO to do early validation: If ANY of the
|
||||
// specified volume capabilities are not supported by the SP, the call
|
||||
// MUST return the appropriate gRPC error code.
|
||||
// This field is REQUIRED.
|
||||
repeated VolumeCapability volume_capabilities = 3;
|
||||
|
||||
// Plugin specific parameters passed in as opaque key-value pairs.
|
||||
@ -215,7 +231,7 @@ message CreateVolumeRequest {
|
||||
// Secrets required by plugin to complete volume creation request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> controller_create_secrets = 5;
|
||||
map<string, string> secrets = 5 [(csi_secret) = true];
|
||||
|
||||
// If specified, the new volume will be pre-populated with data from
|
||||
// this source. This field is OPTIONAL.
|
||||
@ -228,10 +244,10 @@ message CreateVolumeRequest {
|
||||
// topological accessibility information supported by the SP.
|
||||
// This field is OPTIONAL.
|
||||
// This field SHALL NOT be specified unless the SP has the
|
||||
// ACCESSIBILITY_CONSTRAINTS plugin capability.
|
||||
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability.
|
||||
// If this field is not specified and the SP has the
|
||||
// ACCESSIBILITY_CONSTRAINTS plugin capability, the SP MAY choose
|
||||
// where the provisioned volume is accessible from.
|
||||
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability, the SP MAY
|
||||
// choose where the provisioned volume is accessible from.
|
||||
TopologyRequirement accessibility_requirements = 7;
|
||||
}
|
||||
|
||||
@ -243,11 +259,19 @@ message VolumeContentSource {
|
||||
// This field is REQUIRED. Plugin is REQUIRED to support creating
|
||||
// volume from snapshot if it supports the capability
|
||||
// CREATE_DELETE_SNAPSHOT.
|
||||
string id = 1;
|
||||
string snapshot_id = 1;
|
||||
}
|
||||
|
||||
message VolumeSource {
|
||||
// Contains identity information for the existing source volume.
|
||||
// This field is REQUIRED. Plugins reporting CLONE_VOLUME
|
||||
// capability MUST support creating a volume from another volume.
|
||||
string volume_id = 1;
|
||||
}
|
||||
|
||||
oneof type {
|
||||
SnapshotSource snapshot = 1;
|
||||
VolumeSource volume = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +358,7 @@ message CapacityRange {
|
||||
int64 limit_bytes = 2;
|
||||
}
|
||||
|
||||
// The information about a provisioned volume.
|
||||
// Information about a specific volume.
|
||||
message Volume {
|
||||
// The capacity of the volume in bytes. This field is OPTIONAL. If not
|
||||
// set (value of 0), it indicates that the capacity of the volume is
|
||||
@ -342,20 +366,32 @@ message Volume {
|
||||
// The value of this field MUST NOT be negative.
|
||||
int64 capacity_bytes = 1;
|
||||
|
||||
// Contains identity information for the created volume. This field is
|
||||
// REQUIRED. The identity information will be used by the CO in
|
||||
// subsequent calls to refer to the provisioned volume.
|
||||
string id = 2;
|
||||
// The identifier for this volume, generated by the plugin.
|
||||
// This field is REQUIRED.
|
||||
// This field MUST contain enough information to uniquely identify
|
||||
// this specific volume vs all other volumes supported by this plugin.
|
||||
// This field SHALL be used by the CO in subsequent calls to refer to
|
||||
// this volume.
|
||||
// The SP is NOT responsible for global uniqueness of volume_id across
|
||||
// multiple SPs.
|
||||
string volume_id = 2;
|
||||
|
||||
// Attributes reflect static properties of a volume and MUST be passed
|
||||
// to volume validation and publishing calls.
|
||||
// Attributes SHALL be opaque to a CO. Attributes SHALL NOT be mutable
|
||||
// and SHALL be safe for the CO to cache. Attributes SHOULD NOT
|
||||
// contain sensitive information. Attributes MAY NOT uniquely identify
|
||||
// a volume. A volume uniquely identified by `id` SHALL always report
|
||||
// the same attributes. This field is OPTIONAL and when present MUST
|
||||
// be passed to volume validation and publishing calls.
|
||||
map<string, string> attributes = 3;
|
||||
// Opaque static properties of the volume. SP MAY use this field to
|
||||
// ensure subsequent volume validation and publishing calls have
|
||||
// contextual information.
|
||||
// The contents of this field SHALL be opaque to a CO.
|
||||
// The contents of this field SHALL NOT be mutable.
|
||||
// The contents of this field SHALL be safe for the CO to cache.
|
||||
// The contents of this field SHOULD NOT contain sensitive
|
||||
// information.
|
||||
// The contents of this field SHOULD NOT be used for uniquely
|
||||
// identifying a volume. The `volume_id` alone SHOULD be sufficient to
|
||||
// identify the volume.
|
||||
// A volume uniquely identified by `volume_id` SHALL always report the
|
||||
// same volume_context.
|
||||
// This field is OPTIONAL and when present MUST be passed to volume
|
||||
// validation and publishing calls.
|
||||
map<string, string> volume_context = 3;
|
||||
|
||||
// If specified, indicates that the volume is not empty and is
|
||||
// pre-populated with data from the specified source.
|
||||
@ -365,7 +401,7 @@ message Volume {
|
||||
// Specifies where (regions, zones, racks, etc.) the provisioned
|
||||
// volume is accessible from.
|
||||
// A plugin that returns this field MUST also set the
|
||||
// ACCESSIBILITY_CONSTRAINTS plugin capability.
|
||||
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability.
|
||||
// An SP MAY specify multiple topologies to indicate the volume is
|
||||
// accessible from multiple locations.
|
||||
// COs MAY use this information along with the topology information
|
||||
@ -373,7 +409,7 @@ message Volume {
|
||||
// from a given node when scheduling workloads.
|
||||
// This field is OPTIONAL. If it is not specified, the CO MAY assume
|
||||
// the volume is equally accessible from all nodes in the cluster and
|
||||
// may schedule workloads referencing the volume on any available
|
||||
// MAY schedule workloads referencing the volume on any available
|
||||
// node.
|
||||
//
|
||||
// Example 1:
|
||||
@ -527,15 +563,18 @@ message TopologyRequirement {
|
||||
// A topological segment is a specific instance of a topological domain,
|
||||
// like "zone3", "rack3", etc.
|
||||
// For example {"com.company/zone": "Z1", "com.company/rack": "R3"}
|
||||
// Valid keys have two segments: an optional prefix and name, separated
|
||||
// Valid keys have two segments: an OPTIONAL prefix and name, separated
|
||||
// by a slash (/), for example: "com.company.example/zone".
|
||||
// The key name segment is required. The prefix is optional.
|
||||
// Both the key name and the prefix MUST each be 63 characters or less,
|
||||
// begin and end with an alphanumeric character ([a-z0-9A-Z]) and
|
||||
// contain only dashes (-), underscores (_), dots (.), or alphanumerics
|
||||
// in between, for example "zone".
|
||||
// The key prefix MUST follow reverse domain name notation format
|
||||
// (https://en.wikipedia.org/wiki/Reverse_domain_name_notation).
|
||||
// The key name segment is REQUIRED. The prefix is OPTIONAL.
|
||||
// The key name MUST be 63 characters or less, begin and end with an
|
||||
// alphanumeric character ([a-z0-9A-Z]), and contain only dashes (-),
|
||||
// underscores (_), dots (.), or alphanumerics in between, for example
|
||||
// "zone".
|
||||
// The key prefix MUST be 63 characters or less, begin and end with a
|
||||
// lower-case alphanumeric character ([a-z0-9]), contain only
|
||||
// dashes (-), dots (.), or lower-case alphanumerics in between, and
|
||||
// follow domain name notation format
|
||||
// (https://tools.ietf.org/html/rfc1035#section-2.3.1).
|
||||
// The key prefix SHOULD include the plugin's host company name and/or
|
||||
// the plugin name, to minimize the possibility of collisions with keys
|
||||
// from other plugins.
|
||||
@ -558,7 +597,7 @@ message DeleteVolumeRequest {
|
||||
// Secrets required by plugin to complete volume deletion request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> controller_delete_secrets = 2;
|
||||
map<string, string> secrets = 2 [(csi_secret) = true];
|
||||
}
|
||||
|
||||
message DeleteVolumeResponse {
|
||||
@ -573,31 +612,44 @@ message ControllerPublishVolumeRequest {
|
||||
// field to match the node ID returned by `NodeGetInfo`.
|
||||
string node_id = 2;
|
||||
|
||||
// The capability of the volume the CO expects the volume to have.
|
||||
// Volume capability describing how the CO intends to use this volume.
|
||||
// SP MUST ensure the CO can use the published volume as described.
|
||||
// Otherwise SP MUST return the appropriate gRPC error code.
|
||||
// This is a REQUIRED field.
|
||||
VolumeCapability volume_capability = 3;
|
||||
|
||||
// Whether to publish the volume in readonly mode. This field is
|
||||
// REQUIRED.
|
||||
// Indicates SP MUST publish the volume in readonly mode.
|
||||
// CO MUST set this field to false if SP does not have the
|
||||
// PUBLISH_READONLY controller capability.
|
||||
// This is a REQUIRED field.
|
||||
bool readonly = 4;
|
||||
|
||||
// Secrets required by plugin to complete controller publish volume
|
||||
// request. This field is OPTIONAL. Refer to the
|
||||
// `Secrets Requirements` section on how to use this field.
|
||||
map<string, string> controller_publish_secrets = 5;
|
||||
map<string, string> secrets = 5 [(csi_secret) = true];
|
||||
|
||||
// Attributes of the volume to be used on a node. This field is
|
||||
// OPTIONAL and MUST match the attributes of the Volume identified
|
||||
// by `volume_id`.
|
||||
map<string, string> volume_attributes = 6;
|
||||
// Volume context as returned by CO in CreateVolumeRequest. This field
|
||||
// is OPTIONAL and MUST match the volume_context of the volume
|
||||
// identified by `volume_id`.
|
||||
map<string, string> volume_context = 6;
|
||||
}
|
||||
|
||||
message ControllerPublishVolumeResponse {
|
||||
// The SP specific information that will be passed to the Plugin in
|
||||
// the subsequent `NodeStageVolume` or `NodePublishVolume` calls
|
||||
// for the given volume.
|
||||
// This information is opaque to the CO. This field is OPTIONAL.
|
||||
map<string, string> publish_info = 1;
|
||||
// Opaque static publish properties of the volume. SP MAY use this
|
||||
// field to ensure subsequent `NodeStageVolume` or `NodePublishVolume`
|
||||
// calls calls have contextual information.
|
||||
// The contents of this field SHALL be opaque to a CO.
|
||||
// The contents of this field SHALL NOT be mutable.
|
||||
// The contents of this field SHALL be safe for the CO to cache.
|
||||
// The contents of this field SHOULD NOT contain sensitive
|
||||
// information.
|
||||
// The contents of this field SHOULD NOT be used for uniquely
|
||||
// identifying a volume. The `volume_id` alone SHOULD be sufficient to
|
||||
// identify the volume.
|
||||
// This field is OPTIONAL and when present MUST be passed to
|
||||
// subsequent `NodeStageVolume` or `NodePublishVolume` calls
|
||||
map<string, string> publish_context = 1;
|
||||
}
|
||||
message ControllerUnpublishVolumeRequest {
|
||||
// The ID of the volume. This field is REQUIRED.
|
||||
@ -615,7 +667,7 @@ message ControllerUnpublishVolumeRequest {
|
||||
// ControllerPublishVolume call for the specified volume.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> controller_unpublish_secrets = 3;
|
||||
map<string, string> secrets = 3 [(csi_secret) = true];
|
||||
}
|
||||
|
||||
message ControllerUnpublishVolumeResponse {
|
||||
@ -625,30 +677,52 @@ message ValidateVolumeCapabilitiesRequest {
|
||||
// The ID of the volume to check. This field is REQUIRED.
|
||||
string volume_id = 1;
|
||||
|
||||
// Volume context as returned by CO in CreateVolumeRequest. This field
|
||||
// is OPTIONAL and MUST match the volume_context of the volume
|
||||
// identified by `volume_id`.
|
||||
map<string, string> volume_context = 2;
|
||||
|
||||
// The capabilities that the CO wants to check for the volume. This
|
||||
// call SHALL return "supported" only if all the volume capabilities
|
||||
// call SHALL return "confirmed" only if all the volume capabilities
|
||||
// specified below are supported. This field is REQUIRED.
|
||||
repeated VolumeCapability volume_capabilities = 2;
|
||||
repeated VolumeCapability volume_capabilities = 3;
|
||||
|
||||
// Attributes of the volume to check. This field is OPTIONAL and MUST
|
||||
// match the attributes of the Volume identified by `volume_id`.
|
||||
map<string, string> volume_attributes = 3;
|
||||
// See CreateVolumeRequest.parameters.
|
||||
// This field is OPTIONAL.
|
||||
map<string, string> parameters = 4;
|
||||
|
||||
// Specifies where (regions, zones, racks, etc.) the caller believes
|
||||
// the volume is accessible from.
|
||||
// A caller MAY specify multiple topologies to indicate they believe
|
||||
// the volume to be accessible from multiple locations.
|
||||
// This field is OPTIONAL. This field SHALL NOT be set unless the
|
||||
// plugin advertises the ACCESSIBILITY_CONSTRAINTS capability.
|
||||
repeated Topology accessible_topology = 4;
|
||||
// Secrets required by plugin to complete volume validation request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> secrets = 5 [(csi_secret) = true];
|
||||
}
|
||||
|
||||
message ValidateVolumeCapabilitiesResponse {
|
||||
// True if the Plugin supports the specified capabilities for the
|
||||
// given volume. This field is REQUIRED.
|
||||
bool supported = 1;
|
||||
message Confirmed {
|
||||
// Volume context validated by the plugin.
|
||||
// This field is OPTIONAL.
|
||||
map<string, string> volume_context = 1;
|
||||
|
||||
// Message to the CO if `supported` above is false. This field is
|
||||
// Volume capabilities supported by the plugin.
|
||||
// This field is REQUIRED.
|
||||
repeated VolumeCapability volume_capabilities = 2;
|
||||
|
||||
// The volume creation parameters validated by the plugin.
|
||||
// This field is OPTIONAL.
|
||||
map<string, string> parameters = 3;
|
||||
}
|
||||
|
||||
// Confirmed indicates to the CO the set of capabilities that the
|
||||
// plugin has validated. This field SHALL only be set to a non-empty
|
||||
// value for successful validation responses.
|
||||
// For successful validation responses, the CO SHALL compare the
|
||||
// fields of this message to the originally requested capabilities in
|
||||
// order to guard against an older plugin reporting "valid" for newer
|
||||
// capability fields that it does not yet understand.
|
||||
// This field is OPTIONAL.
|
||||
Confirmed confirmed = 1;
|
||||
|
||||
// Message to the CO if `confirmed` above is empty. This field is
|
||||
// OPTIONAL.
|
||||
// An empty string is equal to an unspecified field value.
|
||||
string message = 2;
|
||||
@ -705,7 +779,7 @@ message GetCapacityRequest {
|
||||
// `accessible_topology`. This is the same as the
|
||||
// `accessible_topology` the CO returns in a `CreateVolumeResponse`.
|
||||
// This field is OPTIONAL. This field SHALL NOT be set unless the
|
||||
// plugin advertises the ACCESSIBILITY_CONSTRAINTS capability.
|
||||
// plugin advertises the VOLUME_ACCESSIBILITY_CONSTRAINTS capability.
|
||||
Topology accessible_topology = 3;
|
||||
}
|
||||
|
||||
@ -725,7 +799,7 @@ message ControllerGetCapabilitiesRequest {
|
||||
message ControllerGetCapabilitiesResponse {
|
||||
// All the capabilities that the controller service supports. This
|
||||
// field is OPTIONAL.
|
||||
repeated ControllerServiceCapability capabilities = 2;
|
||||
repeated ControllerServiceCapability capabilities = 1;
|
||||
}
|
||||
|
||||
// Specifies a capability of the controller service.
|
||||
@ -742,11 +816,15 @@ message ControllerServiceCapability {
|
||||
// CREATE_DELETE_SNAPSHOT MUST support creating volume from
|
||||
// snapshot.
|
||||
CREATE_DELETE_SNAPSHOT = 5;
|
||||
// LIST_SNAPSHOTS is NOT REQUIRED. For plugins that need to upload
|
||||
// a snapshot after it is being cut, LIST_SNAPSHOTS COULD be used
|
||||
// with the snapshot_id as the filter to query whether the
|
||||
// uploading process is complete or not.
|
||||
LIST_SNAPSHOTS = 6;
|
||||
// Plugins supporting volume cloning at the storage level MAY
|
||||
// report this capability. The source volume MUST be managed by
|
||||
// the same plugin. Not all volume sources and parameters
|
||||
// combinations MAY work.
|
||||
CLONE_VOLUME = 7;
|
||||
// Indicates the SP supports ControllerPublishVolume.readonly
|
||||
// field.
|
||||
PUBLISH_READONLY = 8;
|
||||
}
|
||||
|
||||
Type type = 1;
|
||||
@ -764,12 +842,16 @@ message CreateSnapshotRequest {
|
||||
|
||||
// The suggested name for the snapshot. This field is REQUIRED for
|
||||
// idempotency.
|
||||
// Any Unicode string that conforms to the length limit is allowed
|
||||
// except those containing the following banned characters:
|
||||
// U+0000-U+0008, U+000B, U+000C, U+000E-U+001F, U+007F-U+009F.
|
||||
// (These are control characters other than commonly used whitespace.)
|
||||
string name = 2;
|
||||
|
||||
// Secrets required by plugin to complete snapshot creation request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> create_snapshot_secrets = 3;
|
||||
map<string, string> secrets = 3 [(csi_secret) = true];
|
||||
|
||||
// Plugin specific parameters passed in as opaque key-value pairs.
|
||||
// This field is OPTIONAL. The Plugin is responsible for parsing and
|
||||
@ -791,7 +873,7 @@ message CreateSnapshotResponse {
|
||||
Snapshot snapshot = 1;
|
||||
}
|
||||
|
||||
// The information about a provisioned snapshot.
|
||||
// Information about a specific snapshot.
|
||||
message Snapshot {
|
||||
// This is the complete size of the snapshot in bytes. The purpose of
|
||||
// this field is to give CO guidance on how much space is needed to
|
||||
@ -802,11 +884,16 @@ message Snapshot {
|
||||
// zero means it is unspecified.
|
||||
int64 size_bytes = 1;
|
||||
|
||||
// Uniquely identifies a snapshot and is generated by the plugin. It
|
||||
// will not change over time. This field is REQUIRED. The identity
|
||||
// information will be used by the CO in subsequent calls to refer to
|
||||
// the provisioned snapshot.
|
||||
string id = 2;
|
||||
// The identifier for this snapshot, generated by the plugin.
|
||||
// This field is REQUIRED.
|
||||
// This field MUST contain enough information to uniquely identify
|
||||
// this specific snapshot vs all other snapshots supported by this
|
||||
// plugin.
|
||||
// This field SHALL be used by the CO in subsequent calls to refer to
|
||||
// this snapshot.
|
||||
// The SP is NOT responsible for global uniqueness of snapshot_id
|
||||
// across multiple SPs.
|
||||
string snapshot_id = 2;
|
||||
|
||||
// Identity information for the source volume. Note that creating a
|
||||
// snapshot from a snapshot is not supported here so the source has to
|
||||
@ -814,43 +901,13 @@ message Snapshot {
|
||||
string source_volume_id = 3;
|
||||
|
||||
// Timestamp when the point-in-time snapshot is taken on the storage
|
||||
// system. The format of this field should be a Unix nanoseconds time
|
||||
// encoded as an int64. On Unix, the command `date +%s%N` returns the
|
||||
// current time in nanoseconds since 1970-01-01 00:00:00 UTC. This
|
||||
// field is REQUIRED.
|
||||
int64 created_at = 4;
|
||||
// system. This field is REQUIRED.
|
||||
.google.protobuf.Timestamp creation_time = 4;
|
||||
|
||||
// The status of a snapshot.
|
||||
SnapshotStatus status = 5;
|
||||
}
|
||||
|
||||
// The status of a snapshot.
|
||||
message SnapshotStatus {
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
// A snapshot is ready for use.
|
||||
READY = 1;
|
||||
// A snapshot is cut and is now being uploaded.
|
||||
// Some cloud providers and storage systems uploads the snapshot
|
||||
// to the cloud after the snapshot is cut. During this phase,
|
||||
// `thaw` can be done so the application can be running again if
|
||||
// `freeze` was done before taking the snapshot.
|
||||
UPLOADING = 2;
|
||||
// An error occurred during the snapshot uploading process.
|
||||
// This error status is specific for uploading because
|
||||
// `CreateSnaphot` is a blocking call before the snapshot is
|
||||
// cut and therefore it SHOULD NOT come back with an error
|
||||
// status when an error occurs. Instead a gRPC error code SHALL
|
||||
// be returned by `CreateSnapshot` when an error occurs before
|
||||
// a snapshot is cut.
|
||||
ERROR_UPLOADING = 3;
|
||||
}
|
||||
// This field is REQUIRED.
|
||||
Type type = 1;
|
||||
|
||||
// Additional information to describe why a snapshot ended up in the
|
||||
// `ERROR_UPLOADING` status. This field is OPTIONAL.
|
||||
string details = 2;
|
||||
// Indicates if a snapshot is ready to use as a
|
||||
// `volume_content_source` in a `CreateVolumeRequest`. The default
|
||||
// value is false. This field is REQUIRED.
|
||||
bool ready_to_use = 5;
|
||||
}
|
||||
message DeleteSnapshotRequest {
|
||||
// The ID of the snapshot to be deleted.
|
||||
@ -860,7 +917,7 @@ message DeleteSnapshotRequest {
|
||||
// Secrets required by plugin to complete snapshot deletion request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> delete_snapshot_secrets = 2;
|
||||
map<string, string> secrets = 2 [(csi_secret) = true];
|
||||
}
|
||||
|
||||
message DeleteSnapshotResponse {}
|
||||
@ -890,7 +947,8 @@ message ListSnapshotsRequest {
|
||||
// Identity information for a specific snapshot. This field is
|
||||
// OPTIONAL. It can be used to list only a specific snapshot.
|
||||
// ListSnapshots will return with current snapshot information
|
||||
// and will not block if the snapshot is being uploaded.
|
||||
// and will not block if the snapshot is being processed after
|
||||
// it is cut.
|
||||
string snapshot_id = 4;
|
||||
}
|
||||
|
||||
@ -918,28 +976,34 @@ message NodeStageVolumeRequest {
|
||||
// has `PUBLISH_UNPUBLISH_VOLUME` controller capability, and SHALL be
|
||||
// left unset if the corresponding Controller Plugin does not have
|
||||
// this capability. This is an OPTIONAL field.
|
||||
map<string, string> publish_info = 2;
|
||||
map<string, string> publish_context = 2;
|
||||
|
||||
// The path to which the volume will be published. It MUST be an
|
||||
// The path to which the volume MAY be staged. It MUST be an
|
||||
// absolute path in the root filesystem of the process serving this
|
||||
// request. The CO SHALL ensure that there is only one
|
||||
// staging_target_path per volume.
|
||||
// request, and MUST be a directory. The CO SHALL ensure that there
|
||||
// is only one `staging_target_path` per volume. The CO SHALL ensure
|
||||
// that the path is directory and that the process serving the
|
||||
// request has `read` and `write` permission to that directory. The
|
||||
// CO SHALL be responsible for creating the directory if it does not
|
||||
// exist.
|
||||
// This is a REQUIRED field.
|
||||
string staging_target_path = 3;
|
||||
|
||||
// The capability of the volume the CO expects the volume to have.
|
||||
// Volume capability describing how the CO intends to use this volume.
|
||||
// SP MUST ensure the CO can use the staged volume as described.
|
||||
// Otherwise SP MUST return the appropriate gRPC error code.
|
||||
// This is a REQUIRED field.
|
||||
VolumeCapability volume_capability = 4;
|
||||
|
||||
// Secrets required by plugin to complete node stage volume request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> node_stage_secrets = 5;
|
||||
map<string, string> secrets = 5 [(csi_secret) = true];
|
||||
|
||||
// Attributes of the volume to publish. This field is OPTIONAL and
|
||||
// MUST match the attributes of the `Volume` identified by
|
||||
// `volume_id`.
|
||||
map<string, string> volume_attributes = 6;
|
||||
// Volume context as returned by CO in CreateVolumeRequest. This field
|
||||
// is OPTIONAL and MUST match the volume_context of the volume
|
||||
// identified by `volume_id`.
|
||||
map<string, string> volume_context = 6;
|
||||
}
|
||||
|
||||
message NodeStageVolumeResponse {
|
||||
@ -949,7 +1013,7 @@ message NodeUnstageVolumeRequest {
|
||||
// The ID of the volume. This field is REQUIRED.
|
||||
string volume_id = 1;
|
||||
|
||||
// The path at which the volume was published. It MUST be an absolute
|
||||
// The path at which the volume was staged. It MUST be an absolute
|
||||
// path in the root filesystem of the process serving this request.
|
||||
// This is a REQUIRED field.
|
||||
string staging_target_path = 2;
|
||||
@ -967,9 +1031,9 @@ message NodePublishVolumeRequest {
|
||||
// has `PUBLISH_UNPUBLISH_VOLUME` controller capability, and SHALL be
|
||||
// left unset if the corresponding Controller Plugin does not have
|
||||
// this capability. This is an OPTIONAL field.
|
||||
map<string, string> publish_info = 2;
|
||||
map<string, string> publish_context = 2;
|
||||
|
||||
// The path to which the device was mounted by `NodeStageVolume`.
|
||||
// The path to which the volume was staged by `NodeStageVolume`.
|
||||
// It MUST be an absolute path in the root filesystem of the process
|
||||
// serving this request.
|
||||
// It MUST be set if the Node Plugin implements the
|
||||
@ -980,28 +1044,36 @@ message NodePublishVolumeRequest {
|
||||
// The path to which the volume will be published. It MUST be an
|
||||
// absolute path in the root filesystem of the process serving this
|
||||
// request. The CO SHALL ensure uniqueness of target_path per volume.
|
||||
// The CO SHALL ensure that the path exists, and that the process
|
||||
// serving the request has `read` and `write` permissions to the path.
|
||||
// The CO SHALL ensure that the parent directory of this path exists
|
||||
// and that the process serving the request has `read` and `write`
|
||||
// permissions to that parent directory.
|
||||
// For volumes with an access type of block, the SP SHALL place the
|
||||
// block device at target_path.
|
||||
// For volumes with an access type of mount, the SP SHALL place the
|
||||
// mounted directory at target_path.
|
||||
// Creation of target_path is the responsibility of the SP.
|
||||
// This is a REQUIRED field.
|
||||
string target_path = 4;
|
||||
|
||||
// The capability of the volume the CO expects the volume to have.
|
||||
// Volume capability describing how the CO intends to use this volume.
|
||||
// SP MUST ensure the CO can use the published volume as described.
|
||||
// Otherwise SP MUST return the appropriate gRPC error code.
|
||||
// This is a REQUIRED field.
|
||||
VolumeCapability volume_capability = 5;
|
||||
|
||||
// Whether to publish the volume in readonly mode. This field is
|
||||
// REQUIRED.
|
||||
// Indicates SP MUST publish the volume in readonly mode.
|
||||
// This field is REQUIRED.
|
||||
bool readonly = 6;
|
||||
|
||||
// Secrets required by plugin to complete node publish volume request.
|
||||
// This field is OPTIONAL. Refer to the `Secrets Requirements`
|
||||
// section on how to use this field.
|
||||
map<string, string> node_publish_secrets = 7;
|
||||
map<string, string> secrets = 7 [(csi_secret) = true];
|
||||
|
||||
// Attributes of the volume to publish. This field is OPTIONAL and
|
||||
// MUST match the attributes of the Volume identified by
|
||||
// `volume_id`.
|
||||
map<string, string> volume_attributes = 8;
|
||||
// Volume context as returned by CO in CreateVolumeRequest. This field
|
||||
// is OPTIONAL and MUST match the volume_context of the volume
|
||||
// identified by `volume_id`.
|
||||
map<string, string> volume_context = 8;
|
||||
}
|
||||
|
||||
message NodePublishVolumeResponse {
|
||||
@ -1013,6 +1085,7 @@ message NodeUnpublishVolumeRequest {
|
||||
|
||||
// The path at which the volume was published. It MUST be an absolute
|
||||
// path in the root filesystem of the process serving this request.
|
||||
// The SP MUST delete the file or directory it created at this path.
|
||||
// This is a REQUIRED field.
|
||||
string target_path = 2;
|
||||
}
|
||||
@ -1020,15 +1093,43 @@ message NodeUnpublishVolumeRequest {
|
||||
message NodeUnpublishVolumeResponse {
|
||||
// Intentionally empty.
|
||||
}
|
||||
message NodeGetIdRequest {
|
||||
// Intentionally empty.
|
||||
message NodeGetVolumeStatsRequest {
|
||||
// The ID of the volume. This field is REQUIRED.
|
||||
string volume_id = 1;
|
||||
|
||||
// It can be any valid path where volume was previously
|
||||
// staged or published.
|
||||
// It MUST be an absolute path in the root filesystem of
|
||||
// the process serving this request.
|
||||
// This is a REQUIRED field.
|
||||
string volume_path = 2;
|
||||
}
|
||||
|
||||
message NodeGetIdResponse {
|
||||
// The ID of the node as understood by the SP which SHALL be used by
|
||||
// CO in subsequent `ControllerPublishVolume`.
|
||||
// This is a REQUIRED field.
|
||||
string node_id = 1;
|
||||
message NodeGetVolumeStatsResponse {
|
||||
// This field is OPTIONAL.
|
||||
repeated VolumeUsage usage = 1;
|
||||
}
|
||||
|
||||
message VolumeUsage {
|
||||
enum Unit {
|
||||
UNKNOWN = 0;
|
||||
BYTES = 1;
|
||||
INODES = 2;
|
||||
}
|
||||
// The available capacity in specified Unit. This field is OPTIONAL.
|
||||
// The value of this field MUST NOT be negative.
|
||||
int64 available = 1;
|
||||
|
||||
// The total capacity in specified Unit. This field is REQUIRED.
|
||||
// The value of this field MUST NOT be negative.
|
||||
int64 total = 2;
|
||||
|
||||
// The used capacity in specified Unit. This field is OPTIONAL.
|
||||
// The value of this field MUST NOT be negative.
|
||||
int64 used = 3;
|
||||
|
||||
// Units by which values are measured. This field is REQUIRED.
|
||||
Unit unit = 4;
|
||||
}
|
||||
message NodeGetCapabilitiesRequest {
|
||||
// Intentionally empty.
|
||||
@ -1046,6 +1147,10 @@ message NodeServiceCapability {
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
STAGE_UNSTAGE_VOLUME = 1;
|
||||
// If Plugin implements GET_VOLUME_STATS capability
|
||||
// then it MUST implement NodeGetVolumeStats RPC
|
||||
// call for fetching volume statistics.
|
||||
GET_VOLUME_STATS = 2;
|
||||
}
|
||||
|
||||
Type type = 1;
|
||||
@ -1060,9 +1165,14 @@ message NodeGetInfoRequest {
|
||||
}
|
||||
|
||||
message NodeGetInfoResponse {
|
||||
// The ID of the node as understood by the SP which SHALL be used by
|
||||
// CO in subsequent calls to `ControllerPublishVolume`.
|
||||
// This is a REQUIRED field.
|
||||
// The identifier of the node as understood by the SP.
|
||||
// This field is REQUIRED.
|
||||
// This field MUST contain enough information to uniquely identify
|
||||
// this specific node vs all other nodes supported by this plugin.
|
||||
// This field SHALL be used by the CO in subsequent calls, including
|
||||
// `ControllerPublishVolume`, to refer to this node.
|
||||
// The SP is NOT responsible for global uniqueness of node_id across
|
||||
// multiple SPs.
|
||||
string node_id = 1;
|
||||
|
||||
// Maximum number of volumes that controller can publish to the node.
|
||||
@ -1075,7 +1185,7 @@ message NodeGetInfoResponse {
|
||||
// Specifies where (regions, zones, racks, etc.) the node is
|
||||
// accessible from.
|
||||
// A plugin that returns this field MUST also set the
|
||||
// ACCESSIBILITY_CONSTRAINTS plugin capability.
|
||||
// VOLUME_ACCESSIBILITY_CONSTRAINTS plugin capability.
|
||||
// COs MAY use this information along with the topology information
|
||||
// returned in CreateVolumeResponse to ensure that a given volume is
|
||||
// accessible from a given node when scheduling workloads.
|
||||
|
31
vendor/github.com/container-storage-interface/spec/lib/go/Makefile
generated
vendored
31
vendor/github.com/container-storage-interface/spec/lib/go/Makefile
generated
vendored
@ -58,14 +58,14 @@ $(PROTOC):
|
||||
PROTOC_GEN_GO_PKG := github.com/golang/protobuf/protoc-gen-go
|
||||
PROTOC_GEN_GO := protoc-gen-go
|
||||
$(PROTOC_GEN_GO): PROTOBUF_PKG := $(dir $(PROTOC_GEN_GO_PKG))
|
||||
$(PROTOC_GEN_GO): PROTOBUF_VERSION := v1.1.0
|
||||
$(PROTOC_GEN_GO): PROTOBUF_VERSION := v1.2.0
|
||||
$(PROTOC_GEN_GO):
|
||||
mkdir -p $(dir $(GOPATH)/src/$(PROTOBUF_PKG))
|
||||
test -d $(GOPATH)/src/$(PROTOBUF_PKG)/.git || git clone https://$(PROTOBUF_PKG) $(GOPATH)/src/$(PROTOBUF_PKG)
|
||||
(cd $(GOPATH)/src/$(PROTOBUF_PKG) && \
|
||||
(test "$$(git describe --tags | head -1)" = "$(PROTOBUF_VERSION)" || \
|
||||
(git fetch && git checkout tags/$(PROTOBUF_VERSION))))
|
||||
(cd $(GOPATH)/src/$(PROTOBUF_PKG) && go get -v -d ./...) && \
|
||||
(cd $(GOPATH)/src/$(PROTOBUF_PKG) && go get -v -d $$(go list -f '{{ .ImportPath }}' ./...)) && \
|
||||
go build -o "$@" $(PROTOC_GEN_GO_PKG)
|
||||
|
||||
|
||||
@ -83,18 +83,25 @@ export PATH := $(shell pwd):$(PATH)
|
||||
## BUILD ##
|
||||
########################################################################
|
||||
CSI_PROTO := ../../csi.proto
|
||||
CSI_PKG := $(shell cat $(CSI_PROTO) | sed -n -e 's/^package.\([^;]*\);$$/\1/p'|tr '.' '/')
|
||||
CSI_GO := $(CSI_PKG)/csi.pb.go
|
||||
CSI_PKG_ROOT := github.com/container-storage-interface/spec
|
||||
CSI_PKG_SUB := $(shell cat $(CSI_PROTO) | sed -n -e 's/^package.\([^;]*\).v[0-9]\+;$$/\1/p'|tr '.' '/')
|
||||
CSI_BUILD := $(CSI_PKG_SUB)/.build
|
||||
CSI_GO := $(CSI_PKG_SUB)/csi.pb.go
|
||||
CSI_A := csi.a
|
||||
CSI_GO_TMP := $(CSI_PKG)/.build/csi.pb.go
|
||||
CSI_GO_TMP := $(CSI_BUILD)/$(CSI_PKG_ROOT)/csi.pb.go
|
||||
|
||||
# This recipe generates the go language bindings to a temp area.
|
||||
$(CSI_GO_TMP): HERE := $(shell pwd)
|
||||
$(CSI_GO_TMP): PTYPES_PKG := github.com/golang/protobuf/ptypes
|
||||
$(CSI_GO_TMP): GO_OUT := plugins=grpc
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/wrappers.proto=github.com/golang/protobuf/ptypes/wrappers
|
||||
$(CSI_GO_TMP): INCLUDE = -I$(PROTOC_TMP_DIR)/include
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/descriptor.proto=github.com/golang/protobuf/protoc-gen-go/descriptor
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT),Mgoogle/protobuf/wrappers.proto=$(PTYPES_PKG)/wrappers
|
||||
$(CSI_GO_TMP): GO_OUT := $(GO_OUT):"$(HERE)/$(CSI_BUILD)"
|
||||
$(CSI_GO_TMP): INCLUDE := -I$(GOPATH)/src -I$(HERE)/$(PROTOC_TMP_DIR)/include
|
||||
$(CSI_GO_TMP): $(CSI_PROTO) | $(PROTOC) $(PROTOC_GEN_GO)
|
||||
@mkdir -p "$(@D)"
|
||||
$(PROTOC) -I "$(<D)" $(INCLUDE) --go_out=$(GO_OUT):"$(@D)" "$<"
|
||||
(cd "$(GOPATH)/src" && \
|
||||
$(HERE)/$(PROTOC) $(INCLUDE) --go_out=$(GO_OUT) "$(CSI_PKG_ROOT)/$(<F)")
|
||||
|
||||
# The temp language bindings are compared to the ones that are
|
||||
# versioned. If they are different then it means the language
|
||||
@ -114,16 +121,16 @@ endif
|
||||
# 3. Build the archive file.
|
||||
$(CSI_A): $(CSI_GO)
|
||||
go get -v -d ./...
|
||||
go install ./$(CSI_PKG)
|
||||
go build -o "$@" ./$(CSI_PKG)
|
||||
go install ./$(CSI_PKG_SUB)
|
||||
go build -o "$@" ./$(CSI_PKG_SUB)
|
||||
|
||||
build: $(CSI_A)
|
||||
|
||||
clean:
|
||||
go clean -i ./...
|
||||
rm -f "$(CSI_A)"
|
||||
rm -rf "$(CSI_A)" "$(CSI_GO)" "$(CSI_BUILD)"
|
||||
|
||||
clobber: clean
|
||||
rm -fr "$(PROTOC)" "$(PROTOC_GEN_GO)" "$(CSI_PKG)"
|
||||
rm -fr "$(PROTOC)" "$(PROTOC_GEN_GO)" "$(CSI_PKG_SUB)"
|
||||
|
||||
.PHONY: clean clobber
|
||||
|
5277
vendor/github.com/container-storage-interface/spec/lib/go/csi/csi.pb.go
generated
vendored
Normal file
5277
vendor/github.com/container-storage-interface/spec/lib/go/csi/csi.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4991
vendor/github.com/container-storage-interface/spec/lib/go/csi/v0/csi.pb.go
generated
vendored
4991
vendor/github.com/container-storage-interface/spec/lib/go/csi/v0/csi.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
684
vendor/github.com/container-storage-interface/spec/spec.md
generated
vendored
684
vendor/github.com/container-storage-interface/spec/spec.md
generated
vendored
File diff suppressed because it is too large
Load Diff
20
vendor/github.com/golang/protobuf/.github/ISSUE_TEMPLATE/bug_report.md
generated
vendored
Normal file
20
vendor/github.com/golang/protobuf/.github/ISSUE_TEMPLATE/bug_report.md
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
**What version of protobuf and what language are you using?**
|
||||
Version: (e.g., `v1.1.0`, `89a0c16f`, etc)
|
||||
|
||||
**What did you do?**
|
||||
If possible, provide a recipe for reproducing the error.
|
||||
A complete runnable program is good with `.proto` and `.go` source code.
|
||||
|
||||
**What did you expect to see?**
|
||||
|
||||
**What did you see instead?**
|
||||
|
||||
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
|
||||
|
||||
**Anything else we should know about your project / environment?**
|
17
vendor/github.com/golang/protobuf/.github/ISSUE_TEMPLATE/feature_request.md
generated
vendored
Normal file
17
vendor/github.com/golang/protobuf/.github/ISSUE_TEMPLATE/feature_request.md
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is.
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
7
vendor/github.com/golang/protobuf/.github/ISSUE_TEMPLATE/question.md
generated
vendored
Normal file
7
vendor/github.com/golang/protobuf/.github/ISSUE_TEMPLATE/question.md
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
name: Question
|
||||
about: Questions and troubleshooting
|
||||
|
||||
---
|
||||
|
||||
|
1
vendor/github.com/golang/protobuf/.travis.yml
generated
vendored
1
vendor/github.com/golang/protobuf/.travis.yml
generated
vendored
@ -6,6 +6,7 @@ go:
|
||||
- 1.x
|
||||
|
||||
install:
|
||||
- go get -v -d google.golang.org/grpc
|
||||
- go get -v -d -t github.com/golang/protobuf/...
|
||||
- curl -L https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip -o /tmp/protoc.zip
|
||||
- unzip /tmp/protoc.zip -d "$HOME"/protoc
|
||||
|
3
vendor/github.com/golang/protobuf/LICENSE
generated
vendored
3
vendor/github.com/golang/protobuf/LICENSE
generated
vendored
@ -1,7 +1,4 @@
|
||||
Go support for Protocol Buffers - Google's data interchange format
|
||||
|
||||
Copyright 2010 The Go Authors. All rights reserved.
|
||||
https://github.com/golang/protobuf
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
|
2
vendor/github.com/golang/protobuf/Makefile
generated
vendored
2
vendor/github.com/golang/protobuf/Makefile
generated
vendored
@ -36,6 +36,8 @@ install:
|
||||
|
||||
test:
|
||||
go test ./... ./protoc-gen-go/testdata
|
||||
go test -tags purego ./... ./protoc-gen-go/testdata
|
||||
go build ./protoc-gen-go/testdata/grpc/grpc.pb.go
|
||||
make -C conformance test
|
||||
|
||||
clean:
|
||||
|
18
vendor/github.com/golang/protobuf/README.md
generated
vendored
18
vendor/github.com/golang/protobuf/README.md
generated
vendored
@ -1,4 +1,4 @@
|
||||
# Go support for Protocol Buffers
|
||||
# Go support for Protocol Buffers - Google's data interchange format
|
||||
|
||||
[![Build Status](https://travis-ci.org/golang/protobuf.svg?branch=master)](https://travis-ci.org/golang/protobuf)
|
||||
[![GoDoc](https://godoc.org/github.com/golang/protobuf?status.svg)](https://godoc.org/github.com/golang/protobuf)
|
||||
@ -83,15 +83,19 @@ be:
|
||||
|
||||
- Relative to the import path:
|
||||
|
||||
```shell
|
||||
protoc --go_out=. inputs/x.proto
|
||||
# writes ./github.com/golang/protobuf/p/x.pb.go
|
||||
```
|
||||
|
||||
(This can work well with `--go_out=$GOPATH`.)
|
||||
|
||||
- Relative to the input file:
|
||||
|
||||
protoc --go_out=paths=source_relative:. inputs/x.proto
|
||||
# generate ./inputs/x.pb.go
|
||||
```shell
|
||||
protoc --go_out=paths=source_relative:. inputs/x.proto
|
||||
# generate ./inputs/x.pb.go
|
||||
```
|
||||
|
||||
## Generated code ##
|
||||
|
||||
@ -157,9 +161,6 @@ Consider file test.proto, containing
|
||||
required string label = 1;
|
||||
optional int32 type = 2 [default=77];
|
||||
repeated int64 reps = 3;
|
||||
optional group OptionalGroup = 4 {
|
||||
required string RequiredField = 5;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -176,13 +177,10 @@ To create and play with a Test object from the example package,
|
||||
)
|
||||
|
||||
func main() {
|
||||
test := &example.Test {
|
||||
test := &example.Test{
|
||||
Label: proto.String("hello"),
|
||||
Type: proto.Int32(17),
|
||||
Reps: []int64{1, 2, 3},
|
||||
Optionalgroup: &example.Test_OptionalGroup {
|
||||
RequiredField: proto.String("good bye"),
|
||||
},
|
||||
}
|
||||
data, err := proto.Marshal(test)
|
||||
if err != nil {
|
||||
|
300
vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.pb.go
generated
vendored
300
vendor/github.com/golang/protobuf/conformance/internal/conformance_proto/conformance.pb.go
generated
vendored
@ -119,7 +119,7 @@ type ConformanceRequest struct {
|
||||
// *ConformanceRequest_JsonPayload
|
||||
Payload isConformanceRequest_Payload `protobuf_oneof:"payload"`
|
||||
// Which format should the testee serialize its message to?
|
||||
RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,enum=conformance.WireFormat" json:"requested_output_format,omitempty"`
|
||||
RequestedOutputFormat WireFormat `protobuf:"varint,3,opt,name=requested_output_format,json=requestedOutputFormat,proto3,enum=conformance.WireFormat" json:"requested_output_format,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -156,11 +156,13 @@ type isConformanceRequest_Payload interface {
|
||||
type ConformanceRequest_ProtobufPayload struct {
|
||||
ProtobufPayload []byte `protobuf:"bytes,1,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ConformanceRequest_JsonPayload struct {
|
||||
JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,oneof"`
|
||||
JsonPayload string `protobuf:"bytes,2,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ConformanceRequest_ProtobufPayload) isConformanceRequest_Payload() {}
|
||||
|
||||
func (*ConformanceRequest_JsonPayload) isConformanceRequest_Payload() {}
|
||||
|
||||
func (m *ConformanceRequest) GetPayload() isConformanceRequest_Payload {
|
||||
@ -301,29 +303,39 @@ type isConformanceResponse_Result interface {
|
||||
}
|
||||
|
||||
type ConformanceResponse_ParseError struct {
|
||||
ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,oneof"`
|
||||
ParseError string `protobuf:"bytes,1,opt,name=parse_error,json=parseError,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ConformanceResponse_SerializeError struct {
|
||||
SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,oneof"`
|
||||
SerializeError string `protobuf:"bytes,6,opt,name=serialize_error,json=serializeError,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ConformanceResponse_RuntimeError struct {
|
||||
RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,oneof"`
|
||||
RuntimeError string `protobuf:"bytes,2,opt,name=runtime_error,json=runtimeError,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ConformanceResponse_ProtobufPayload struct {
|
||||
ProtobufPayload []byte `protobuf:"bytes,3,opt,name=protobuf_payload,json=protobufPayload,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ConformanceResponse_JsonPayload struct {
|
||||
JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,oneof"`
|
||||
JsonPayload string `protobuf:"bytes,4,opt,name=json_payload,json=jsonPayload,proto3,oneof"`
|
||||
}
|
||||
|
||||
type ConformanceResponse_Skipped struct {
|
||||
Skipped string `protobuf:"bytes,5,opt,name=skipped,oneof"`
|
||||
Skipped string `protobuf:"bytes,5,opt,name=skipped,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*ConformanceResponse_ParseError) isConformanceResponse_Result() {}
|
||||
|
||||
func (*ConformanceResponse_SerializeError) isConformanceResponse_Result() {}
|
||||
|
||||
func (*ConformanceResponse_RuntimeError) isConformanceResponse_Result() {}
|
||||
|
||||
func (*ConformanceResponse_ProtobufPayload) isConformanceResponse_Result() {}
|
||||
|
||||
func (*ConformanceResponse_JsonPayload) isConformanceResponse_Result() {}
|
||||
|
||||
func (*ConformanceResponse_Skipped) isConformanceResponse_Result() {}
|
||||
|
||||
func (m *ConformanceResponse) GetResult() isConformanceResponse_Result {
|
||||
@ -505,70 +517,70 @@ func _ConformanceResponse_OneofSizer(msg proto.Message) (n int) {
|
||||
// forms.
|
||||
type TestAllTypes struct {
|
||||
// Singular
|
||||
OptionalInt32 int32 `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32" json:"optional_int32,omitempty"`
|
||||
OptionalInt64 int64 `protobuf:"varint,2,opt,name=optional_int64,json=optionalInt64" json:"optional_int64,omitempty"`
|
||||
OptionalUint32 uint32 `protobuf:"varint,3,opt,name=optional_uint32,json=optionalUint32" json:"optional_uint32,omitempty"`
|
||||
OptionalUint64 uint64 `protobuf:"varint,4,opt,name=optional_uint64,json=optionalUint64" json:"optional_uint64,omitempty"`
|
||||
OptionalSint32 int32 `protobuf:"zigzag32,5,opt,name=optional_sint32,json=optionalSint32" json:"optional_sint32,omitempty"`
|
||||
OptionalSint64 int64 `protobuf:"zigzag64,6,opt,name=optional_sint64,json=optionalSint64" json:"optional_sint64,omitempty"`
|
||||
OptionalFixed32 uint32 `protobuf:"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32" json:"optional_fixed32,omitempty"`
|
||||
OptionalFixed64 uint64 `protobuf:"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64" json:"optional_fixed64,omitempty"`
|
||||
OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32" json:"optional_sfixed32,omitempty"`
|
||||
OptionalSfixed64 int64 `protobuf:"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64" json:"optional_sfixed64,omitempty"`
|
||||
OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat" json:"optional_float,omitempty"`
|
||||
OptionalDouble float64 `protobuf:"fixed64,12,opt,name=optional_double,json=optionalDouble" json:"optional_double,omitempty"`
|
||||
OptionalBool bool `protobuf:"varint,13,opt,name=optional_bool,json=optionalBool" json:"optional_bool,omitempty"`
|
||||
OptionalString string `protobuf:"bytes,14,opt,name=optional_string,json=optionalString" json:"optional_string,omitempty"`
|
||||
OptionalInt32 int32 `protobuf:"varint,1,opt,name=optional_int32,json=optionalInt32,proto3" json:"optional_int32,omitempty"`
|
||||
OptionalInt64 int64 `protobuf:"varint,2,opt,name=optional_int64,json=optionalInt64,proto3" json:"optional_int64,omitempty"`
|
||||
OptionalUint32 uint32 `protobuf:"varint,3,opt,name=optional_uint32,json=optionalUint32,proto3" json:"optional_uint32,omitempty"`
|
||||
OptionalUint64 uint64 `protobuf:"varint,4,opt,name=optional_uint64,json=optionalUint64,proto3" json:"optional_uint64,omitempty"`
|
||||
OptionalSint32 int32 `protobuf:"zigzag32,5,opt,name=optional_sint32,json=optionalSint32,proto3" json:"optional_sint32,omitempty"`
|
||||
OptionalSint64 int64 `protobuf:"zigzag64,6,opt,name=optional_sint64,json=optionalSint64,proto3" json:"optional_sint64,omitempty"`
|
||||
OptionalFixed32 uint32 `protobuf:"fixed32,7,opt,name=optional_fixed32,json=optionalFixed32,proto3" json:"optional_fixed32,omitempty"`
|
||||
OptionalFixed64 uint64 `protobuf:"fixed64,8,opt,name=optional_fixed64,json=optionalFixed64,proto3" json:"optional_fixed64,omitempty"`
|
||||
OptionalSfixed32 int32 `protobuf:"fixed32,9,opt,name=optional_sfixed32,json=optionalSfixed32,proto3" json:"optional_sfixed32,omitempty"`
|
||||
OptionalSfixed64 int64 `protobuf:"fixed64,10,opt,name=optional_sfixed64,json=optionalSfixed64,proto3" json:"optional_sfixed64,omitempty"`
|
||||
OptionalFloat float32 `protobuf:"fixed32,11,opt,name=optional_float,json=optionalFloat,proto3" json:"optional_float,omitempty"`
|
||||
OptionalDouble float64 `protobuf:"fixed64,12,opt,name=optional_double,json=optionalDouble,proto3" json:"optional_double,omitempty"`
|
||||
OptionalBool bool `protobuf:"varint,13,opt,name=optional_bool,json=optionalBool,proto3" json:"optional_bool,omitempty"`
|
||||
OptionalString string `protobuf:"bytes,14,opt,name=optional_string,json=optionalString,proto3" json:"optional_string,omitempty"`
|
||||
OptionalBytes []byte `protobuf:"bytes,15,opt,name=optional_bytes,json=optionalBytes,proto3" json:"optional_bytes,omitempty"`
|
||||
OptionalNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage" json:"optional_nested_message,omitempty"`
|
||||
OptionalForeignMessage *ForeignMessage `protobuf:"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage" json:"optional_foreign_message,omitempty"`
|
||||
OptionalNestedEnum TestAllTypes_NestedEnum `protobuf:"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,enum=conformance.TestAllTypes_NestedEnum" json:"optional_nested_enum,omitempty"`
|
||||
OptionalForeignEnum ForeignEnum `protobuf:"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,enum=conformance.ForeignEnum" json:"optional_foreign_enum,omitempty"`
|
||||
OptionalStringPiece string `protobuf:"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece" json:"optional_string_piece,omitempty"`
|
||||
OptionalCord string `protobuf:"bytes,25,opt,name=optional_cord,json=optionalCord" json:"optional_cord,omitempty"`
|
||||
RecursiveMessage *TestAllTypes `protobuf:"bytes,27,opt,name=recursive_message,json=recursiveMessage" json:"recursive_message,omitempty"`
|
||||
OptionalNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,18,opt,name=optional_nested_message,json=optionalNestedMessage,proto3" json:"optional_nested_message,omitempty"`
|
||||
OptionalForeignMessage *ForeignMessage `protobuf:"bytes,19,opt,name=optional_foreign_message,json=optionalForeignMessage,proto3" json:"optional_foreign_message,omitempty"`
|
||||
OptionalNestedEnum TestAllTypes_NestedEnum `protobuf:"varint,21,opt,name=optional_nested_enum,json=optionalNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"optional_nested_enum,omitempty"`
|
||||
OptionalForeignEnum ForeignEnum `protobuf:"varint,22,opt,name=optional_foreign_enum,json=optionalForeignEnum,proto3,enum=conformance.ForeignEnum" json:"optional_foreign_enum,omitempty"`
|
||||
OptionalStringPiece string `protobuf:"bytes,24,opt,name=optional_string_piece,json=optionalStringPiece,proto3" json:"optional_string_piece,omitempty"`
|
||||
OptionalCord string `protobuf:"bytes,25,opt,name=optional_cord,json=optionalCord,proto3" json:"optional_cord,omitempty"`
|
||||
RecursiveMessage *TestAllTypes `protobuf:"bytes,27,opt,name=recursive_message,json=recursiveMessage,proto3" json:"recursive_message,omitempty"`
|
||||
// Repeated
|
||||
RepeatedInt32 []int32 `protobuf:"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32" json:"repeated_int32,omitempty"`
|
||||
RepeatedInt64 []int64 `protobuf:"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64" json:"repeated_int64,omitempty"`
|
||||
RepeatedUint32 []uint32 `protobuf:"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32" json:"repeated_uint32,omitempty"`
|
||||
RepeatedUint64 []uint64 `protobuf:"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64" json:"repeated_uint64,omitempty"`
|
||||
RepeatedSint32 []int32 `protobuf:"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32" json:"repeated_sint32,omitempty"`
|
||||
RepeatedSint64 []int64 `protobuf:"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64" json:"repeated_sint64,omitempty"`
|
||||
RepeatedFixed32 []uint32 `protobuf:"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32" json:"repeated_fixed32,omitempty"`
|
||||
RepeatedFixed64 []uint64 `protobuf:"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64" json:"repeated_fixed64,omitempty"`
|
||||
RepeatedSfixed32 []int32 `protobuf:"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32" json:"repeated_sfixed32,omitempty"`
|
||||
RepeatedSfixed64 []int64 `protobuf:"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64" json:"repeated_sfixed64,omitempty"`
|
||||
RepeatedFloat []float32 `protobuf:"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat" json:"repeated_float,omitempty"`
|
||||
RepeatedDouble []float64 `protobuf:"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble" json:"repeated_double,omitempty"`
|
||||
RepeatedBool []bool `protobuf:"varint,43,rep,packed,name=repeated_bool,json=repeatedBool" json:"repeated_bool,omitempty"`
|
||||
RepeatedString []string `protobuf:"bytes,44,rep,name=repeated_string,json=repeatedString" json:"repeated_string,omitempty"`
|
||||
RepeatedInt32 []int32 `protobuf:"varint,31,rep,packed,name=repeated_int32,json=repeatedInt32,proto3" json:"repeated_int32,omitempty"`
|
||||
RepeatedInt64 []int64 `protobuf:"varint,32,rep,packed,name=repeated_int64,json=repeatedInt64,proto3" json:"repeated_int64,omitempty"`
|
||||
RepeatedUint32 []uint32 `protobuf:"varint,33,rep,packed,name=repeated_uint32,json=repeatedUint32,proto3" json:"repeated_uint32,omitempty"`
|
||||
RepeatedUint64 []uint64 `protobuf:"varint,34,rep,packed,name=repeated_uint64,json=repeatedUint64,proto3" json:"repeated_uint64,omitempty"`
|
||||
RepeatedSint32 []int32 `protobuf:"zigzag32,35,rep,packed,name=repeated_sint32,json=repeatedSint32,proto3" json:"repeated_sint32,omitempty"`
|
||||
RepeatedSint64 []int64 `protobuf:"zigzag64,36,rep,packed,name=repeated_sint64,json=repeatedSint64,proto3" json:"repeated_sint64,omitempty"`
|
||||
RepeatedFixed32 []uint32 `protobuf:"fixed32,37,rep,packed,name=repeated_fixed32,json=repeatedFixed32,proto3" json:"repeated_fixed32,omitempty"`
|
||||
RepeatedFixed64 []uint64 `protobuf:"fixed64,38,rep,packed,name=repeated_fixed64,json=repeatedFixed64,proto3" json:"repeated_fixed64,omitempty"`
|
||||
RepeatedSfixed32 []int32 `protobuf:"fixed32,39,rep,packed,name=repeated_sfixed32,json=repeatedSfixed32,proto3" json:"repeated_sfixed32,omitempty"`
|
||||
RepeatedSfixed64 []int64 `protobuf:"fixed64,40,rep,packed,name=repeated_sfixed64,json=repeatedSfixed64,proto3" json:"repeated_sfixed64,omitempty"`
|
||||
RepeatedFloat []float32 `protobuf:"fixed32,41,rep,packed,name=repeated_float,json=repeatedFloat,proto3" json:"repeated_float,omitempty"`
|
||||
RepeatedDouble []float64 `protobuf:"fixed64,42,rep,packed,name=repeated_double,json=repeatedDouble,proto3" json:"repeated_double,omitempty"`
|
||||
RepeatedBool []bool `protobuf:"varint,43,rep,packed,name=repeated_bool,json=repeatedBool,proto3" json:"repeated_bool,omitempty"`
|
||||
RepeatedString []string `protobuf:"bytes,44,rep,name=repeated_string,json=repeatedString,proto3" json:"repeated_string,omitempty"`
|
||||
RepeatedBytes [][]byte `protobuf:"bytes,45,rep,name=repeated_bytes,json=repeatedBytes,proto3" json:"repeated_bytes,omitempty"`
|
||||
RepeatedNestedMessage []*TestAllTypes_NestedMessage `protobuf:"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage" json:"repeated_nested_message,omitempty"`
|
||||
RepeatedForeignMessage []*ForeignMessage `protobuf:"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage" json:"repeated_foreign_message,omitempty"`
|
||||
RepeatedNestedEnum []TestAllTypes_NestedEnum `protobuf:"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,enum=conformance.TestAllTypes_NestedEnum" json:"repeated_nested_enum,omitempty"`
|
||||
RepeatedForeignEnum []ForeignEnum `protobuf:"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,enum=conformance.ForeignEnum" json:"repeated_foreign_enum,omitempty"`
|
||||
RepeatedStringPiece []string `protobuf:"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece" json:"repeated_string_piece,omitempty"`
|
||||
RepeatedCord []string `protobuf:"bytes,55,rep,name=repeated_cord,json=repeatedCord" json:"repeated_cord,omitempty"`
|
||||
RepeatedNestedMessage []*TestAllTypes_NestedMessage `protobuf:"bytes,48,rep,name=repeated_nested_message,json=repeatedNestedMessage,proto3" json:"repeated_nested_message,omitempty"`
|
||||
RepeatedForeignMessage []*ForeignMessage `protobuf:"bytes,49,rep,name=repeated_foreign_message,json=repeatedForeignMessage,proto3" json:"repeated_foreign_message,omitempty"`
|
||||
RepeatedNestedEnum []TestAllTypes_NestedEnum `protobuf:"varint,51,rep,packed,name=repeated_nested_enum,json=repeatedNestedEnum,proto3,enum=conformance.TestAllTypes_NestedEnum" json:"repeated_nested_enum,omitempty"`
|
||||
RepeatedForeignEnum []ForeignEnum `protobuf:"varint,52,rep,packed,name=repeated_foreign_enum,json=repeatedForeignEnum,proto3,enum=conformance.ForeignEnum" json:"repeated_foreign_enum,omitempty"`
|
||||
RepeatedStringPiece []string `protobuf:"bytes,54,rep,name=repeated_string_piece,json=repeatedStringPiece,proto3" json:"repeated_string_piece,omitempty"`
|
||||
RepeatedCord []string `protobuf:"bytes,55,rep,name=repeated_cord,json=repeatedCord,proto3" json:"repeated_cord,omitempty"`
|
||||
// Map
|
||||
MapInt32Int32 map[int32]int32 `protobuf:"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32" json:"map_int32_int32,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
MapInt64Int64 map[int64]int64 `protobuf:"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64" json:"map_int64_int64,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
MapUint32Uint32 map[uint32]uint32 `protobuf:"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32" json:"map_uint32_uint32,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
MapUint64Uint64 map[uint64]uint64 `protobuf:"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64" json:"map_uint64_uint64,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
MapSint32Sint32 map[int32]int32 `protobuf:"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32" json:"map_sint32_sint32,omitempty" protobuf_key:"zigzag32,1,opt,name=key" protobuf_val:"zigzag32,2,opt,name=value"`
|
||||
MapSint64Sint64 map[int64]int64 `protobuf:"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64" json:"map_sint64_sint64,omitempty" protobuf_key:"zigzag64,1,opt,name=key" protobuf_val:"zigzag64,2,opt,name=value"`
|
||||
MapFixed32Fixed32 map[uint32]uint32 `protobuf:"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32" json:"map_fixed32_fixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key" protobuf_val:"fixed32,2,opt,name=value"`
|
||||
MapFixed64Fixed64 map[uint64]uint64 `protobuf:"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64" json:"map_fixed64_fixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key" protobuf_val:"fixed64,2,opt,name=value"`
|
||||
MapSfixed32Sfixed32 map[int32]int32 `protobuf:"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32" json:"map_sfixed32_sfixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key" protobuf_val:"fixed32,2,opt,name=value"`
|
||||
MapSfixed64Sfixed64 map[int64]int64 `protobuf:"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64" json:"map_sfixed64_sfixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key" protobuf_val:"fixed64,2,opt,name=value"`
|
||||
MapInt32Float map[int32]float32 `protobuf:"bytes,66,rep,name=map_int32_float,json=mapInt32Float" json:"map_int32_float,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"fixed32,2,opt,name=value"`
|
||||
MapInt32Double map[int32]float64 `protobuf:"bytes,67,rep,name=map_int32_double,json=mapInt32Double" json:"map_int32_double,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"fixed64,2,opt,name=value"`
|
||||
MapBoolBool map[bool]bool `protobuf:"bytes,68,rep,name=map_bool_bool,json=mapBoolBool" json:"map_bool_bool,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
MapStringString map[string]string `protobuf:"bytes,69,rep,name=map_string_string,json=mapStringString" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
MapStringBytes map[string][]byte `protobuf:"bytes,70,rep,name=map_string_bytes,json=mapStringBytes" json:"map_string_bytes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
MapStringNestedMessage map[string]*TestAllTypes_NestedMessage `protobuf:"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage" json:"map_string_nested_message,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
MapStringForeignMessage map[string]*ForeignMessage `protobuf:"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage" json:"map_string_foreign_message,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
MapStringNestedEnum map[string]TestAllTypes_NestedEnum `protobuf:"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum" json:"map_string_nested_enum,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=conformance.TestAllTypes_NestedEnum"`
|
||||
MapStringForeignEnum map[string]ForeignEnum `protobuf:"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum" json:"map_string_foreign_enum,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=conformance.ForeignEnum"`
|
||||
MapInt32Int32 map[int32]int32 `protobuf:"bytes,56,rep,name=map_int32_int32,json=mapInt32Int32,proto3" json:"map_int32_int32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
MapInt64Int64 map[int64]int64 `protobuf:"bytes,57,rep,name=map_int64_int64,json=mapInt64Int64,proto3" json:"map_int64_int64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
MapUint32Uint32 map[uint32]uint32 `protobuf:"bytes,58,rep,name=map_uint32_uint32,json=mapUint32Uint32,proto3" json:"map_uint32_uint32,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
MapUint64Uint64 map[uint64]uint64 `protobuf:"bytes,59,rep,name=map_uint64_uint64,json=mapUint64Uint64,proto3" json:"map_uint64_uint64,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
MapSint32Sint32 map[int32]int32 `protobuf:"bytes,60,rep,name=map_sint32_sint32,json=mapSint32Sint32,proto3" json:"map_sint32_sint32,omitempty" protobuf_key:"zigzag32,1,opt,name=key,proto3" protobuf_val:"zigzag32,2,opt,name=value,proto3"`
|
||||
MapSint64Sint64 map[int64]int64 `protobuf:"bytes,61,rep,name=map_sint64_sint64,json=mapSint64Sint64,proto3" json:"map_sint64_sint64,omitempty" protobuf_key:"zigzag64,1,opt,name=key,proto3" protobuf_val:"zigzag64,2,opt,name=value,proto3"`
|
||||
MapFixed32Fixed32 map[uint32]uint32 `protobuf:"bytes,62,rep,name=map_fixed32_fixed32,json=mapFixed32Fixed32,proto3" json:"map_fixed32_fixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
|
||||
MapFixed64Fixed64 map[uint64]uint64 `protobuf:"bytes,63,rep,name=map_fixed64_fixed64,json=mapFixed64Fixed64,proto3" json:"map_fixed64_fixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
|
||||
MapSfixed32Sfixed32 map[int32]int32 `protobuf:"bytes,64,rep,name=map_sfixed32_sfixed32,json=mapSfixed32Sfixed32,proto3" json:"map_sfixed32_sfixed32,omitempty" protobuf_key:"fixed32,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
|
||||
MapSfixed64Sfixed64 map[int64]int64 `protobuf:"bytes,65,rep,name=map_sfixed64_sfixed64,json=mapSfixed64Sfixed64,proto3" json:"map_sfixed64_sfixed64,omitempty" protobuf_key:"fixed64,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
|
||||
MapInt32Float map[int32]float32 `protobuf:"bytes,66,rep,name=map_int32_float,json=mapInt32Float,proto3" json:"map_int32_float,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed32,2,opt,name=value,proto3"`
|
||||
MapInt32Double map[int32]float64 `protobuf:"bytes,67,rep,name=map_int32_double,json=mapInt32Double,proto3" json:"map_int32_double,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"fixed64,2,opt,name=value,proto3"`
|
||||
MapBoolBool map[bool]bool `protobuf:"bytes,68,rep,name=map_bool_bool,json=mapBoolBool,proto3" json:"map_bool_bool,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
MapStringString map[string]string `protobuf:"bytes,69,rep,name=map_string_string,json=mapStringString,proto3" json:"map_string_string,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
MapStringBytes map[string][]byte `protobuf:"bytes,70,rep,name=map_string_bytes,json=mapStringBytes,proto3" json:"map_string_bytes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
MapStringNestedMessage map[string]*TestAllTypes_NestedMessage `protobuf:"bytes,71,rep,name=map_string_nested_message,json=mapStringNestedMessage,proto3" json:"map_string_nested_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
MapStringForeignMessage map[string]*ForeignMessage `protobuf:"bytes,72,rep,name=map_string_foreign_message,json=mapStringForeignMessage,proto3" json:"map_string_foreign_message,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
MapStringNestedEnum map[string]TestAllTypes_NestedEnum `protobuf:"bytes,73,rep,name=map_string_nested_enum,json=mapStringNestedEnum,proto3" json:"map_string_nested_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.TestAllTypes_NestedEnum"`
|
||||
MapStringForeignEnum map[string]ForeignEnum `protobuf:"bytes,74,rep,name=map_string_foreign_enum,json=mapStringForeignEnum,proto3" json:"map_string_foreign_enum,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=conformance.ForeignEnum"`
|
||||
// Types that are valid to be assigned to OneofField:
|
||||
// *TestAllTypes_OneofUint32
|
||||
// *TestAllTypes_OneofNestedMessage
|
||||
@ -576,49 +588,49 @@ type TestAllTypes struct {
|
||||
// *TestAllTypes_OneofBytes
|
||||
OneofField isTestAllTypes_OneofField `protobuf_oneof:"oneof_field"`
|
||||
// Well-known types
|
||||
OptionalBoolWrapper *wrappers.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper" json:"optional_bool_wrapper,omitempty"`
|
||||
OptionalInt32Wrapper *wrappers.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper" json:"optional_int32_wrapper,omitempty"`
|
||||
OptionalInt64Wrapper *wrappers.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper" json:"optional_int64_wrapper,omitempty"`
|
||||
OptionalUint32Wrapper *wrappers.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper" json:"optional_uint32_wrapper,omitempty"`
|
||||
OptionalUint64Wrapper *wrappers.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper" json:"optional_uint64_wrapper,omitempty"`
|
||||
OptionalFloatWrapper *wrappers.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper" json:"optional_float_wrapper,omitempty"`
|
||||
OptionalDoubleWrapper *wrappers.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper" json:"optional_double_wrapper,omitempty"`
|
||||
OptionalStringWrapper *wrappers.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper" json:"optional_string_wrapper,omitempty"`
|
||||
OptionalBytesWrapper *wrappers.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper" json:"optional_bytes_wrapper,omitempty"`
|
||||
RepeatedBoolWrapper []*wrappers.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper" json:"repeated_bool_wrapper,omitempty"`
|
||||
RepeatedInt32Wrapper []*wrappers.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper" json:"repeated_int32_wrapper,omitempty"`
|
||||
RepeatedInt64Wrapper []*wrappers.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper" json:"repeated_int64_wrapper,omitempty"`
|
||||
RepeatedUint32Wrapper []*wrappers.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper" json:"repeated_uint32_wrapper,omitempty"`
|
||||
RepeatedUint64Wrapper []*wrappers.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper" json:"repeated_uint64_wrapper,omitempty"`
|
||||
RepeatedFloatWrapper []*wrappers.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper" json:"repeated_float_wrapper,omitempty"`
|
||||
RepeatedDoubleWrapper []*wrappers.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper" json:"repeated_double_wrapper,omitempty"`
|
||||
RepeatedStringWrapper []*wrappers.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper" json:"repeated_string_wrapper,omitempty"`
|
||||
RepeatedBytesWrapper []*wrappers.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper" json:"repeated_bytes_wrapper,omitempty"`
|
||||
OptionalDuration *duration.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration" json:"optional_duration,omitempty"`
|
||||
OptionalTimestamp *timestamp.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp" json:"optional_timestamp,omitempty"`
|
||||
OptionalFieldMask *field_mask.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask" json:"optional_field_mask,omitempty"`
|
||||
OptionalStruct *_struct.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct" json:"optional_struct,omitempty"`
|
||||
OptionalAny *any.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny" json:"optional_any,omitempty"`
|
||||
OptionalValue *_struct.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue" json:"optional_value,omitempty"`
|
||||
RepeatedDuration []*duration.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration" json:"repeated_duration,omitempty"`
|
||||
RepeatedTimestamp []*timestamp.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp" json:"repeated_timestamp,omitempty"`
|
||||
RepeatedFieldmask []*field_mask.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask" json:"repeated_fieldmask,omitempty"`
|
||||
RepeatedStruct []*_struct.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct" json:"repeated_struct,omitempty"`
|
||||
RepeatedAny []*any.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny" json:"repeated_any,omitempty"`
|
||||
RepeatedValue []*_struct.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue" json:"repeated_value,omitempty"`
|
||||
OptionalBoolWrapper *wrappers.BoolValue `protobuf:"bytes,201,opt,name=optional_bool_wrapper,json=optionalBoolWrapper,proto3" json:"optional_bool_wrapper,omitempty"`
|
||||
OptionalInt32Wrapper *wrappers.Int32Value `protobuf:"bytes,202,opt,name=optional_int32_wrapper,json=optionalInt32Wrapper,proto3" json:"optional_int32_wrapper,omitempty"`
|
||||
OptionalInt64Wrapper *wrappers.Int64Value `protobuf:"bytes,203,opt,name=optional_int64_wrapper,json=optionalInt64Wrapper,proto3" json:"optional_int64_wrapper,omitempty"`
|
||||
OptionalUint32Wrapper *wrappers.UInt32Value `protobuf:"bytes,204,opt,name=optional_uint32_wrapper,json=optionalUint32Wrapper,proto3" json:"optional_uint32_wrapper,omitempty"`
|
||||
OptionalUint64Wrapper *wrappers.UInt64Value `protobuf:"bytes,205,opt,name=optional_uint64_wrapper,json=optionalUint64Wrapper,proto3" json:"optional_uint64_wrapper,omitempty"`
|
||||
OptionalFloatWrapper *wrappers.FloatValue `protobuf:"bytes,206,opt,name=optional_float_wrapper,json=optionalFloatWrapper,proto3" json:"optional_float_wrapper,omitempty"`
|
||||
OptionalDoubleWrapper *wrappers.DoubleValue `protobuf:"bytes,207,opt,name=optional_double_wrapper,json=optionalDoubleWrapper,proto3" json:"optional_double_wrapper,omitempty"`
|
||||
OptionalStringWrapper *wrappers.StringValue `protobuf:"bytes,208,opt,name=optional_string_wrapper,json=optionalStringWrapper,proto3" json:"optional_string_wrapper,omitempty"`
|
||||
OptionalBytesWrapper *wrappers.BytesValue `protobuf:"bytes,209,opt,name=optional_bytes_wrapper,json=optionalBytesWrapper,proto3" json:"optional_bytes_wrapper,omitempty"`
|
||||
RepeatedBoolWrapper []*wrappers.BoolValue `protobuf:"bytes,211,rep,name=repeated_bool_wrapper,json=repeatedBoolWrapper,proto3" json:"repeated_bool_wrapper,omitempty"`
|
||||
RepeatedInt32Wrapper []*wrappers.Int32Value `protobuf:"bytes,212,rep,name=repeated_int32_wrapper,json=repeatedInt32Wrapper,proto3" json:"repeated_int32_wrapper,omitempty"`
|
||||
RepeatedInt64Wrapper []*wrappers.Int64Value `protobuf:"bytes,213,rep,name=repeated_int64_wrapper,json=repeatedInt64Wrapper,proto3" json:"repeated_int64_wrapper,omitempty"`
|
||||
RepeatedUint32Wrapper []*wrappers.UInt32Value `protobuf:"bytes,214,rep,name=repeated_uint32_wrapper,json=repeatedUint32Wrapper,proto3" json:"repeated_uint32_wrapper,omitempty"`
|
||||
RepeatedUint64Wrapper []*wrappers.UInt64Value `protobuf:"bytes,215,rep,name=repeated_uint64_wrapper,json=repeatedUint64Wrapper,proto3" json:"repeated_uint64_wrapper,omitempty"`
|
||||
RepeatedFloatWrapper []*wrappers.FloatValue `protobuf:"bytes,216,rep,name=repeated_float_wrapper,json=repeatedFloatWrapper,proto3" json:"repeated_float_wrapper,omitempty"`
|
||||
RepeatedDoubleWrapper []*wrappers.DoubleValue `protobuf:"bytes,217,rep,name=repeated_double_wrapper,json=repeatedDoubleWrapper,proto3" json:"repeated_double_wrapper,omitempty"`
|
||||
RepeatedStringWrapper []*wrappers.StringValue `protobuf:"bytes,218,rep,name=repeated_string_wrapper,json=repeatedStringWrapper,proto3" json:"repeated_string_wrapper,omitempty"`
|
||||
RepeatedBytesWrapper []*wrappers.BytesValue `protobuf:"bytes,219,rep,name=repeated_bytes_wrapper,json=repeatedBytesWrapper,proto3" json:"repeated_bytes_wrapper,omitempty"`
|
||||
OptionalDuration *duration.Duration `protobuf:"bytes,301,opt,name=optional_duration,json=optionalDuration,proto3" json:"optional_duration,omitempty"`
|
||||
OptionalTimestamp *timestamp.Timestamp `protobuf:"bytes,302,opt,name=optional_timestamp,json=optionalTimestamp,proto3" json:"optional_timestamp,omitempty"`
|
||||
OptionalFieldMask *field_mask.FieldMask `protobuf:"bytes,303,opt,name=optional_field_mask,json=optionalFieldMask,proto3" json:"optional_field_mask,omitempty"`
|
||||
OptionalStruct *_struct.Struct `protobuf:"bytes,304,opt,name=optional_struct,json=optionalStruct,proto3" json:"optional_struct,omitempty"`
|
||||
OptionalAny *any.Any `protobuf:"bytes,305,opt,name=optional_any,json=optionalAny,proto3" json:"optional_any,omitempty"`
|
||||
OptionalValue *_struct.Value `protobuf:"bytes,306,opt,name=optional_value,json=optionalValue,proto3" json:"optional_value,omitempty"`
|
||||
RepeatedDuration []*duration.Duration `protobuf:"bytes,311,rep,name=repeated_duration,json=repeatedDuration,proto3" json:"repeated_duration,omitempty"`
|
||||
RepeatedTimestamp []*timestamp.Timestamp `protobuf:"bytes,312,rep,name=repeated_timestamp,json=repeatedTimestamp,proto3" json:"repeated_timestamp,omitempty"`
|
||||
RepeatedFieldmask []*field_mask.FieldMask `protobuf:"bytes,313,rep,name=repeated_fieldmask,json=repeatedFieldmask,proto3" json:"repeated_fieldmask,omitempty"`
|
||||
RepeatedStruct []*_struct.Struct `protobuf:"bytes,324,rep,name=repeated_struct,json=repeatedStruct,proto3" json:"repeated_struct,omitempty"`
|
||||
RepeatedAny []*any.Any `protobuf:"bytes,315,rep,name=repeated_any,json=repeatedAny,proto3" json:"repeated_any,omitempty"`
|
||||
RepeatedValue []*_struct.Value `protobuf:"bytes,316,rep,name=repeated_value,json=repeatedValue,proto3" json:"repeated_value,omitempty"`
|
||||
// Test field-name-to-JSON-name convention.
|
||||
Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1" json:"fieldname1,omitempty"`
|
||||
FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2" json:"field_name2,omitempty"`
|
||||
XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3" json:"_field_name3,omitempty"`
|
||||
Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4" json:"field__name4_,omitempty"`
|
||||
Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5" json:"field0name5,omitempty"`
|
||||
Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6" json:"field_0_name6,omitempty"`
|
||||
FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7" json:"fieldName7,omitempty"`
|
||||
FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8" json:"FieldName8,omitempty"`
|
||||
Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9" json:"field_Name9,omitempty"`
|
||||
Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10" json:"Field_Name10,omitempty"`
|
||||
FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11" json:"FIELD_NAME11,omitempty"`
|
||||
FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12" json:"FIELD_name12,omitempty"`
|
||||
Fieldname1 int32 `protobuf:"varint,401,opt,name=fieldname1,proto3" json:"fieldname1,omitempty"`
|
||||
FieldName2 int32 `protobuf:"varint,402,opt,name=field_name2,json=fieldName2,proto3" json:"field_name2,omitempty"`
|
||||
XFieldName3 int32 `protobuf:"varint,403,opt,name=_field_name3,json=FieldName3,proto3" json:"_field_name3,omitempty"`
|
||||
Field_Name4_ int32 `protobuf:"varint,404,opt,name=field__name4_,json=fieldName4,proto3" json:"field__name4_,omitempty"`
|
||||
Field0Name5 int32 `protobuf:"varint,405,opt,name=field0name5,proto3" json:"field0name5,omitempty"`
|
||||
Field_0Name6 int32 `protobuf:"varint,406,opt,name=field_0_name6,json=field0Name6,proto3" json:"field_0_name6,omitempty"`
|
||||
FieldName7 int32 `protobuf:"varint,407,opt,name=fieldName7,proto3" json:"fieldName7,omitempty"`
|
||||
FieldName8 int32 `protobuf:"varint,408,opt,name=FieldName8,proto3" json:"FieldName8,omitempty"`
|
||||
Field_Name9 int32 `protobuf:"varint,409,opt,name=field_Name9,json=fieldName9,proto3" json:"field_Name9,omitempty"`
|
||||
Field_Name10 int32 `protobuf:"varint,410,opt,name=Field_Name10,json=FieldName10,proto3" json:"Field_Name10,omitempty"`
|
||||
FIELD_NAME11 int32 `protobuf:"varint,411,opt,name=FIELD_NAME11,json=FIELDNAME11,proto3" json:"FIELD_NAME11,omitempty"`
|
||||
FIELDName12 int32 `protobuf:"varint,412,opt,name=FIELD_name12,json=FIELDName12,proto3" json:"FIELD_name12,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -648,35 +660,6 @@ func (m *TestAllTypes) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_TestAllTypes proto.InternalMessageInfo
|
||||
|
||||
type isTestAllTypes_OneofField interface {
|
||||
isTestAllTypes_OneofField()
|
||||
}
|
||||
|
||||
type TestAllTypes_OneofUint32 struct {
|
||||
OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,oneof"`
|
||||
}
|
||||
type TestAllTypes_OneofNestedMessage struct {
|
||||
OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,oneof"`
|
||||
}
|
||||
type TestAllTypes_OneofString struct {
|
||||
OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,oneof"`
|
||||
}
|
||||
type TestAllTypes_OneofBytes struct {
|
||||
OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
|
||||
func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
|
||||
func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
|
||||
func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
|
||||
|
||||
func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {
|
||||
if m != nil {
|
||||
return m.OneofField
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TestAllTypes) GetOptionalInt32() int32 {
|
||||
if m != nil {
|
||||
return m.OptionalInt32
|
||||
@ -1111,6 +1094,41 @@ func (m *TestAllTypes) GetMapStringForeignEnum() map[string]ForeignEnum {
|
||||
return nil
|
||||
}
|
||||
|
||||
type isTestAllTypes_OneofField interface {
|
||||
isTestAllTypes_OneofField()
|
||||
}
|
||||
|
||||
type TestAllTypes_OneofUint32 struct {
|
||||
OneofUint32 uint32 `protobuf:"varint,111,opt,name=oneof_uint32,json=oneofUint32,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TestAllTypes_OneofNestedMessage struct {
|
||||
OneofNestedMessage *TestAllTypes_NestedMessage `protobuf:"bytes,112,opt,name=oneof_nested_message,json=oneofNestedMessage,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TestAllTypes_OneofString struct {
|
||||
OneofString string `protobuf:"bytes,113,opt,name=oneof_string,json=oneofString,proto3,oneof"`
|
||||
}
|
||||
|
||||
type TestAllTypes_OneofBytes struct {
|
||||
OneofBytes []byte `protobuf:"bytes,114,opt,name=oneof_bytes,json=oneofBytes,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*TestAllTypes_OneofUint32) isTestAllTypes_OneofField() {}
|
||||
|
||||
func (*TestAllTypes_OneofNestedMessage) isTestAllTypes_OneofField() {}
|
||||
|
||||
func (*TestAllTypes_OneofString) isTestAllTypes_OneofField() {}
|
||||
|
||||
func (*TestAllTypes_OneofBytes) isTestAllTypes_OneofField() {}
|
||||
|
||||
func (m *TestAllTypes) GetOneofField() isTestAllTypes_OneofField {
|
||||
if m != nil {
|
||||
return m.OneofField
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TestAllTypes) GetOneofUint32() uint32 {
|
||||
if x, ok := m.GetOneofField().(*TestAllTypes_OneofUint32); ok {
|
||||
return x.OneofUint32
|
||||
@ -1533,8 +1551,8 @@ func _TestAllTypes_OneofSizer(msg proto.Message) (n int) {
|
||||
}
|
||||
|
||||
type TestAllTypes_NestedMessage struct {
|
||||
A int32 `protobuf:"varint,1,opt,name=a" json:"a,omitempty"`
|
||||
Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive" json:"corecursive,omitempty"`
|
||||
A int32 `protobuf:"varint,1,opt,name=a,proto3" json:"a,omitempty"`
|
||||
Corecursive *TestAllTypes `protobuf:"bytes,2,opt,name=corecursive,proto3" json:"corecursive,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -1579,7 +1597,7 @@ func (m *TestAllTypes_NestedMessage) GetCorecursive() *TestAllTypes {
|
||||
}
|
||||
|
||||
type ForeignMessage struct {
|
||||
C int32 `protobuf:"varint,1,opt,name=c" json:"c,omitempty"`
|
||||
C int32 `protobuf:"varint,1,opt,name=c,proto3" json:"c,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
60
vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
generated
vendored
60
vendor/github.com/golang/protobuf/jsonpb/jsonpb.go
generated
vendored
@ -106,6 +106,9 @@ func defaultResolveAny(typeUrl string) (proto.Message, error) {
|
||||
// way they are marshaled to JSON. Messages that implement this should
|
||||
// also implement JSONPBUnmarshaler so that the custom format can be
|
||||
// parsed.
|
||||
//
|
||||
// The JSON marshaling must follow the proto to JSON specification:
|
||||
// https://developers.google.com/protocol-buffers/docs/proto3#json
|
||||
type JSONPBMarshaler interface {
|
||||
MarshalJSONPB(*Marshaler) ([]byte, error)
|
||||
}
|
||||
@ -114,6 +117,9 @@ type JSONPBMarshaler interface {
|
||||
// the way they are unmarshaled from JSON. Messages that implement this
|
||||
// should also implement JSONPBMarshaler so that the custom format can be
|
||||
// produced.
|
||||
//
|
||||
// The JSON unmarshaling must follow the JSON to proto specification:
|
||||
// https://developers.google.com/protocol-buffers/docs/proto3#json
|
||||
type JSONPBUnmarshaler interface {
|
||||
UnmarshalJSONPB(*Unmarshaler, []byte) error
|
||||
}
|
||||
@ -565,6 +571,7 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
|
||||
out.write(m.Indent)
|
||||
}
|
||||
|
||||
// TODO handle map key prop properly
|
||||
b, err := json.Marshal(k.Interface())
|
||||
if err != nil {
|
||||
return err
|
||||
@ -586,7 +593,11 @@ func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v refle
|
||||
out.write(` `)
|
||||
}
|
||||
|
||||
if err := m.marshalValue(out, prop, v.MapIndex(k), indent+m.Indent); err != nil {
|
||||
vprop := prop
|
||||
if prop != nil && prop.MapValProp != nil {
|
||||
vprop = prop.MapValProp
|
||||
}
|
||||
if err := m.marshalValue(out, vprop, v.MapIndex(k), indent+m.Indent); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -778,7 +789,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
|
||||
return nil
|
||||
case "Duration":
|
||||
unq, err := strconv.Unquote(string(inputValue))
|
||||
unq, err := unquote(string(inputValue))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -795,7 +806,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
target.Field(1).SetInt(ns)
|
||||
return nil
|
||||
case "Timestamp":
|
||||
unq, err := strconv.Unquote(string(inputValue))
|
||||
unq, err := unquote(string(inputValue))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -842,7 +853,7 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
target.Field(0).Set(reflect.ValueOf(&stpb.Value_NullValue{}))
|
||||
} else if v, err := strconv.ParseFloat(ivStr, 0); err == nil {
|
||||
target.Field(0).Set(reflect.ValueOf(&stpb.Value_NumberValue{v}))
|
||||
} else if v, err := strconv.Unquote(ivStr); err == nil {
|
||||
} else if v, err := unquote(ivStr); err == nil {
|
||||
target.Field(0).Set(reflect.ValueOf(&stpb.Value_StringValue{v}))
|
||||
} else if v, err := strconv.ParseBool(ivStr); err == nil {
|
||||
target.Field(0).Set(reflect.ValueOf(&stpb.Value_BoolValue{v}))
|
||||
@ -878,6 +889,9 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
target.Set(reflect.New(targetType.Elem()))
|
||||
target = target.Elem()
|
||||
}
|
||||
if targetType.Kind() != reflect.Int32 {
|
||||
return fmt.Errorf("invalid target %q for enum %s", targetType.Kind(), prop.Enum)
|
||||
}
|
||||
target.SetInt(int64(n))
|
||||
return nil
|
||||
}
|
||||
@ -1007,16 +1021,22 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
k = reflect.ValueOf(ks)
|
||||
} else {
|
||||
k = reflect.New(targetType.Key()).Elem()
|
||||
// TODO: pass the correct Properties if needed.
|
||||
if err := u.unmarshalValue(k, json.RawMessage(ks), nil); err != nil {
|
||||
var kprop *proto.Properties
|
||||
if prop != nil && prop.MapKeyProp != nil {
|
||||
kprop = prop.MapKeyProp
|
||||
}
|
||||
if err := u.unmarshalValue(k, json.RawMessage(ks), kprop); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Unmarshal map value.
|
||||
v := reflect.New(targetType.Elem()).Elem()
|
||||
// TODO: pass the correct Properties if needed.
|
||||
if err := u.unmarshalValue(v, raw, nil); err != nil {
|
||||
var vprop *proto.Properties
|
||||
if prop != nil && prop.MapValProp != nil {
|
||||
vprop = prop.MapValProp
|
||||
}
|
||||
if err := u.unmarshalValue(v, raw, vprop); err != nil {
|
||||
return err
|
||||
}
|
||||
target.SetMapIndex(k, v)
|
||||
@ -1025,13 +1045,6 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
return nil
|
||||
}
|
||||
|
||||
// 64-bit integers can be encoded as strings. In this case we drop
|
||||
// the quotes and proceed as normal.
|
||||
isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64
|
||||
if isNum && strings.HasPrefix(string(inputValue), `"`) {
|
||||
inputValue = inputValue[1 : len(inputValue)-1]
|
||||
}
|
||||
|
||||
// Non-finite numbers can be encoded as strings.
|
||||
isFloat := targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64
|
||||
if isFloat {
|
||||
@ -1041,10 +1054,25 @@ func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMe
|
||||
}
|
||||
}
|
||||
|
||||
// integers & floats can be encoded as strings. In this case we drop
|
||||
// the quotes and proceed as normal.
|
||||
isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64 ||
|
||||
targetType.Kind() == reflect.Int32 || targetType.Kind() == reflect.Uint32 ||
|
||||
targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64
|
||||
if isNum && strings.HasPrefix(string(inputValue), `"`) {
|
||||
inputValue = inputValue[1 : len(inputValue)-1]
|
||||
}
|
||||
|
||||
// Use the encoding/json for parsing other value types.
|
||||
return json.Unmarshal(inputValue, target.Addr().Interface())
|
||||
}
|
||||
|
||||
func unquote(s string) (string, error) {
|
||||
var ret string
|
||||
err := json.Unmarshal([]byte(s), &ret)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute.
|
||||
func jsonProperties(f reflect.StructField, origName bool) *proto.Properties {
|
||||
var prop proto.Properties
|
||||
@ -1094,6 +1122,8 @@ func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
|
||||
func (s mapKeys) Less(i, j int) bool {
|
||||
if k := s[i].Kind(); k == s[j].Kind() {
|
||||
switch k {
|
||||
case reflect.String:
|
||||
return s[i].String() < s[j].String()
|
||||
case reflect.Int32, reflect.Int64:
|
||||
return s[i].Int() < s[j].Int()
|
||||
case reflect.Uint32, reflect.Uint64:
|
||||
|
139
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test.go
generated
vendored
139
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test.go
generated
vendored
@ -61,42 +61,110 @@ var (
|
||||
|
||||
simpleObject = &pb.Simple{
|
||||
OInt32: proto.Int32(-32),
|
||||
OInt32Str: proto.Int32(-32),
|
||||
OInt64: proto.Int64(-6400000000),
|
||||
OInt64Str: proto.Int64(-6400000000),
|
||||
OUint32: proto.Uint32(32),
|
||||
OUint32Str: proto.Uint32(32),
|
||||
OUint64: proto.Uint64(6400000000),
|
||||
OUint64Str: proto.Uint64(6400000000),
|
||||
OSint32: proto.Int32(-13),
|
||||
OSint32Str: proto.Int32(-13),
|
||||
OSint64: proto.Int64(-2600000000),
|
||||
OSint64Str: proto.Int64(-2600000000),
|
||||
OFloat: proto.Float32(3.14),
|
||||
OFloatStr: proto.Float32(3.14),
|
||||
ODouble: proto.Float64(6.02214179e23),
|
||||
ODoubleStr: proto.Float64(6.02214179e23),
|
||||
OBool: proto.Bool(true),
|
||||
OString: proto.String("hello \"there\""),
|
||||
OBytes: []byte("beep boop"),
|
||||
}
|
||||
|
||||
simpleObjectJSON = `{` +
|
||||
simpleObjectInputJSON = `{` +
|
||||
`"oBool":true,` +
|
||||
`"oInt32":-32,` +
|
||||
`"oInt64":"-6400000000",` +
|
||||
`"oInt32Str":"-32",` +
|
||||
`"oInt64":-6400000000,` +
|
||||
`"oInt64Str":"-6400000000",` +
|
||||
`"oUint32":32,` +
|
||||
`"oUint64":"6400000000",` +
|
||||
`"oUint32Str":"32",` +
|
||||
`"oUint64":6400000000,` +
|
||||
`"oUint64Str":"6400000000",` +
|
||||
`"oSint32":-13,` +
|
||||
`"oSint64":"-2600000000",` +
|
||||
`"oSint32Str":"-13",` +
|
||||
`"oSint64":-2600000000,` +
|
||||
`"oSint64Str":"-2600000000",` +
|
||||
`"oFloat":3.14,` +
|
||||
`"oFloatStr":"3.14",` +
|
||||
`"oDouble":6.02214179e+23,` +
|
||||
`"oDoubleStr":"6.02214179e+23",` +
|
||||
`"oString":"hello \"there\"",` +
|
||||
`"oBytes":"YmVlcCBib29w"` +
|
||||
`}`
|
||||
|
||||
simpleObjectPrettyJSON = `{
|
||||
simpleObjectOutputJSON = `{` +
|
||||
`"oBool":true,` +
|
||||
`"oInt32":-32,` +
|
||||
`"oInt32Str":-32,` +
|
||||
`"oInt64":"-6400000000",` +
|
||||
`"oInt64Str":"-6400000000",` +
|
||||
`"oUint32":32,` +
|
||||
`"oUint32Str":32,` +
|
||||
`"oUint64":"6400000000",` +
|
||||
`"oUint64Str":"6400000000",` +
|
||||
`"oSint32":-13,` +
|
||||
`"oSint32Str":-13,` +
|
||||
`"oSint64":"-2600000000",` +
|
||||
`"oSint64Str":"-2600000000",` +
|
||||
`"oFloat":3.14,` +
|
||||
`"oFloatStr":3.14,` +
|
||||
`"oDouble":6.02214179e+23,` +
|
||||
`"oDoubleStr":6.02214179e+23,` +
|
||||
`"oString":"hello \"there\"",` +
|
||||
`"oBytes":"YmVlcCBib29w"` +
|
||||
`}`
|
||||
|
||||
simpleObjectInputPrettyJSON = `{
|
||||
"oBool": true,
|
||||
"oInt32": -32,
|
||||
"oInt64": "-6400000000",
|
||||
"oInt32Str": "-32",
|
||||
"oInt64": -6400000000,
|
||||
"oInt64Str": "-6400000000",
|
||||
"oUint32": 32,
|
||||
"oUint64": "6400000000",
|
||||
"oUint32Str": "32",
|
||||
"oUint64": 6400000000,
|
||||
"oUint64Str": "6400000000",
|
||||
"oSint32": -13,
|
||||
"oSint64": "-2600000000",
|
||||
"oSint32Str": "-13",
|
||||
"oSint64": -2600000000,
|
||||
"oSint64Str": "-2600000000",
|
||||
"oFloat": 3.14,
|
||||
"oFloatStr": "3.14",
|
||||
"oDouble": 6.02214179e+23,
|
||||
"oDoubleStr": "6.02214179e+23",
|
||||
"oString": "hello \"there\"",
|
||||
"oBytes": "YmVlcCBib29w"
|
||||
}`
|
||||
|
||||
simpleObjectOutputPrettyJSON = `{
|
||||
"oBool": true,
|
||||
"oInt32": -32,
|
||||
"oInt32Str": -32,
|
||||
"oInt64": "-6400000000",
|
||||
"oInt64Str": "-6400000000",
|
||||
"oUint32": 32,
|
||||
"oUint32Str": 32,
|
||||
"oUint64": "6400000000",
|
||||
"oUint64Str": "6400000000",
|
||||
"oSint32": -13,
|
||||
"oSint32Str": -13,
|
||||
"oSint64": "-2600000000",
|
||||
"oSint64Str": "-2600000000",
|
||||
"oFloat": 3.14,
|
||||
"oFloatStr": 3.14,
|
||||
"oDouble": 6.02214179e+23,
|
||||
"oDoubleStr": 6.02214179e+23,
|
||||
"oString": "hello \"there\"",
|
||||
"oBytes": "YmVlcCBib29w"
|
||||
}`
|
||||
@ -343,8 +411,8 @@ var marshalingTests = []struct {
|
||||
pb proto.Message
|
||||
json string
|
||||
}{
|
||||
{"simple flat object", marshaler, simpleObject, simpleObjectJSON},
|
||||
{"simple pretty object", marshalerAllOptions, simpleObject, simpleObjectPrettyJSON},
|
||||
{"simple flat object", marshaler, simpleObject, simpleObjectOutputJSON},
|
||||
{"simple pretty object", marshalerAllOptions, simpleObject, simpleObjectOutputPrettyJSON},
|
||||
{"non-finite floats fields object", marshaler, nonFinites, nonFinitesJSON},
|
||||
{"repeated fields flat object", marshaler, repeatsObject, repeatsObjectJSON},
|
||||
{"repeated fields pretty object", marshalerAllOptions, repeatsObject, repeatsObjectPrettyJSON},
|
||||
@ -385,8 +453,7 @@ var marshalingTests = []struct {
|
||||
{"map<int64, string>", marshaler, &pb.Mappy{Buggy: map[int64]string{1234: "yup"}},
|
||||
`{"buggy":{"1234":"yup"}}`},
|
||||
{"map<bool, bool>", marshaler, &pb.Mappy{Booly: map[bool]bool{false: true}}, `{"booly":{"false":true}}`},
|
||||
// TODO: This is broken.
|
||||
//{"map<string, enum>", marshaler, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":"ROMAN"}`},
|
||||
{"map<string, enum>", marshaler, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":"ROMAN"}}`},
|
||||
{"map<string, enum as int>", Marshaler{EnumsAsInts: true}, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}, `{"enumy":{"XIV":2}}`},
|
||||
{"map<int32, bool>", marshaler, &pb.Mappy{S32Booly: map[int32]bool{1: true, 3: false, 10: true, 12: false}}, `{"s32booly":{"1":true,"3":false,"10":true,"12":false}}`},
|
||||
{"map<int64, bool>", marshaler, &pb.Mappy{S64Booly: map[int64]bool{1: true, 3: false, 10: true, 12: false}}, `{"s64booly":{"1":true,"3":false,"10":true,"12":false}}`},
|
||||
@ -505,7 +572,7 @@ func TestMarshalIllegalTime(t *testing.T) {
|
||||
|
||||
func TestMarshalJSONPBMarshaler(t *testing.T) {
|
||||
rawJson := `{ "foo": "bar", "baz": [0, 1, 2, 3] }`
|
||||
msg := dynamicMessage{rawJson: rawJson}
|
||||
msg := dynamicMessage{RawJson: rawJson}
|
||||
str, err := new(Marshaler).MarshalToString(&msg)
|
||||
if err != nil {
|
||||
t.Errorf("an unexpected error occurred when marshalling JSONPBMarshaler: %v", err)
|
||||
@ -516,7 +583,7 @@ func TestMarshalJSONPBMarshaler(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMarshalAnyJSONPBMarshaler(t *testing.T) {
|
||||
msg := dynamicMessage{rawJson: `{ "foo": "bar", "baz": [0, 1, 2, 3] }`}
|
||||
msg := dynamicMessage{RawJson: `{ "foo": "bar", "baz": [0, 1, 2, 3] }`}
|
||||
a, err := ptypes.MarshalAny(&msg)
|
||||
if err != nil {
|
||||
t.Errorf("an unexpected error occurred when marshalling to Any: %v", err)
|
||||
@ -534,7 +601,7 @@ func TestMarshalAnyJSONPBMarshaler(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMarshalWithCustomValidation(t *testing.T) {
|
||||
msg := dynamicMessage{rawJson: `{ "foo": "bar", "baz": [0, 1, 2, 3] }`, dummy: &dynamicMessage{}}
|
||||
msg := dynamicMessage{RawJson: `{ "foo": "bar", "baz": [0, 1, 2, 3] }`, Dummy: &dynamicMessage{}}
|
||||
|
||||
js, err := new(Marshaler).MarshalToString(&msg)
|
||||
if err != nil {
|
||||
@ -637,8 +704,8 @@ var unmarshalingTests = []struct {
|
||||
json string
|
||||
pb proto.Message
|
||||
}{
|
||||
{"simple flat object", Unmarshaler{}, simpleObjectJSON, simpleObject},
|
||||
{"simple pretty object", Unmarshaler{}, simpleObjectPrettyJSON, simpleObject},
|
||||
{"simple flat object", Unmarshaler{}, simpleObjectInputJSON, simpleObject},
|
||||
{"simple pretty object", Unmarshaler{}, simpleObjectInputPrettyJSON, simpleObject},
|
||||
{"repeated fields flat object", Unmarshaler{}, repeatsObjectJSON, repeatsObject},
|
||||
{"repeated fields pretty object", Unmarshaler{}, repeatsObjectPrettyJSON, repeatsObject},
|
||||
{"nested message/enum flat object", Unmarshaler{}, complexObjectJSON, complexObject},
|
||||
@ -680,8 +747,7 @@ var unmarshalingTests = []struct {
|
||||
{"Any with message and indent", Unmarshaler{}, anySimplePrettyJSON, anySimple},
|
||||
{"Any with WKT", Unmarshaler{}, anyWellKnownJSON, anyWellKnown},
|
||||
{"Any with WKT and indent", Unmarshaler{}, anyWellKnownPrettyJSON, anyWellKnown},
|
||||
// TODO: This is broken.
|
||||
//{"map<string, enum>", Unmarshaler{}, `{"enumy":{"XIV":"ROMAN"}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
|
||||
{"map<string, enum>", Unmarshaler{}, `{"enumy":{"XIV":"ROMAN"}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
|
||||
{"map<string, enum as int>", Unmarshaler{}, `{"enumy":{"XIV":2}}`, &pb.Mappy{Enumy: map[string]pb.Numeral{"XIV": pb.Numeral_ROMAN}}},
|
||||
{"oneof", Unmarshaler{}, `{"salary":31000}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Salary{31000}}},
|
||||
{"oneof spec name", Unmarshaler{}, `{"Country":"Australia"}`, &pb.MsgWithOneof{Union: &pb.MsgWithOneof_Country{"Australia"}}},
|
||||
@ -693,9 +759,11 @@ var unmarshalingTests = []struct {
|
||||
|
||||
{"Duration", Unmarshaler{}, `{"dur":"3.000s"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}},
|
||||
{"Duration", Unmarshaler{}, `{"dur":"4s"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 4}}},
|
||||
{"Duration with unicode", Unmarshaler{}, `{"dur": "3\u0073"}`, &pb.KnownTypes{Dur: &durpb.Duration{Seconds: 3}}},
|
||||
{"null Duration", Unmarshaler{}, `{"dur":null}`, &pb.KnownTypes{Dur: nil}},
|
||||
{"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20.021Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 21e6}}},
|
||||
{"Timestamp", Unmarshaler{}, `{"ts":"2014-05-13T16:53:20Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}},
|
||||
{"Timestamp with unicode", Unmarshaler{}, `{"ts": "2014-05-13T16:53:20\u005a"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: 14e8, Nanos: 0}}},
|
||||
{"PreEpochTimestamp", Unmarshaler{}, `{"ts":"1969-12-31T23:59:58.999999995Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: -2, Nanos: 999999995}}},
|
||||
{"ZeroTimeTimestamp", Unmarshaler{}, `{"ts":"0001-01-01T00:00:00Z"}`, &pb.KnownTypes{Ts: &tspb.Timestamp{Seconds: -62135596800, Nanos: 0}}},
|
||||
{"null Timestamp", Unmarshaler{}, `{"ts":null}`, &pb.KnownTypes{Ts: nil}},
|
||||
@ -752,6 +820,14 @@ var unmarshalingTests = []struct {
|
||||
{"UInt32Value", Unmarshaler{}, `{"u32":4}`, &pb.KnownTypes{U32: &wpb.UInt32Value{Value: 4}}},
|
||||
{"BoolValue", Unmarshaler{}, `{"bool":true}`, &pb.KnownTypes{Bool: &wpb.BoolValue{Value: true}}},
|
||||
{"StringValue", Unmarshaler{}, `{"str":"plush"}`, &pb.KnownTypes{Str: &wpb.StringValue{Value: "plush"}}},
|
||||
{"StringValue containing escaped character", Unmarshaler{}, `{"str":"a\/b"}`, &pb.KnownTypes{Str: &wpb.StringValue{Value: "a/b"}}},
|
||||
{"StructValue containing StringValue's", Unmarshaler{}, `{"escaped": "a\/b", "unicode": "\u00004E16\u0000754C"}`,
|
||||
&stpb.Struct{
|
||||
Fields: map[string]*stpb.Value{
|
||||
"escaped": {Kind: &stpb.Value_StringValue{"a/b"}},
|
||||
"unicode": {Kind: &stpb.Value_StringValue{"\u00004E16\u0000754C"}},
|
||||
},
|
||||
}},
|
||||
{"BytesValue", Unmarshaler{}, `{"bytes":"d293"}`, &pb.KnownTypes{Bytes: &wpb.BytesValue{Value: []byte("wow")}}},
|
||||
|
||||
// Ensure that `null` as a value ends up with a nil pointer instead of a [type]Value struct.
|
||||
@ -776,7 +852,7 @@ func TestUnmarshaling(t *testing.T) {
|
||||
|
||||
err := tt.unmarshaler.Unmarshal(strings.NewReader(tt.json), p)
|
||||
if err != nil {
|
||||
t.Errorf("%s: %v", tt.desc, err)
|
||||
t.Errorf("unmarshalling %s: %v", tt.desc, err)
|
||||
continue
|
||||
}
|
||||
|
||||
@ -854,6 +930,11 @@ var unmarshalingShouldError = []struct {
|
||||
{"gibberish", "{adskja123;l23=-=", new(pb.Simple)},
|
||||
{"unknown field", `{"unknown": "foo"}`, new(pb.Simple)},
|
||||
{"unknown enum name", `{"hilarity":"DAVE"}`, new(proto3pb.Message)},
|
||||
{"Duration containing invalid character", `{"dur": "3\U0073"}`, &pb.KnownTypes{}},
|
||||
{"Timestamp containing invalid character", `{"ts": "2014-05-13T16:53:20\U005a"}`, &pb.KnownTypes{}},
|
||||
{"StringValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &pb.KnownTypes{}},
|
||||
{"StructValue containing invalid character", `{"str": "\U00004E16\U0000754C"}`, &stpb.Struct{}},
|
||||
{"repeated proto3 enum with non array input", `{"rFunny":"PUNS"}`, &proto3pb.Message{RFunny: []proto3pb.Message_Humour{}}},
|
||||
}
|
||||
|
||||
func TestUnmarshalingBadInput(t *testing.T) {
|
||||
@ -930,8 +1011,8 @@ func TestUnmarshalJSONPBUnmarshaler(t *testing.T) {
|
||||
if err := Unmarshal(strings.NewReader(rawJson), &msg); err != nil {
|
||||
t.Errorf("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v", err)
|
||||
}
|
||||
if msg.rawJson != rawJson {
|
||||
t.Errorf("message contents not set correctly after unmarshalling JSON: got %s, wanted %s", msg.rawJson, rawJson)
|
||||
if msg.RawJson != rawJson {
|
||||
t.Errorf("message contents not set correctly after unmarshalling JSON: got %s, wanted %s", msg.RawJson, rawJson)
|
||||
}
|
||||
}
|
||||
|
||||
@ -955,7 +1036,7 @@ func TestUnmarshalAnyJSONPBUnmarshaler(t *testing.T) {
|
||||
t.Errorf("an unexpected error occurred when parsing into JSONPBUnmarshaler: %v", err)
|
||||
}
|
||||
|
||||
dm := &dynamicMessage{rawJson: `{"baz":[0,1,2,3],"foo":"bar"}`}
|
||||
dm := &dynamicMessage{RawJson: `{"baz":[0,1,2,3],"foo":"bar"}`}
|
||||
var want anypb.Any
|
||||
if b, err := proto.Marshal(dm); err != nil {
|
||||
t.Errorf("an unexpected error occurred when marshaling message: %v", err)
|
||||
@ -1016,30 +1097,30 @@ func (s *stringField) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {
|
||||
// dynamicMessage implements protobuf.Message but is not a normal generated message type.
|
||||
// It provides implementations of JSONPBMarshaler and JSONPBUnmarshaler for JSON support.
|
||||
type dynamicMessage struct {
|
||||
rawJson string `protobuf:"bytes,1,opt,name=rawJson"`
|
||||
RawJson string `protobuf:"bytes,1,opt,name=rawJson"`
|
||||
|
||||
// an unexported nested message is present just to ensure that it
|
||||
// won't result in a panic (see issue #509)
|
||||
dummy *dynamicMessage `protobuf:"bytes,2,opt,name=dummy"`
|
||||
Dummy *dynamicMessage `protobuf:"bytes,2,opt,name=dummy"`
|
||||
}
|
||||
|
||||
func (m *dynamicMessage) Reset() {
|
||||
m.rawJson = "{}"
|
||||
m.RawJson = "{}"
|
||||
}
|
||||
|
||||
func (m *dynamicMessage) String() string {
|
||||
return m.rawJson
|
||||
return m.RawJson
|
||||
}
|
||||
|
||||
func (m *dynamicMessage) ProtoMessage() {
|
||||
}
|
||||
|
||||
func (m *dynamicMessage) MarshalJSONPB(jm *Marshaler) ([]byte, error) {
|
||||
return []byte(m.rawJson), nil
|
||||
return []byte(m.RawJson), nil
|
||||
}
|
||||
|
||||
func (m *dynamicMessage) UnmarshalJSONPB(jum *Unmarshaler, js []byte) error {
|
||||
m.rawJson = string(js)
|
||||
m.RawJson = string(js)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
28
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go
generated
vendored
28
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/more_test_objects.pb.go
generated
vendored
@ -45,7 +45,7 @@ func (Numeral) EnumDescriptor() ([]byte, []int) {
|
||||
}
|
||||
|
||||
type Simple3 struct {
|
||||
Dub float64 `protobuf:"fixed64,1,opt,name=dub" json:"dub,omitempty"`
|
||||
Dub float64 `protobuf:"fixed64,1,opt,name=dub,proto3" json:"dub,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -83,7 +83,7 @@ func (m *Simple3) GetDub() float64 {
|
||||
}
|
||||
|
||||
type SimpleSlice3 struct {
|
||||
Slices []string `protobuf:"bytes,1,rep,name=slices" json:"slices,omitempty"`
|
||||
Slices []string `protobuf:"bytes,1,rep,name=slices,proto3" json:"slices,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -121,7 +121,7 @@ func (m *SimpleSlice3) GetSlices() []string {
|
||||
}
|
||||
|
||||
type SimpleMap3 struct {
|
||||
Stringy map[string]string `protobuf:"bytes,1,rep,name=stringy" json:"stringy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Stringy map[string]string `protobuf:"bytes,1,rep,name=stringy,proto3" json:"stringy,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -159,7 +159,7 @@ func (m *SimpleMap3) GetStringy() map[string]string {
|
||||
}
|
||||
|
||||
type SimpleNull3 struct {
|
||||
Simple *Simple3 `protobuf:"bytes,1,opt,name=simple" json:"simple,omitempty"`
|
||||
Simple *Simple3 `protobuf:"bytes,1,opt,name=simple,proto3" json:"simple,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -197,16 +197,16 @@ func (m *SimpleNull3) GetSimple() *Simple3 {
|
||||
}
|
||||
|
||||
type Mappy struct {
|
||||
Nummy map[int64]int32 `protobuf:"bytes,1,rep,name=nummy" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
Strry map[string]string `protobuf:"bytes,2,rep,name=strry" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Buggy map[int64]string `protobuf:"bytes,4,rep,name=buggy" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Booly map[bool]bool `protobuf:"bytes,5,rep,name=booly" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"varint,2,opt,name=value,enum=jsonpb.Numeral"`
|
||||
S32Booly map[int32]bool `protobuf:"bytes,7,rep,name=s32booly" json:"s32booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
S64Booly map[int64]bool `protobuf:"bytes,8,rep,name=s64booly" json:"s64booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
U32Booly map[uint32]bool `protobuf:"bytes,9,rep,name=u32booly" json:"u32booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
U64Booly map[uint64]bool `protobuf:"bytes,10,rep,name=u64booly" json:"u64booly,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
Nummy map[int64]int32 `protobuf:"bytes,1,rep,name=nummy,proto3" json:"nummy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
Strry map[string]string `protobuf:"bytes,2,rep,name=strry,proto3" json:"strry,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
Objjy map[int32]*Simple3 `protobuf:"bytes,3,rep,name=objjy,proto3" json:"objjy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
Buggy map[int64]string `protobuf:"bytes,4,rep,name=buggy,proto3" json:"buggy,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
Booly map[bool]bool `protobuf:"bytes,5,rep,name=booly,proto3" json:"booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
Enumy map[string]Numeral `protobuf:"bytes,6,rep,name=enumy,proto3" json:"enumy,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3,enum=jsonpb.Numeral"`
|
||||
S32Booly map[int32]bool `protobuf:"bytes,7,rep,name=s32booly,proto3" json:"s32booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
S64Booly map[int64]bool `protobuf:"bytes,8,rep,name=s64booly,proto3" json:"s64booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
U32Booly map[uint32]bool `protobuf:"bytes,9,rep,name=u32booly,proto3" json:"u32booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
U64Booly map[uint64]bool `protobuf:"bytes,10,rep,name=u64booly,proto3" json:"u64booly,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
301
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go
generated
vendored
301
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.pb.go
generated
vendored
@ -59,22 +59,30 @@ func (x *Widget_Color) UnmarshalJSON(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
func (Widget_Color) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{3, 0}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{3, 0}
|
||||
}
|
||||
|
||||
// Test message for holding primitive types.
|
||||
type Simple struct {
|
||||
OBool *bool `protobuf:"varint,1,opt,name=o_bool,json=oBool" json:"o_bool,omitempty"`
|
||||
OInt32 *int32 `protobuf:"varint,2,opt,name=o_int32,json=oInt32" json:"o_int32,omitempty"`
|
||||
OInt64 *int64 `protobuf:"varint,3,opt,name=o_int64,json=oInt64" json:"o_int64,omitempty"`
|
||||
OUint32 *uint32 `protobuf:"varint,4,opt,name=o_uint32,json=oUint32" json:"o_uint32,omitempty"`
|
||||
OUint64 *uint64 `protobuf:"varint,5,opt,name=o_uint64,json=oUint64" json:"o_uint64,omitempty"`
|
||||
OSint32 *int32 `protobuf:"zigzag32,6,opt,name=o_sint32,json=oSint32" json:"o_sint32,omitempty"`
|
||||
OSint64 *int64 `protobuf:"zigzag64,7,opt,name=o_sint64,json=oSint64" json:"o_sint64,omitempty"`
|
||||
OFloat *float32 `protobuf:"fixed32,8,opt,name=o_float,json=oFloat" json:"o_float,omitempty"`
|
||||
ODouble *float64 `protobuf:"fixed64,9,opt,name=o_double,json=oDouble" json:"o_double,omitempty"`
|
||||
OString *string `protobuf:"bytes,10,opt,name=o_string,json=oString" json:"o_string,omitempty"`
|
||||
OBytes []byte `protobuf:"bytes,11,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"`
|
||||
OInt32Str *int32 `protobuf:"varint,3,opt,name=o_int32_str,json=oInt32Str" json:"o_int32_str,omitempty"`
|
||||
OInt64 *int64 `protobuf:"varint,4,opt,name=o_int64,json=oInt64" json:"o_int64,omitempty"`
|
||||
OInt64Str *int64 `protobuf:"varint,5,opt,name=o_int64_str,json=oInt64Str" json:"o_int64_str,omitempty"`
|
||||
OUint32 *uint32 `protobuf:"varint,6,opt,name=o_uint32,json=oUint32" json:"o_uint32,omitempty"`
|
||||
OUint32Str *uint32 `protobuf:"varint,7,opt,name=o_uint32_str,json=oUint32Str" json:"o_uint32_str,omitempty"`
|
||||
OUint64 *uint64 `protobuf:"varint,8,opt,name=o_uint64,json=oUint64" json:"o_uint64,omitempty"`
|
||||
OUint64Str *uint64 `protobuf:"varint,9,opt,name=o_uint64_str,json=oUint64Str" json:"o_uint64_str,omitempty"`
|
||||
OSint32 *int32 `protobuf:"zigzag32,10,opt,name=o_sint32,json=oSint32" json:"o_sint32,omitempty"`
|
||||
OSint32Str *int32 `protobuf:"zigzag32,11,opt,name=o_sint32_str,json=oSint32Str" json:"o_sint32_str,omitempty"`
|
||||
OSint64 *int64 `protobuf:"zigzag64,12,opt,name=o_sint64,json=oSint64" json:"o_sint64,omitempty"`
|
||||
OSint64Str *int64 `protobuf:"zigzag64,13,opt,name=o_sint64_str,json=oSint64Str" json:"o_sint64_str,omitempty"`
|
||||
OFloat *float32 `protobuf:"fixed32,14,opt,name=o_float,json=oFloat" json:"o_float,omitempty"`
|
||||
OFloatStr *float32 `protobuf:"fixed32,15,opt,name=o_float_str,json=oFloatStr" json:"o_float_str,omitempty"`
|
||||
ODouble *float64 `protobuf:"fixed64,16,opt,name=o_double,json=oDouble" json:"o_double,omitempty"`
|
||||
ODoubleStr *float64 `protobuf:"fixed64,17,opt,name=o_double_str,json=oDoubleStr" json:"o_double_str,omitempty"`
|
||||
OString *string `protobuf:"bytes,18,opt,name=o_string,json=oString" json:"o_string,omitempty"`
|
||||
OBytes []byte `protobuf:"bytes,19,opt,name=o_bytes,json=oBytes" json:"o_bytes,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -84,7 +92,7 @@ func (m *Simple) Reset() { *m = Simple{} }
|
||||
func (m *Simple) String() string { return proto.CompactTextString(m) }
|
||||
func (*Simple) ProtoMessage() {}
|
||||
func (*Simple) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{0}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{0}
|
||||
}
|
||||
func (m *Simple) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Simple.Unmarshal(m, b)
|
||||
@ -118,6 +126,13 @@ func (m *Simple) GetOInt32() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOInt32Str() int32 {
|
||||
if m != nil && m.OInt32Str != nil {
|
||||
return *m.OInt32Str
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOInt64() int64 {
|
||||
if m != nil && m.OInt64 != nil {
|
||||
return *m.OInt64
|
||||
@ -125,6 +140,13 @@ func (m *Simple) GetOInt64() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOInt64Str() int64 {
|
||||
if m != nil && m.OInt64Str != nil {
|
||||
return *m.OInt64Str
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOUint32() uint32 {
|
||||
if m != nil && m.OUint32 != nil {
|
||||
return *m.OUint32
|
||||
@ -132,6 +154,13 @@ func (m *Simple) GetOUint32() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOUint32Str() uint32 {
|
||||
if m != nil && m.OUint32Str != nil {
|
||||
return *m.OUint32Str
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOUint64() uint64 {
|
||||
if m != nil && m.OUint64 != nil {
|
||||
return *m.OUint64
|
||||
@ -139,6 +168,13 @@ func (m *Simple) GetOUint64() uint64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOUint64Str() uint64 {
|
||||
if m != nil && m.OUint64Str != nil {
|
||||
return *m.OUint64Str
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOSint32() int32 {
|
||||
if m != nil && m.OSint32 != nil {
|
||||
return *m.OSint32
|
||||
@ -146,6 +182,13 @@ func (m *Simple) GetOSint32() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOSint32Str() int32 {
|
||||
if m != nil && m.OSint32Str != nil {
|
||||
return *m.OSint32Str
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOSint64() int64 {
|
||||
if m != nil && m.OSint64 != nil {
|
||||
return *m.OSint64
|
||||
@ -153,6 +196,13 @@ func (m *Simple) GetOSint64() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOSint64Str() int64 {
|
||||
if m != nil && m.OSint64Str != nil {
|
||||
return *m.OSint64Str
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOFloat() float32 {
|
||||
if m != nil && m.OFloat != nil {
|
||||
return *m.OFloat
|
||||
@ -160,6 +210,13 @@ func (m *Simple) GetOFloat() float32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOFloatStr() float32 {
|
||||
if m != nil && m.OFloatStr != nil {
|
||||
return *m.OFloatStr
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetODouble() float64 {
|
||||
if m != nil && m.ODouble != nil {
|
||||
return *m.ODouble
|
||||
@ -167,6 +224,13 @@ func (m *Simple) GetODouble() float64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetODoubleStr() float64 {
|
||||
if m != nil && m.ODoubleStr != nil {
|
||||
return *m.ODoubleStr
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *Simple) GetOString() string {
|
||||
if m != nil && m.OString != nil {
|
||||
return *m.OString
|
||||
@ -198,7 +262,7 @@ func (m *NonFinites) Reset() { *m = NonFinites{} }
|
||||
func (m *NonFinites) String() string { return proto.CompactTextString(m) }
|
||||
func (*NonFinites) ProtoMessage() {}
|
||||
func (*NonFinites) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{1}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{1}
|
||||
}
|
||||
func (m *NonFinites) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NonFinites.Unmarshal(m, b)
|
||||
@ -282,7 +346,7 @@ func (m *Repeats) Reset() { *m = Repeats{} }
|
||||
func (m *Repeats) String() string { return proto.CompactTextString(m) }
|
||||
func (*Repeats) ProtoMessage() {}
|
||||
func (*Repeats) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{2}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{2}
|
||||
}
|
||||
func (m *Repeats) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Repeats.Unmarshal(m, b)
|
||||
@ -396,7 +460,7 @@ func (m *Widget) Reset() { *m = Widget{} }
|
||||
func (m *Widget) String() string { return proto.CompactTextString(m) }
|
||||
func (*Widget) ProtoMessage() {}
|
||||
func (*Widget) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{3}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{3}
|
||||
}
|
||||
func (m *Widget) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Widget.Unmarshal(m, b)
|
||||
@ -470,7 +534,7 @@ func (m *Maps) Reset() { *m = Maps{} }
|
||||
func (m *Maps) String() string { return proto.CompactTextString(m) }
|
||||
func (*Maps) ProtoMessage() {}
|
||||
func (*Maps) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{4}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{4}
|
||||
}
|
||||
func (m *Maps) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Maps.Unmarshal(m, b)
|
||||
@ -521,7 +585,7 @@ func (m *MsgWithOneof) Reset() { *m = MsgWithOneof{} }
|
||||
func (m *MsgWithOneof) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithOneof) ProtoMessage() {}
|
||||
func (*MsgWithOneof) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{5}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{5}
|
||||
}
|
||||
func (m *MsgWithOneof) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgWithOneof.Unmarshal(m, b)
|
||||
@ -548,23 +612,31 @@ type isMsgWithOneof_Union interface {
|
||||
type MsgWithOneof_Title struct {
|
||||
Title string `protobuf:"bytes,1,opt,name=title,oneof"`
|
||||
}
|
||||
|
||||
type MsgWithOneof_Salary struct {
|
||||
Salary int64 `protobuf:"varint,2,opt,name=salary,oneof"`
|
||||
}
|
||||
|
||||
type MsgWithOneof_Country struct {
|
||||
Country string `protobuf:"bytes,3,opt,name=Country,oneof"`
|
||||
}
|
||||
|
||||
type MsgWithOneof_HomeAddress struct {
|
||||
HomeAddress string `protobuf:"bytes,4,opt,name=home_address,json=homeAddress,oneof"`
|
||||
}
|
||||
|
||||
type MsgWithOneof_MsgWithRequired struct {
|
||||
MsgWithRequired *MsgWithRequired `protobuf:"bytes,5,opt,name=msg_with_required,json=msgWithRequired,oneof"`
|
||||
}
|
||||
|
||||
func (*MsgWithOneof_Title) isMsgWithOneof_Union() {}
|
||||
|
||||
func (*MsgWithOneof_Salary) isMsgWithOneof_Union() {}
|
||||
|
||||
func (*MsgWithOneof_Country) isMsgWithOneof_Union() {}
|
||||
|
||||
func (*MsgWithOneof_HomeAddress) isMsgWithOneof_Union() {}
|
||||
|
||||
func (*MsgWithOneof_MsgWithRequired) isMsgWithOneof_Union() {}
|
||||
|
||||
func (m *MsgWithOneof) GetUnion() isMsgWithOneof_Union {
|
||||
@ -735,7 +807,7 @@ func (m *Real) Reset() { *m = Real{} }
|
||||
func (m *Real) String() string { return proto.CompactTextString(m) }
|
||||
func (*Real) ProtoMessage() {}
|
||||
func (*Real) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{6}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{6}
|
||||
}
|
||||
|
||||
var extRange_Real = []proto.ExtensionRange{
|
||||
@ -782,7 +854,7 @@ func (m *Complex) Reset() { *m = Complex{} }
|
||||
func (m *Complex) String() string { return proto.CompactTextString(m) }
|
||||
func (*Complex) ProtoMessage() {}
|
||||
func (*Complex) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{7}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{7}
|
||||
}
|
||||
|
||||
var extRange_Complex = []proto.ExtensionRange{
|
||||
@ -851,7 +923,7 @@ func (m *KnownTypes) Reset() { *m = KnownTypes{} }
|
||||
func (m *KnownTypes) String() string { return proto.CompactTextString(m) }
|
||||
func (*KnownTypes) ProtoMessage() {}
|
||||
func (*KnownTypes) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{8}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{8}
|
||||
}
|
||||
func (m *KnownTypes) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_KnownTypes.Unmarshal(m, b)
|
||||
@ -988,7 +1060,7 @@ func (m *MsgWithRequired) Reset() { *m = MsgWithRequired{} }
|
||||
func (m *MsgWithRequired) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithRequired) ProtoMessage() {}
|
||||
func (*MsgWithRequired) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{9}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{9}
|
||||
}
|
||||
func (m *MsgWithRequired) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgWithRequired.Unmarshal(m, b)
|
||||
@ -1028,7 +1100,7 @@ func (m *MsgWithIndirectRequired) Reset() { *m = MsgWithIndirectRequired
|
||||
func (m *MsgWithIndirectRequired) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithIndirectRequired) ProtoMessage() {}
|
||||
func (*MsgWithIndirectRequired) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{10}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{10}
|
||||
}
|
||||
func (m *MsgWithIndirectRequired) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgWithIndirectRequired.Unmarshal(m, b)
|
||||
@ -1080,7 +1152,7 @@ func (m *MsgWithRequiredBytes) Reset() { *m = MsgWithRequiredBytes{} }
|
||||
func (m *MsgWithRequiredBytes) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithRequiredBytes) ProtoMessage() {}
|
||||
func (*MsgWithRequiredBytes) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{11}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{11}
|
||||
}
|
||||
func (m *MsgWithRequiredBytes) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgWithRequiredBytes.Unmarshal(m, b)
|
||||
@ -1118,7 +1190,7 @@ func (m *MsgWithRequiredWKT) Reset() { *m = MsgWithRequiredWKT{} }
|
||||
func (m *MsgWithRequiredWKT) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgWithRequiredWKT) ProtoMessage() {}
|
||||
func (*MsgWithRequiredWKT) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_objects_c6f6c615ab823e65, []int{12}
|
||||
return fileDescriptor_test_objects_a4d3e593ea3c686f, []int{12}
|
||||
}
|
||||
func (m *MsgWithRequiredWKT) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgWithRequiredWKT.Unmarshal(m, b)
|
||||
@ -1186,93 +1258,100 @@ func init() {
|
||||
proto.RegisterExtension(E_Extm)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("test_objects.proto", fileDescriptor_test_objects_c6f6c615ab823e65) }
|
||||
func init() { proto.RegisterFile("test_objects.proto", fileDescriptor_test_objects_a4d3e593ea3c686f) }
|
||||
|
||||
var fileDescriptor_test_objects_c6f6c615ab823e65 = []byte{
|
||||
// 1357 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdd, 0x72, 0x13, 0xc7,
|
||||
0x12, 0xf6, 0xee, 0x6a, 0xf5, 0xd3, 0xf2, 0x1f, 0x83, 0x81, 0xc5, 0x87, 0x73, 0x8e, 0x4a, 0x70,
|
||||
0x38, 0x0a, 0xc4, 0xa2, 0x22, 0xbb, 0x5c, 0x84, 0xe4, 0x06, 0x63, 0x13, 0x08, 0xe0, 0xa4, 0xc6,
|
||||
0x26, 0x5c, 0xaa, 0x56, 0xde, 0x91, 0x59, 0xb2, 0xbb, 0xa3, 0xcc, 0xcc, 0xda, 0xa8, 0x92, 0x54,
|
||||
0xf9, 0x19, 0x52, 0x79, 0x82, 0x54, 0x25, 0x8f, 0x90, 0x8b, 0xbc, 0x45, 0xde, 0x28, 0x35, 0x3d,
|
||||
0xb3, 0x5a, 0x59, 0x42, 0x95, 0x5c, 0x79, 0xbb, 0xfb, 0xeb, 0x4f, 0x33, 0xfd, 0xf5, 0x74, 0x1b,
|
||||
0x88, 0x62, 0x52, 0xf5, 0xf9, 0xe0, 0x1d, 0x3b, 0x51, 0xb2, 0x3b, 0x12, 0x5c, 0x71, 0x52, 0x7d,
|
||||
0x27, 0x79, 0x36, 0x1a, 0x6c, 0xde, 0x3c, 0xe5, 0xfc, 0x34, 0x61, 0x0f, 0xd0, 0x3b, 0xc8, 0x87,
|
||||
0x0f, 0xc2, 0x6c, 0x6c, 0x20, 0x9b, 0xff, 0x99, 0x0d, 0x45, 0xb9, 0x08, 0x55, 0xcc, 0x33, 0x1b,
|
||||
0xbf, 0x35, 0x1b, 0x97, 0x4a, 0xe4, 0x27, 0xca, 0x46, 0xff, 0x3b, 0x1b, 0x55, 0x71, 0xca, 0xa4,
|
||||
0x0a, 0xd3, 0xd1, 0x22, 0xfa, 0x73, 0x11, 0x8e, 0x46, 0x4c, 0xd8, 0x13, 0xb6, 0x7f, 0x75, 0xa1,
|
||||
0x7a, 0x14, 0xa7, 0xa3, 0x84, 0x91, 0x6b, 0x50, 0xe5, 0xfd, 0x01, 0xe7, 0x49, 0xe0, 0xb4, 0x9c,
|
||||
0x4e, 0x9d, 0xfa, 0x7c, 0x8f, 0xf3, 0x84, 0xdc, 0x80, 0x1a, 0xef, 0xc7, 0x99, 0xda, 0xee, 0x05,
|
||||
0x6e, 0xcb, 0xe9, 0xf8, 0xb4, 0xca, 0x9f, 0x6b, 0x6b, 0x12, 0xd8, 0xdd, 0x09, 0xbc, 0x96, 0xd3,
|
||||
0xf1, 0x4c, 0x60, 0x77, 0x87, 0xdc, 0x84, 0x3a, 0xef, 0xe7, 0x26, 0xa5, 0xd2, 0x72, 0x3a, 0x2b,
|
||||
0xb4, 0xc6, 0x5f, 0xa3, 0x59, 0x86, 0x76, 0x77, 0x02, 0xbf, 0xe5, 0x74, 0x2a, 0x36, 0x54, 0x64,
|
||||
0x49, 0x93, 0x55, 0x6d, 0x39, 0x9d, 0x2b, 0xb4, 0xc6, 0x8f, 0xa6, 0xb2, 0xa4, 0xc9, 0xaa, 0xb5,
|
||||
0x9c, 0x0e, 0xb1, 0xa1, 0xdd, 0x1d, 0x73, 0x88, 0x61, 0xc2, 0x43, 0x15, 0xd4, 0x5b, 0x4e, 0xc7,
|
||||
0xa5, 0x55, 0xfe, 0x54, 0x5b, 0x26, 0x27, 0xe2, 0xf9, 0x20, 0x61, 0x41, 0xa3, 0xe5, 0x74, 0x1c,
|
||||
0x5a, 0xe3, 0xfb, 0x68, 0x5a, 0x3a, 0x25, 0xe2, 0xec, 0x34, 0x80, 0x96, 0xd3, 0x69, 0x68, 0x3a,
|
||||
0x34, 0x0d, 0xdd, 0x60, 0xac, 0x98, 0x0c, 0x9a, 0x2d, 0xa7, 0xb3, 0x4c, 0xab, 0x7c, 0x4f, 0x5b,
|
||||
0xed, 0x9f, 0x1c, 0x80, 0x43, 0x9e, 0x3d, 0x8d, 0xb3, 0x58, 0x31, 0x49, 0xae, 0x82, 0x3f, 0xec,
|
||||
0x67, 0x61, 0x86, 0xa5, 0x72, 0x69, 0x65, 0x78, 0x18, 0x66, 0xba, 0x80, 0xc3, 0xfe, 0x28, 0xce,
|
||||
0x86, 0x58, 0x28, 0x97, 0xfa, 0xc3, 0xaf, 0xe3, 0x6c, 0x68, 0xdc, 0x99, 0x76, 0x7b, 0xd6, 0x7d,
|
||||
0xa8, 0xdd, 0x57, 0xc1, 0x8f, 0x90, 0xa2, 0x82, 0xa7, 0xab, 0x44, 0x96, 0x22, 0x32, 0x14, 0x3e,
|
||||
0x7a, 0xfd, 0xa8, 0xa0, 0x88, 0x0c, 0x45, 0xd5, 0xba, 0x35, 0x45, 0xfb, 0x37, 0x17, 0x6a, 0x94,
|
||||
0x8d, 0x58, 0xa8, 0xa4, 0x86, 0x88, 0x42, 0x3d, 0x4f, 0xab, 0x27, 0x0a, 0xf5, 0xc4, 0x44, 0x3d,
|
||||
0x4f, 0xab, 0x27, 0x26, 0xea, 0x89, 0x89, 0x7a, 0x9e, 0x56, 0x4f, 0x4c, 0xd4, 0x13, 0xa5, 0x7a,
|
||||
0x9e, 0x56, 0x4f, 0x94, 0xea, 0x89, 0x52, 0x3d, 0x4f, 0xab, 0x27, 0x4a, 0xf5, 0x44, 0xa9, 0x9e,
|
||||
0xa7, 0xd5, 0x13, 0x47, 0x53, 0x59, 0x13, 0xf5, 0x3c, 0xad, 0x9e, 0x28, 0xd5, 0x13, 0x13, 0xf5,
|
||||
0x3c, 0xad, 0x9e, 0x98, 0xa8, 0x27, 0x4a, 0xf5, 0x3c, 0xad, 0x9e, 0x28, 0xd5, 0x13, 0xa5, 0x7a,
|
||||
0x9e, 0x56, 0x4f, 0x94, 0xea, 0x89, 0x89, 0x7a, 0x9e, 0x56, 0x4f, 0x18, 0xf5, 0x7e, 0x77, 0xa1,
|
||||
0xfa, 0x26, 0x8e, 0x4e, 0x99, 0x22, 0xf7, 0xc0, 0x3f, 0xe1, 0x09, 0x17, 0xa8, 0xdc, 0x6a, 0x6f,
|
||||
0xa3, 0x6b, 0x9e, 0x68, 0xd7, 0x84, 0xbb, 0x4f, 0x74, 0x8c, 0x1a, 0x08, 0xd9, 0xd2, 0x7c, 0x06,
|
||||
0xad, 0x8b, 0xb7, 0x08, 0x5d, 0x15, 0xf8, 0x97, 0xdc, 0x85, 0xaa, 0xc4, 0xa7, 0x84, 0x5d, 0xd5,
|
||||
0xec, 0xad, 0x16, 0x68, 0xf3, 0xc0, 0xa8, 0x8d, 0x92, 0x8f, 0x4c, 0x41, 0x10, 0xa9, 0xcf, 0x39,
|
||||
0x8f, 0xd4, 0x05, 0xb2, 0xd0, 0x9a, 0x30, 0x02, 0x07, 0x1b, 0xc8, 0xb9, 0x56, 0x20, 0xad, 0xee,
|
||||
0xb4, 0x88, 0x93, 0x8f, 0xa1, 0x21, 0xfa, 0x05, 0xf8, 0x1a, 0xd2, 0xce, 0x81, 0xeb, 0xc2, 0x7e,
|
||||
0xb5, 0xff, 0x07, 0xbe, 0x39, 0x74, 0x0d, 0x3c, 0x7a, 0xb0, 0xbf, 0xbe, 0x44, 0x1a, 0xe0, 0x7f,
|
||||
0x41, 0x0f, 0x0e, 0x0e, 0xd7, 0x1d, 0x52, 0x87, 0xca, 0xde, 0xcb, 0xd7, 0x07, 0xeb, 0x6e, 0xfb,
|
||||
0x67, 0x17, 0x2a, 0xaf, 0xc2, 0x91, 0x24, 0x9f, 0x41, 0x33, 0x35, 0xed, 0xa2, 0x6b, 0x8f, 0x3d,
|
||||
0xd6, 0xec, 0xfd, 0xab, 0xe0, 0xd7, 0x90, 0xee, 0x2b, 0xec, 0x9f, 0x23, 0x25, 0x0e, 0x32, 0x25,
|
||||
0xc6, 0xb4, 0x91, 0x16, 0x36, 0x79, 0x0c, 0x2b, 0x29, 0xf6, 0x66, 0x71, 0x6b, 0x17, 0xd3, 0xff,
|
||||
0x7d, 0x39, 0x5d, 0xf7, 0xab, 0xb9, 0xb6, 0x21, 0x68, 0xa6, 0xa5, 0x67, 0xf3, 0x73, 0x58, 0xbd,
|
||||
0xcc, 0x4f, 0xd6, 0xc1, 0xfb, 0x96, 0x8d, 0x51, 0x46, 0x8f, 0xea, 0x4f, 0xb2, 0x01, 0xfe, 0x59,
|
||||
0x98, 0xe4, 0x0c, 0x9f, 0x5f, 0x83, 0x1a, 0xe3, 0x91, 0xfb, 0xd0, 0xd9, 0x3c, 0x84, 0xf5, 0x59,
|
||||
0xfa, 0xe9, 0xfc, 0xba, 0xc9, 0xbf, 0x33, 0x9d, 0x3f, 0x2f, 0x4a, 0xc9, 0xd7, 0xfe, 0xd3, 0x81,
|
||||
0xe5, 0x57, 0xf2, 0xf4, 0x4d, 0xac, 0xde, 0x7e, 0x95, 0x31, 0x3e, 0x24, 0xd7, 0xc1, 0x57, 0xb1,
|
||||
0x4a, 0x18, 0xd2, 0x35, 0x9e, 0x2d, 0x51, 0x63, 0x92, 0x00, 0xaa, 0x32, 0x4c, 0x42, 0x31, 0x46,
|
||||
0x4e, 0xef, 0xd9, 0x12, 0xb5, 0x36, 0xd9, 0x84, 0xda, 0x13, 0x9e, 0xeb, 0x93, 0xe0, 0x58, 0xd0,
|
||||
0x39, 0x85, 0x83, 0xdc, 0x86, 0xe5, 0xb7, 0x3c, 0x65, 0xfd, 0x30, 0x8a, 0x04, 0x93, 0x12, 0x27,
|
||||
0x84, 0x06, 0x34, 0xb5, 0xf7, 0xb1, 0x71, 0x92, 0x03, 0xb8, 0x92, 0xca, 0xd3, 0xfe, 0x79, 0xac,
|
||||
0xde, 0xf6, 0x05, 0xfb, 0x2e, 0x8f, 0x05, 0x8b, 0x70, 0x6a, 0x34, 0x7b, 0x37, 0x26, 0x85, 0x35,
|
||||
0x67, 0xa4, 0x36, 0xfc, 0x6c, 0x89, 0xae, 0xa5, 0x97, 0x5d, 0x7b, 0x35, 0xf0, 0xf3, 0x2c, 0xe6,
|
||||
0x59, 0xfb, 0x2e, 0x54, 0x28, 0x0b, 0x93, 0xb2, 0x8a, 0x8e, 0x19, 0x35, 0x68, 0xdc, 0xab, 0xd7,
|
||||
0xa3, 0xf5, 0x8b, 0x8b, 0x8b, 0x0b, 0xb7, 0x7d, 0xae, 0x0f, 0xae, 0x0b, 0xf2, 0x9e, 0xdc, 0x82,
|
||||
0x46, 0x9c, 0x86, 0xa7, 0x71, 0xa6, 0x2f, 0x68, 0xe0, 0xa5, 0xa3, 0x4c, 0xe9, 0xed, 0xc3, 0xaa,
|
||||
0x60, 0x61, 0xd2, 0x67, 0xef, 0x15, 0xcb, 0x64, 0xcc, 0x33, 0xb2, 0x5c, 0x76, 0x66, 0x98, 0x04,
|
||||
0xdf, 0x5f, 0x6e, 0x6d, 0x4b, 0x4f, 0x57, 0x74, 0xd2, 0x41, 0x91, 0xd3, 0xfe, 0xc3, 0x07, 0x78,
|
||||
0x91, 0xf1, 0xf3, 0xec, 0x78, 0x3c, 0x62, 0x92, 0xdc, 0x01, 0x37, 0xcc, 0x82, 0x55, 0x4c, 0xdd,
|
||||
0xe8, 0x9a, 0x35, 0xd7, 0x2d, 0xd6, 0x5c, 0xf7, 0x71, 0x36, 0xa6, 0x6e, 0x98, 0x91, 0xfb, 0xe0,
|
||||
0x45, 0xb9, 0x79, 0xec, 0xcd, 0xde, 0xcd, 0x39, 0xd8, 0xbe, 0x5d, 0xb6, 0x54, 0xa3, 0xc8, 0xff,
|
||||
0xc1, 0x95, 0x2a, 0x58, 0xb6, 0x35, 0x9c, 0xc5, 0x1e, 0xe1, 0xe2, 0xa5, 0xae, 0xd4, 0x43, 0xc4,
|
||||
0x55, 0xd2, 0xb6, 0xc9, 0xe6, 0x1c, 0xf0, 0xb8, 0xd8, 0xc1, 0xd4, 0x55, 0x52, 0x63, 0x93, 0xb3,
|
||||
0x60, 0x6d, 0x01, 0xf6, 0x65, 0x2c, 0xd5, 0x37, 0xba, 0xc2, 0xd4, 0x4d, 0xce, 0x48, 0x07, 0xbc,
|
||||
0xb3, 0x30, 0x09, 0xd6, 0x11, 0x7c, 0x7d, 0x0e, 0x6c, 0x80, 0x1a, 0x42, 0xba, 0xe0, 0x45, 0x83,
|
||||
0x04, 0x5b, 0xa7, 0xd9, 0xbb, 0x35, 0x7f, 0x2f, 0x9c, 0x95, 0x16, 0x1f, 0x0d, 0x12, 0xb2, 0x05,
|
||||
0xde, 0x30, 0x51, 0xd8, 0x49, 0xfa, 0xdd, 0xce, 0xe2, 0x71, 0xea, 0x5a, 0xf8, 0x30, 0x51, 0x1a,
|
||||
0x1e, 0xdb, 0x15, 0xfd, 0x21, 0x38, 0xbe, 0x44, 0x0b, 0x8f, 0x77, 0x77, 0xf4, 0x69, 0xf2, 0xdd,
|
||||
0x1d, 0x5c, 0x4e, 0x1f, 0x3a, 0xcd, 0xeb, 0x69, 0x7c, 0xbe, 0xbb, 0x83, 0xf4, 0xdb, 0x3d, 0xdc,
|
||||
0xe5, 0x0b, 0xe8, 0xb7, 0x7b, 0x05, 0xfd, 0x76, 0x0f, 0xe9, 0xb7, 0x7b, 0xb8, 0xe0, 0x17, 0xd1,
|
||||
0x4f, 0xf0, 0x39, 0xe2, 0x2b, 0xb8, 0x09, 0x1b, 0x0b, 0x8a, 0xae, 0x47, 0x81, 0x81, 0x23, 0x4e,
|
||||
0xf3, 0xeb, 0xa1, 0x06, 0x0b, 0xf8, 0xcd, 0x76, 0xb1, 0xfc, 0x52, 0x09, 0xf2, 0x09, 0xf8, 0xe5,
|
||||
0xff, 0x08, 0x1f, 0xba, 0x00, 0x6e, 0x1d, 0x93, 0x60, 0x90, 0xed, 0xdb, 0xb0, 0x36, 0xf3, 0x18,
|
||||
0xf5, 0x00, 0x32, 0xa3, 0xd4, 0xed, 0x34, 0x90, 0xb7, 0xfd, 0x8b, 0x0b, 0x37, 0x2c, 0xea, 0x79,
|
||||
0x16, 0xc5, 0x82, 0x9d, 0xa8, 0x09, 0xfa, 0x3e, 0x54, 0x64, 0x3e, 0x48, 0x6d, 0x27, 0x2f, 0x7a,
|
||||
0xe1, 0x14, 0x41, 0xe4, 0x4b, 0x68, 0xa4, 0xe1, 0xa8, 0x3f, 0x8c, 0x59, 0x12, 0xd9, 0x61, 0xbb,
|
||||
0x35, 0x93, 0x31, 0xfb, 0x03, 0x7a, 0x08, 0x3f, 0xd5, 0x78, 0x33, 0x7c, 0xeb, 0xa9, 0x35, 0xc9,
|
||||
0x43, 0x68, 0xca, 0x24, 0x3e, 0x61, 0x96, 0xcd, 0x43, 0xb6, 0x85, 0xbf, 0x0f, 0x88, 0xc5, 0xcc,
|
||||
0xcd, 0x63, 0x58, 0xb9, 0x44, 0x3a, 0x3d, 0x72, 0x1b, 0x66, 0xe4, 0x6e, 0x5d, 0x1e, 0xb9, 0x0b,
|
||||
0x69, 0xa7, 0x66, 0xef, 0x3d, 0xd8, 0x98, 0x89, 0x62, 0xb5, 0x09, 0x81, 0xca, 0x60, 0xac, 0x24,
|
||||
0xd6, 0x73, 0x99, 0xe2, 0x77, 0x7b, 0x1f, 0xc8, 0x0c, 0xf6, 0xcd, 0x8b, 0xe3, 0x42, 0x6e, 0x0d,
|
||||
0xfc, 0x27, 0x72, 0x3f, 0x6a, 0x41, 0x25, 0x0b, 0x53, 0x36, 0x33, 0xb4, 0x7e, 0xc0, 0x5b, 0x60,
|
||||
0xe4, 0xd1, 0xa7, 0x50, 0x61, 0xef, 0x55, 0x3a, 0x83, 0xf8, 0xf1, 0x6f, 0xa4, 0xd2, 0x29, 0x7f,
|
||||
0x05, 0x00, 0x00, 0xff, 0xff, 0xea, 0x06, 0x1a, 0xa9, 0x37, 0x0c, 0x00, 0x00,
|
||||
var fileDescriptor_test_objects_a4d3e593ea3c686f = []byte{
|
||||
// 1460 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xdd, 0x72, 0xdb, 0x44,
|
||||
0x14, 0x8e, 0x24, 0xcb, 0xb6, 0x8e, 0xf3, 0xd7, 0x6d, 0xda, 0x2a, 0xa1, 0x14, 0x8d, 0x5b, 0x8a,
|
||||
0x69, 0x89, 0x3b, 0x38, 0x1e, 0x4f, 0x29, 0xdc, 0x34, 0x4d, 0x4a, 0x4b, 0xdb, 0xc0, 0x6c, 0x52,
|
||||
0x7a, 0xe9, 0x91, 0x23, 0x39, 0x55, 0x91, 0xb4, 0x66, 0x77, 0x9d, 0xd4, 0x03, 0xcc, 0xe4, 0x19,
|
||||
0x18, 0x9e, 0x80, 0x0b, 0x6e, 0xb9, 0xe3, 0x82, 0xb7, 0xe0, 0x8d, 0x98, 0x3d, 0xbb, 0xf2, 0x5f,
|
||||
0xe2, 0x81, 0x2b, 0x7b, 0xf7, 0xfb, 0xd9, 0xd5, 0x9e, 0x4f, 0x67, 0x05, 0x44, 0xc6, 0x42, 0x76,
|
||||
0x59, 0xef, 0x5d, 0x7c, 0x2c, 0x45, 0x73, 0xc0, 0x99, 0x64, 0xa4, 0xfc, 0x4e, 0xb0, 0x7c, 0xd0,
|
||||
0xdb, 0xda, 0x3c, 0x61, 0xec, 0x24, 0x8d, 0x1f, 0xe0, 0x6c, 0x6f, 0xd8, 0x7f, 0x10, 0xe6, 0x23,
|
||||
0x4d, 0xd9, 0xba, 0x35, 0x0f, 0x45, 0x43, 0x1e, 0xca, 0x84, 0xe5, 0x06, 0xbf, 0x39, 0x8f, 0x0b,
|
||||
0xc9, 0x87, 0xc7, 0xd2, 0xa0, 0x1f, 0xcd, 0xa3, 0x32, 0xc9, 0x62, 0x21, 0xc3, 0x6c, 0xb0, 0xc8,
|
||||
0xfe, 0x8c, 0x87, 0x83, 0x41, 0xcc, 0xcd, 0x0e, 0xeb, 0x7f, 0x96, 0xa0, 0x7c, 0x98, 0x64, 0x83,
|
||||
0x34, 0x26, 0xd7, 0xa0, 0xcc, 0xba, 0x3d, 0xc6, 0x52, 0xdf, 0x0a, 0xac, 0x46, 0x95, 0xba, 0x6c,
|
||||
0x97, 0xb1, 0x94, 0xdc, 0x80, 0x0a, 0xeb, 0x26, 0xb9, 0xdc, 0x69, 0xf9, 0x76, 0x60, 0x35, 0x5c,
|
||||
0x5a, 0x66, 0xcf, 0xd5, 0x88, 0xdc, 0x82, 0x9a, 0x01, 0xba, 0x42, 0x72, 0xdf, 0x41, 0xd0, 0xd3,
|
||||
0xe0, 0xa1, 0xe4, 0x63, 0x61, 0xa7, 0xed, 0x97, 0x02, 0xab, 0xe1, 0x68, 0x61, 0xa7, 0x3d, 0x16,
|
||||
0x76, 0xda, 0x28, 0x74, 0x11, 0xf4, 0x34, 0xa8, 0x84, 0x9b, 0x50, 0x65, 0xdd, 0xa1, 0x5e, 0xb2,
|
||||
0x1c, 0x58, 0x8d, 0x15, 0x5a, 0x61, 0xaf, 0x71, 0x48, 0x02, 0x58, 0x2e, 0x20, 0xd4, 0x56, 0x10,
|
||||
0x06, 0x03, 0xcf, 0x88, 0x3b, 0x6d, 0xbf, 0x1a, 0x58, 0x8d, 0x92, 0x11, 0x77, 0xda, 0x13, 0xb1,
|
||||
0x59, 0xd8, 0x43, 0x18, 0x0c, 0x3c, 0x16, 0x0b, 0xbd, 0x32, 0x04, 0x56, 0xe3, 0x0a, 0xad, 0xb0,
|
||||
0xc3, 0xa9, 0x95, 0xc5, 0x64, 0xe5, 0x1a, 0xc2, 0x60, 0xe0, 0x19, 0x71, 0xa7, 0xed, 0x2f, 0x07,
|
||||
0x56, 0x83, 0x18, 0x71, 0xb1, 0xb2, 0x98, 0xac, 0xbc, 0x82, 0x30, 0x18, 0x78, 0x7c, 0x58, 0xfd,
|
||||
0x94, 0x85, 0xd2, 0x5f, 0x0d, 0xac, 0x86, 0x4d, 0xcb, 0xec, 0xa9, 0x1a, 0xe9, 0xc3, 0x42, 0x00,
|
||||
0x95, 0x6b, 0x08, 0x7a, 0x1a, 0x1c, 0xaf, 0x1a, 0xb1, 0x61, 0x2f, 0x8d, 0xfd, 0xf5, 0xc0, 0x6a,
|
||||
0x58, 0xb4, 0xc2, 0xf6, 0x70, 0xa8, 0x57, 0xd5, 0x10, 0x6a, 0xaf, 0x20, 0x0c, 0x06, 0x9e, 0x6c,
|
||||
0x59, 0xf2, 0x24, 0x3f, 0xf1, 0x49, 0x60, 0x35, 0x3c, 0xb5, 0x65, 0x1c, 0xea, 0x0d, 0xf5, 0x46,
|
||||
0x32, 0x16, 0xfe, 0xd5, 0xc0, 0x6a, 0x2c, 0xd3, 0x32, 0xdb, 0x55, 0xa3, 0xfa, 0xaf, 0x16, 0xc0,
|
||||
0x01, 0xcb, 0x9f, 0x26, 0x79, 0x22, 0x63, 0x41, 0xae, 0x82, 0xdb, 0xef, 0xe6, 0x61, 0x8e, 0xa1,
|
||||
0xb1, 0x69, 0xa9, 0x7f, 0x10, 0xe6, 0x2a, 0x4a, 0xfd, 0xee, 0x20, 0xc9, 0xfb, 0x18, 0x19, 0x9b,
|
||||
0xba, 0xfd, 0xef, 0x92, 0xbc, 0xaf, 0xa7, 0x73, 0x35, 0xed, 0x98, 0xe9, 0x03, 0x35, 0x7d, 0x15,
|
||||
0xdc, 0x08, 0x2d, 0x4a, 0xb8, 0xc1, 0x52, 0x64, 0x2c, 0x22, 0x6d, 0xe1, 0xe2, 0xac, 0x1b, 0x15,
|
||||
0x16, 0x91, 0xb6, 0x28, 0x9b, 0x69, 0x65, 0x51, 0xff, 0xc3, 0x86, 0x0a, 0x8d, 0x07, 0x71, 0x28,
|
||||
0x85, 0xa2, 0xf0, 0x22, 0xc7, 0x8e, 0xca, 0x31, 0x2f, 0x72, 0xcc, 0xc7, 0x39, 0x76, 0x54, 0x8e,
|
||||
0xb9, 0xce, 0x71, 0x01, 0x74, 0xda, 0xbe, 0x13, 0x38, 0x2a, 0xa7, 0x5c, 0xe7, 0x74, 0x13, 0xaa,
|
||||
0xbc, 0xc8, 0x61, 0x29, 0x70, 0x54, 0x0e, 0xb9, 0xc9, 0xe1, 0x18, 0xea, 0xb4, 0x7d, 0x37, 0x70,
|
||||
0x54, 0xca, 0xb8, 0x49, 0x19, 0x42, 0xa2, 0x48, 0xaf, 0xa3, 0x32, 0xc4, 0x0f, 0xa7, 0x54, 0x26,
|
||||
0x21, 0x95, 0xc0, 0x51, 0x09, 0xe1, 0x26, 0x21, 0xb8, 0x09, 0x5d, 0xff, 0x6a, 0xe0, 0xa8, 0xfa,
|
||||
0x73, 0x5d, 0x7f, 0xd4, 0x98, 0xfa, 0x7a, 0x81, 0xa3, 0xea, 0xcb, 0x4d, 0x7d, 0xb5, 0x9d, 0xae,
|
||||
0x1e, 0x04, 0x8e, 0xaa, 0x1e, 0x9f, 0x54, 0x8f, 0x9b, 0xea, 0xd5, 0x02, 0x47, 0x55, 0x8f, 0xeb,
|
||||
0xea, 0xfd, 0x65, 0x43, 0xf9, 0x4d, 0x12, 0x9d, 0xc4, 0x92, 0xdc, 0x03, 0xf7, 0x98, 0xa5, 0x8c,
|
||||
0x63, 0xe5, 0x56, 0x5b, 0x1b, 0x4d, 0xdd, 0xac, 0x9a, 0x1a, 0x6e, 0x3e, 0x51, 0x18, 0xd5, 0x14,
|
||||
0xb2, 0xad, 0xfc, 0x34, 0x5b, 0x1d, 0xde, 0x22, 0x76, 0x99, 0xe3, 0x2f, 0xb9, 0x0b, 0x65, 0x81,
|
||||
0x4d, 0x05, 0xdf, 0xa2, 0x5a, 0x6b, 0xb5, 0x60, 0xeb, 0x56, 0x43, 0x0d, 0x4a, 0x3e, 0xd5, 0x07,
|
||||
0x82, 0x4c, 0xb5, 0xcf, 0x8b, 0x4c, 0x75, 0x40, 0x86, 0x5a, 0xe1, 0xba, 0xc0, 0xfe, 0x06, 0x7a,
|
||||
0xae, 0x15, 0x4c, 0x53, 0x77, 0x5a, 0xe0, 0xe4, 0x33, 0xf0, 0x78, 0xb7, 0x20, 0x5f, 0x43, 0xdb,
|
||||
0x0b, 0xe4, 0x2a, 0x37, 0xff, 0xea, 0x1f, 0x83, 0xab, 0x37, 0x5d, 0x01, 0x87, 0xee, 0xef, 0xad,
|
||||
0x2f, 0x11, 0x0f, 0xdc, 0xaf, 0xe9, 0xfe, 0xfe, 0xc1, 0xba, 0x45, 0xaa, 0x50, 0xda, 0x7d, 0xf9,
|
||||
0x7a, 0x7f, 0xdd, 0xae, 0xff, 0x66, 0x43, 0xe9, 0x55, 0x38, 0x10, 0xe4, 0x4b, 0xa8, 0x65, 0x53,
|
||||
0xdd, 0xcb, 0x42, 0xff, 0x0f, 0x0a, 0x7f, 0x45, 0x69, 0xbe, 0x2a, 0x5a, 0xd9, 0x7e, 0x2e, 0xf9,
|
||||
0x88, 0x7a, 0xd9, 0xb8, 0xb5, 0x3d, 0x86, 0x95, 0x0c, 0xb3, 0x59, 0x3c, 0xb5, 0x8d, 0xf2, 0x0f,
|
||||
0x67, 0xe5, 0x2a, 0xaf, 0xfa, 0xb1, 0xb5, 0x41, 0x2d, 0x9b, 0xcc, 0x6c, 0x7d, 0x05, 0xab, 0xb3,
|
||||
0xfe, 0x64, 0x1d, 0x9c, 0x1f, 0xe2, 0x11, 0x96, 0xd1, 0xa1, 0xea, 0x2f, 0xd9, 0x00, 0xf7, 0x34,
|
||||
0x4c, 0x87, 0x31, 0xbe, 0x7e, 0x1e, 0xd5, 0x83, 0x47, 0xf6, 0x43, 0x6b, 0xeb, 0x00, 0xd6, 0xe7,
|
||||
0xed, 0xa7, 0xf5, 0x55, 0xad, 0xbf, 0x33, 0xad, 0xbf, 0x58, 0x94, 0x89, 0x5f, 0xfd, 0x1f, 0x0b,
|
||||
0x96, 0x5f, 0x89, 0x93, 0x37, 0x89, 0x7c, 0xfb, 0x6d, 0x1e, 0xb3, 0x3e, 0xb9, 0x0e, 0xae, 0x4c,
|
||||
0x64, 0x1a, 0xa3, 0x9d, 0xf7, 0x6c, 0x89, 0xea, 0x21, 0xf1, 0xa1, 0x2c, 0xc2, 0x34, 0xe4, 0x23,
|
||||
0xf4, 0x74, 0x9e, 0x2d, 0x51, 0x33, 0x26, 0x5b, 0x50, 0x79, 0xc2, 0x86, 0x6a, 0x27, 0xd8, 0x16,
|
||||
0x94, 0xa6, 0x98, 0x20, 0xb7, 0x61, 0xf9, 0x2d, 0xcb, 0xe2, 0x6e, 0x18, 0x45, 0x3c, 0x16, 0x02,
|
||||
0x3b, 0x84, 0x22, 0xd4, 0xd4, 0xec, 0x63, 0x3d, 0x49, 0xf6, 0xe1, 0x4a, 0x26, 0x4e, 0xba, 0x67,
|
||||
0x89, 0x7c, 0xdb, 0xe5, 0xf1, 0x8f, 0xc3, 0x84, 0xc7, 0x11, 0x76, 0x8d, 0x5a, 0xeb, 0xc6, 0xf8,
|
||||
0x60, 0xf5, 0x1e, 0xa9, 0x81, 0x9f, 0x2d, 0xd1, 0xb5, 0x6c, 0x76, 0x6a, 0xb7, 0x02, 0xee, 0x30,
|
||||
0x4f, 0x58, 0x5e, 0xbf, 0x0b, 0x25, 0x1a, 0x87, 0xe9, 0xe4, 0x14, 0x2d, 0xdd, 0x6a, 0x70, 0x70,
|
||||
0xaf, 0x5a, 0x8d, 0xd6, 0xcf, 0xcf, 0xcf, 0xcf, 0xed, 0xfa, 0x99, 0xda, 0xb8, 0x3a, 0x90, 0xf7,
|
||||
0xe4, 0x26, 0x78, 0x49, 0x16, 0x9e, 0x24, 0xb9, 0x7a, 0x40, 0x4d, 0x9f, 0x4c, 0x4c, 0x24, 0xad,
|
||||
0x3d, 0x58, 0xe5, 0x71, 0x98, 0x76, 0xe3, 0xf7, 0x32, 0xce, 0x45, 0xc2, 0x72, 0xb2, 0x3c, 0x49,
|
||||
0x66, 0x98, 0xfa, 0x3f, 0xcd, 0x46, 0xdb, 0xd8, 0xd3, 0x15, 0x25, 0xda, 0x2f, 0x34, 0xf5, 0xbf,
|
||||
0x5d, 0x80, 0x17, 0x39, 0x3b, 0xcb, 0x8f, 0x46, 0x83, 0x58, 0x90, 0x3b, 0x60, 0x87, 0x39, 0x5e,
|
||||
0x1b, 0xb5, 0xd6, 0x46, 0x53, 0x5f, 0xf8, 0xcd, 0xe2, 0xc2, 0x6f, 0x3e, 0xce, 0x47, 0xd4, 0x0e,
|
||||
0x73, 0x72, 0x1f, 0x9c, 0x68, 0xa8, 0x5f, 0xf6, 0x5a, 0x6b, 0xf3, 0x02, 0x6d, 0xcf, 0x7c, 0x76,
|
||||
0x50, 0xc5, 0x22, 0x9f, 0x80, 0x2d, 0x24, 0xde, 0x62, 0xea, 0x0c, 0xe7, 0xb9, 0x87, 0xf8, 0x09,
|
||||
0x42, 0x6d, 0xa1, 0x9a, 0x88, 0x2d, 0x85, 0x89, 0xc9, 0xd6, 0x05, 0xe2, 0x51, 0xf1, 0x35, 0x42,
|
||||
0x6d, 0x29, 0x14, 0x37, 0x3d, 0xc5, 0x1b, 0xec, 0x32, 0xee, 0xcb, 0x44, 0xc8, 0xef, 0xd5, 0x09,
|
||||
0x53, 0x3b, 0x3d, 0x25, 0x0d, 0x70, 0x4e, 0xc3, 0x14, 0x6f, 0xb4, 0x5a, 0xeb, 0xfa, 0x05, 0xb2,
|
||||
0x26, 0x2a, 0x0a, 0x69, 0x82, 0x13, 0xf5, 0x52, 0x8c, 0x4e, 0xad, 0x75, 0xf3, 0xe2, 0x73, 0x61,
|
||||
0xaf, 0x34, 0xfc, 0xa8, 0x97, 0x92, 0x6d, 0x70, 0xfa, 0xa9, 0xc4, 0x24, 0xa9, 0xf7, 0x76, 0x9e,
|
||||
0x8f, 0x5d, 0xd7, 0xd0, 0xfb, 0xa9, 0x54, 0xf4, 0x04, 0x9b, 0xfc, 0xe5, 0x74, 0x7c, 0x13, 0x0d,
|
||||
0x3d, 0xe9, 0xb4, 0xd5, 0x6e, 0x86, 0x9d, 0x36, 0x5e, 0x4e, 0x97, 0xed, 0xe6, 0xf5, 0x34, 0x7f,
|
||||
0xd8, 0x69, 0xa3, 0xfd, 0x4e, 0x0b, 0xbf, 0x63, 0x16, 0xd8, 0xef, 0xb4, 0x0a, 0xfb, 0x9d, 0x16,
|
||||
0xda, 0xef, 0xb4, 0xf0, 0xc3, 0x66, 0x91, 0xfd, 0x98, 0x3f, 0x44, 0x7e, 0x09, 0x6f, 0x42, 0x6f,
|
||||
0xc1, 0xa1, 0xab, 0x56, 0xa0, 0xe9, 0xc8, 0x53, 0xfe, 0xaa, 0xa9, 0xc1, 0x02, 0x7f, 0x7d, 0xbb,
|
||||
0x18, 0x7f, 0x21, 0x39, 0xf9, 0x1c, 0xdc, 0xe2, 0x96, 0xb9, 0xfc, 0x01, 0xf0, 0xd6, 0xd1, 0x02,
|
||||
0xcd, 0xac, 0xdf, 0x86, 0xb5, 0xb9, 0x97, 0x51, 0x35, 0x20, 0xdd, 0x4a, 0xed, 0x86, 0x87, 0xbe,
|
||||
0xf5, 0xdf, 0x6d, 0xb8, 0x61, 0x58, 0xcf, 0xf3, 0x28, 0xe1, 0xf1, 0xb1, 0x1c, 0xb3, 0xef, 0x43,
|
||||
0x49, 0x0c, 0x7b, 0x99, 0x49, 0xf2, 0xa2, 0x37, 0x9c, 0x22, 0x89, 0x7c, 0x03, 0x5e, 0x16, 0x0e,
|
||||
0xba, 0xfd, 0x24, 0x4e, 0x23, 0xd3, 0x6c, 0xb7, 0xe7, 0x14, 0xf3, 0x0b, 0xa8, 0x26, 0xfc, 0x54,
|
||||
0xf1, 0x75, 0xf3, 0xad, 0x66, 0x66, 0x48, 0x1e, 0x42, 0x4d, 0xa4, 0xc9, 0x71, 0x6c, 0xdc, 0x1c,
|
||||
0x74, 0x5b, 0xb8, 0x3e, 0x20, 0x17, 0x95, 0x5b, 0x47, 0xb0, 0x32, 0x63, 0x3a, 0xdd, 0x72, 0x3d,
|
||||
0xdd, 0x72, 0xb7, 0x67, 0x5b, 0xee, 0x42, 0xdb, 0xa9, 0xde, 0x7b, 0x0f, 0x36, 0xe6, 0x50, 0x3c,
|
||||
0x6d, 0x42, 0xa0, 0xd4, 0x1b, 0x49, 0x81, 0xe7, 0xb9, 0x4c, 0xf1, 0x7f, 0x7d, 0x0f, 0xc8, 0x1c,
|
||||
0xf7, 0xcd, 0x8b, 0xa3, 0xa2, 0xdc, 0x8a, 0xf8, 0x7f, 0xca, 0xfd, 0x28, 0x80, 0x52, 0x1e, 0x66,
|
||||
0xf1, 0x5c, 0xd3, 0xfa, 0x19, 0x9f, 0x02, 0x91, 0x47, 0x5f, 0x40, 0x29, 0x7e, 0x2f, 0xb3, 0x39,
|
||||
0xc6, 0x2f, 0xff, 0x51, 0x2a, 0x25, 0xf9, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe9, 0xd4, 0xfd, 0x2f,
|
||||
0x41, 0x0d, 0x00, 0x00,
|
||||
}
|
||||
|
26
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto
generated
vendored
26
vendor/github.com/golang/protobuf/jsonpb/jsonpb_test_proto/test_objects.proto
generated
vendored
@ -43,15 +43,23 @@ package jsonpb;
|
||||
message Simple {
|
||||
optional bool o_bool = 1;
|
||||
optional int32 o_int32 = 2;
|
||||
optional int64 o_int64 = 3;
|
||||
optional uint32 o_uint32 = 4;
|
||||
optional uint64 o_uint64 = 5;
|
||||
optional sint32 o_sint32 = 6;
|
||||
optional sint64 o_sint64 = 7;
|
||||
optional float o_float = 8;
|
||||
optional double o_double = 9;
|
||||
optional string o_string = 10;
|
||||
optional bytes o_bytes = 11;
|
||||
optional int32 o_int32_str = 3;
|
||||
optional int64 o_int64 = 4;
|
||||
optional int64 o_int64_str = 5;
|
||||
optional uint32 o_uint32 = 6;
|
||||
optional uint32 o_uint32_str = 7;
|
||||
optional uint64 o_uint64 = 8;
|
||||
optional uint64 o_uint64_str = 9;
|
||||
optional sint32 o_sint32 = 10;
|
||||
optional sint32 o_sint32_str = 11;
|
||||
optional sint64 o_sint64 = 12;
|
||||
optional sint64 o_sint64_str = 13;
|
||||
optional float o_float = 14;
|
||||
optional float o_float_str = 15;
|
||||
optional double o_double = 16;
|
||||
optional double o_double_str = 17;
|
||||
optional string o_string = 18;
|
||||
optional bytes o_bytes = 19;
|
||||
}
|
||||
|
||||
// Test message for holding special non-finites primitives.
|
||||
|
96
vendor/github.com/golang/protobuf/proto/all_test.go
generated
vendored
96
vendor/github.com/golang/protobuf/proto/all_test.go
generated
vendored
@ -46,6 +46,7 @@ import (
|
||||
"time"
|
||||
|
||||
. "github.com/golang/protobuf/proto"
|
||||
pb3 "github.com/golang/protobuf/proto/proto3_proto"
|
||||
. "github.com/golang/protobuf/proto/test_proto"
|
||||
)
|
||||
|
||||
@ -2250,17 +2251,98 @@ func TestConcurrentMarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInvalidUTF8(t *testing.T) {
|
||||
const wire = "\x12\x04\xde\xea\xca\xfe"
|
||||
const invalidUTF8 = "\xde\xad\xbe\xef\x80\x00\xff"
|
||||
tests := []struct {
|
||||
label string
|
||||
proto2 Message
|
||||
proto3 Message
|
||||
want []byte
|
||||
}{{
|
||||
label: "Scalar",
|
||||
proto2: &TestUTF8{Scalar: String(invalidUTF8)},
|
||||
proto3: &pb3.TestUTF8{Scalar: invalidUTF8},
|
||||
want: []byte{0x0a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},
|
||||
}, {
|
||||
label: "Vector",
|
||||
proto2: &TestUTF8{Vector: []string{invalidUTF8}},
|
||||
proto3: &pb3.TestUTF8{Vector: []string{invalidUTF8}},
|
||||
want: []byte{0x12, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},
|
||||
}, {
|
||||
label: "Oneof",
|
||||
proto2: &TestUTF8{Oneof: &TestUTF8_Field{invalidUTF8}},
|
||||
proto3: &pb3.TestUTF8{Oneof: &pb3.TestUTF8_Field{invalidUTF8}},
|
||||
want: []byte{0x1a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},
|
||||
}, {
|
||||
label: "MapKey",
|
||||
proto2: &TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}},
|
||||
proto3: &pb3.TestUTF8{MapKey: map[string]int64{invalidUTF8: 0}},
|
||||
want: []byte{0x22, 0x0b, 0x0a, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff, 0x10, 0x00},
|
||||
}, {
|
||||
label: "MapValue",
|
||||
proto2: &TestUTF8{MapValue: map[int64]string{0: invalidUTF8}},
|
||||
proto3: &pb3.TestUTF8{MapValue: map[int64]string{0: invalidUTF8}},
|
||||
want: []byte{0x2a, 0x0b, 0x08, 0x00, 0x12, 0x07, 0xde, 0xad, 0xbe, 0xef, 0x80, 0x00, 0xff},
|
||||
}}
|
||||
|
||||
var m GoTest
|
||||
if err := Unmarshal([]byte(wire), &m); err == nil {
|
||||
t.Errorf("Unmarshal error: got nil, want non-nil")
|
||||
for _, tt := range tests {
|
||||
// Proto2 should not validate UTF-8.
|
||||
b, err := Marshal(tt.proto2)
|
||||
if err != nil {
|
||||
t.Errorf("Marshal(proto2.%s) = %v, want nil", tt.label, err)
|
||||
}
|
||||
if !bytes.Equal(b, tt.want) {
|
||||
t.Errorf("Marshal(proto2.%s) = %x, want %x", tt.label, b, tt.want)
|
||||
}
|
||||
|
||||
m := Clone(tt.proto2)
|
||||
m.Reset()
|
||||
m.Table = String(wire[2:])
|
||||
if _, err := Marshal(&m); err == nil {
|
||||
t.Errorf("Marshal error: got nil, want non-nil")
|
||||
if err = Unmarshal(tt.want, m); err != nil {
|
||||
t.Errorf("Unmarshal(proto2.%s) = %v, want nil", tt.label, err)
|
||||
}
|
||||
if !Equal(m, tt.proto2) {
|
||||
t.Errorf("proto2.%s: output mismatch:\ngot %v\nwant %v", tt.label, m, tt.proto2)
|
||||
}
|
||||
|
||||
// Proto3 should validate UTF-8.
|
||||
b, err = Marshal(tt.proto3)
|
||||
if err == nil {
|
||||
t.Errorf("Marshal(proto3.%s) = %v, want non-nil", tt.label, err)
|
||||
}
|
||||
if !bytes.Equal(b, tt.want) {
|
||||
t.Errorf("Marshal(proto3.%s) = %x, want %x", tt.label, b, tt.want)
|
||||
}
|
||||
|
||||
m = Clone(tt.proto3)
|
||||
m.Reset()
|
||||
err = Unmarshal(tt.want, m)
|
||||
if err == nil {
|
||||
t.Errorf("Unmarshal(proto3.%s) = %v, want non-nil", tt.label, err)
|
||||
}
|
||||
if !Equal(m, tt.proto3) {
|
||||
t.Errorf("proto3.%s: output mismatch:\ngot %v\nwant %v", tt.label, m, tt.proto2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequired(t *testing.T) {
|
||||
// The F_BoolRequired field appears after all of the required fields.
|
||||
// It should still be handled even after multiple required field violations.
|
||||
m := &GoTest{F_BoolRequired: Bool(true)}
|
||||
got, err := Marshal(m)
|
||||
if _, ok := err.(*RequiredNotSetError); !ok {
|
||||
t.Errorf("Marshal() = %v, want RequiredNotSetError error", err)
|
||||
}
|
||||
if want := []byte{0x50, 0x01}; !bytes.Equal(got, want) {
|
||||
t.Errorf("Marshal() = %x, want %x", got, want)
|
||||
}
|
||||
|
||||
m = new(GoTest)
|
||||
err = Unmarshal(got, m)
|
||||
if _, ok := err.(*RequiredNotSetError); !ok {
|
||||
t.Errorf("Marshal() = %v, want RequiredNotSetError error", err)
|
||||
}
|
||||
if !m.GetF_BoolRequired() {
|
||||
t.Error("m.F_BoolRequired = false, want true")
|
||||
}
|
||||
}
|
||||
|
||||
|
18
vendor/github.com/golang/protobuf/proto/encode.go
generated
vendored
18
vendor/github.com/golang/protobuf/proto/encode.go
generated
vendored
@ -37,27 +37,9 @@ package proto
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// RequiredNotSetError is the error returned if Marshal is called with
|
||||
// a protocol buffer struct whose required fields have not
|
||||
// all been initialized. It is also the error returned if Unmarshal is
|
||||
// called with an encoded protocol buffer that does not include all the
|
||||
// required fields.
|
||||
//
|
||||
// When printed, RequiredNotSetError reports the first unset required field in a
|
||||
// message. If the field cannot be precisely determined, it is reported as
|
||||
// "{Unknown}".
|
||||
type RequiredNotSetError struct {
|
||||
field string
|
||||
}
|
||||
|
||||
func (e *RequiredNotSetError) Error() string {
|
||||
return fmt.Sprintf("proto: required field %q not set", e.field)
|
||||
}
|
||||
|
||||
var (
|
||||
// errRepeatedHasNil is the error returned if Marshal is called with
|
||||
// a struct with a repeated field containing a nil element.
|
||||
|
62
vendor/github.com/golang/protobuf/proto/lib.go
generated
vendored
62
vendor/github.com/golang/protobuf/proto/lib.go
generated
vendored
@ -265,7 +265,6 @@ package proto
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
@ -274,7 +273,66 @@ import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
var errInvalidUTF8 = errors.New("proto: invalid UTF-8 string")
|
||||
// RequiredNotSetError is an error type returned by either Marshal or Unmarshal.
|
||||
// Marshal reports this when a required field is not initialized.
|
||||
// Unmarshal reports this when a required field is missing from the wire data.
|
||||
type RequiredNotSetError struct{ field string }
|
||||
|
||||
func (e *RequiredNotSetError) Error() string {
|
||||
if e.field == "" {
|
||||
return fmt.Sprintf("proto: required field not set")
|
||||
}
|
||||
return fmt.Sprintf("proto: required field %q not set", e.field)
|
||||
}
|
||||
func (e *RequiredNotSetError) RequiredNotSet() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type invalidUTF8Error struct{ field string }
|
||||
|
||||
func (e *invalidUTF8Error) Error() string {
|
||||
if e.field == "" {
|
||||
return "proto: invalid UTF-8 detected"
|
||||
}
|
||||
return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field)
|
||||
}
|
||||
func (e *invalidUTF8Error) InvalidUTF8() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8.
|
||||
// This error should not be exposed to the external API as such errors should
|
||||
// be recreated with the field information.
|
||||
var errInvalidUTF8 = &invalidUTF8Error{}
|
||||
|
||||
// isNonFatal reports whether the error is either a RequiredNotSet error
|
||||
// or a InvalidUTF8 error.
|
||||
func isNonFatal(err error) bool {
|
||||
if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() {
|
||||
return true
|
||||
}
|
||||
if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type nonFatal struct{ E error }
|
||||
|
||||
// Merge merges err into nf and reports whether it was successful.
|
||||
// Otherwise it returns false for any fatal non-nil errors.
|
||||
func (nf *nonFatal) Merge(err error) (ok bool) {
|
||||
if err == nil {
|
||||
return true // not an error
|
||||
}
|
||||
if !isNonFatal(err) {
|
||||
return false // fatal error
|
||||
}
|
||||
if nf.E == nil {
|
||||
nf.E = err // store first instance of non-fatal error
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Message is implemented by generated protocol buffer messages.
|
||||
type Message interface {
|
||||
|
14
vendor/github.com/golang/protobuf/proto/properties.go
generated
vendored
14
vendor/github.com/golang/protobuf/proto/properties.go
generated
vendored
@ -139,7 +139,7 @@ type Properties struct {
|
||||
Repeated bool
|
||||
Packed bool // relevant for repeated primitives only
|
||||
Enum string // set for enum types only
|
||||
proto3 bool // whether this is known to be a proto3 field; set for []byte only
|
||||
proto3 bool // whether this is known to be a proto3 field
|
||||
oneof bool // whether this is a oneof field
|
||||
|
||||
Default string // default value
|
||||
@ -149,8 +149,8 @@ type Properties struct {
|
||||
sprop *StructProperties // set for struct types only
|
||||
|
||||
mtype reflect.Type // set for map types only
|
||||
mkeyprop *Properties // set for map types only
|
||||
mvalprop *Properties // set for map types only
|
||||
MapKeyProp *Properties // set for map types only
|
||||
MapValProp *Properties // set for map types only
|
||||
}
|
||||
|
||||
// String formats the properties in the protobuf struct field tag style.
|
||||
@ -275,16 +275,16 @@ func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, loc
|
||||
|
||||
case reflect.Map:
|
||||
p.mtype = t1
|
||||
p.mkeyprop = &Properties{}
|
||||
p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp)
|
||||
p.mvalprop = &Properties{}
|
||||
p.MapKeyProp = &Properties{}
|
||||
p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp)
|
||||
p.MapValProp = &Properties{}
|
||||
vtype := p.mtype.Elem()
|
||||
if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice {
|
||||
// The value type is not a message (*T) or bytes ([]byte),
|
||||
// so we need encoders for the pointer to this type.
|
||||
vtype = reflect.PtrTo(vtype)
|
||||
}
|
||||
p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp)
|
||||
p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp)
|
||||
}
|
||||
|
||||
if p.stype != nil {
|
||||
|
312
vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go
generated
vendored
312
vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.pb.go
generated
vendored
@ -46,29 +46,29 @@ func (x Message_Humour) String() string {
|
||||
return proto.EnumName(Message_Humour_name, int32(x))
|
||||
}
|
||||
func (Message_Humour) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_e706e4ff19a5dbea, []int{0, 0}
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{0, 0}
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"`
|
||||
HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm" json:"height_in_cm,omitempty"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Hilarity Message_Humour `protobuf:"varint,2,opt,name=hilarity,proto3,enum=proto3_proto.Message_Humour" json:"hilarity,omitempty"`
|
||||
HeightInCm uint32 `protobuf:"varint,3,opt,name=height_in_cm,json=heightInCm,proto3" json:"height_in_cm,omitempty"`
|
||||
Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
|
||||
ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount" json:"result_count,omitempty"`
|
||||
TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman" json:"true_scotsman,omitempty"`
|
||||
Score float32 `protobuf:"fixed32,9,opt,name=score" json:"score,omitempty"`
|
||||
Key []uint64 `protobuf:"varint,5,rep,packed,name=key" json:"key,omitempty"`
|
||||
ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey" json:"short_key,omitempty"`
|
||||
Nested *Nested `protobuf:"bytes,6,opt,name=nested" json:"nested,omitempty"`
|
||||
RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"`
|
||||
Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Proto2Field *test_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field" json:"proto2_field,omitempty"`
|
||||
Proto2Value map[string]*test_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
Anything *any.Any `protobuf:"bytes,14,opt,name=anything" json:"anything,omitempty"`
|
||||
ManyThings []*any.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings" json:"many_things,omitempty"`
|
||||
Submessage *Message `protobuf:"bytes,17,opt,name=submessage" json:"submessage,omitempty"`
|
||||
Children []*Message `protobuf:"bytes,18,rep,name=children" json:"children,omitempty"`
|
||||
StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
ResultCount int64 `protobuf:"varint,7,opt,name=result_count,json=resultCount,proto3" json:"result_count,omitempty"`
|
||||
TrueScotsman bool `protobuf:"varint,8,opt,name=true_scotsman,json=trueScotsman,proto3" json:"true_scotsman,omitempty"`
|
||||
Score float32 `protobuf:"fixed32,9,opt,name=score,proto3" json:"score,omitempty"`
|
||||
Key []uint64 `protobuf:"varint,5,rep,packed,name=key,proto3" json:"key,omitempty"`
|
||||
ShortKey []int32 `protobuf:"varint,19,rep,packed,name=short_key,json=shortKey,proto3" json:"short_key,omitempty"`
|
||||
Nested *Nested `protobuf:"bytes,6,opt,name=nested,proto3" json:"nested,omitempty"`
|
||||
RFunny []Message_Humour `protobuf:"varint,16,rep,packed,name=r_funny,json=rFunny,proto3,enum=proto3_proto.Message_Humour" json:"r_funny,omitempty"`
|
||||
Terrain map[string]*Nested `protobuf:"bytes,10,rep,name=terrain,proto3" json:"terrain,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
Proto2Field *test_proto.SubDefaults `protobuf:"bytes,11,opt,name=proto2_field,json=proto2Field,proto3" json:"proto2_field,omitempty"`
|
||||
Proto2Value map[string]*test_proto.SubDefaults `protobuf:"bytes,13,rep,name=proto2_value,json=proto2Value,proto3" json:"proto2_value,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
Anything *any.Any `protobuf:"bytes,14,opt,name=anything,proto3" json:"anything,omitempty"`
|
||||
ManyThings []*any.Any `protobuf:"bytes,15,rep,name=many_things,json=manyThings,proto3" json:"many_things,omitempty"`
|
||||
Submessage *Message `protobuf:"bytes,17,opt,name=submessage,proto3" json:"submessage,omitempty"`
|
||||
Children []*Message `protobuf:"bytes,18,rep,name=children,proto3" json:"children,omitempty"`
|
||||
StringMap map[string]string `protobuf:"bytes,20,rep,name=string_map,json=stringMap,proto3" json:"string_map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -78,7 +78,7 @@ func (m *Message) Reset() { *m = Message{} }
|
||||
func (m *Message) String() string { return proto.CompactTextString(m) }
|
||||
func (*Message) ProtoMessage() {}
|
||||
func (*Message) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_e706e4ff19a5dbea, []int{0}
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{0}
|
||||
}
|
||||
func (m *Message) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Message.Unmarshal(m, b)
|
||||
@ -232,8 +232,8 @@ func (m *Message) GetStringMap() map[string]string {
|
||||
}
|
||||
|
||||
type Nested struct {
|
||||
Bunny string `protobuf:"bytes,1,opt,name=bunny" json:"bunny,omitempty"`
|
||||
Cute bool `protobuf:"varint,2,opt,name=cute" json:"cute,omitempty"`
|
||||
Bunny string `protobuf:"bytes,1,opt,name=bunny,proto3" json:"bunny,omitempty"`
|
||||
Cute bool `protobuf:"varint,2,opt,name=cute,proto3" json:"cute,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -243,7 +243,7 @@ func (m *Nested) Reset() { *m = Nested{} }
|
||||
func (m *Nested) String() string { return proto.CompactTextString(m) }
|
||||
func (*Nested) ProtoMessage() {}
|
||||
func (*Nested) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_e706e4ff19a5dbea, []int{1}
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{1}
|
||||
}
|
||||
func (m *Nested) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Nested.Unmarshal(m, b)
|
||||
@ -278,7 +278,7 @@ func (m *Nested) GetCute() bool {
|
||||
}
|
||||
|
||||
type MessageWithMap struct {
|
||||
ByteMapping map[bool][]byte `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
ByteMapping map[bool][]byte `protobuf:"bytes,1,rep,name=byte_mapping,json=byteMapping,proto3" json:"byte_mapping,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -288,7 +288,7 @@ func (m *MessageWithMap) Reset() { *m = MessageWithMap{} }
|
||||
func (m *MessageWithMap) String() string { return proto.CompactTextString(m) }
|
||||
func (*MessageWithMap) ProtoMessage() {}
|
||||
func (*MessageWithMap) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_e706e4ff19a5dbea, []int{2}
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{2}
|
||||
}
|
||||
func (m *MessageWithMap) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MessageWithMap.Unmarshal(m, b)
|
||||
@ -316,7 +316,7 @@ func (m *MessageWithMap) GetByteMapping() map[bool][]byte {
|
||||
}
|
||||
|
||||
type IntMap struct {
|
||||
Rtt map[int32]int32 `protobuf:"bytes,1,rep,name=rtt" json:"rtt,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"`
|
||||
Rtt map[int32]int32 `protobuf:"bytes,1,rep,name=rtt,proto3" json:"rtt,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -326,7 +326,7 @@ func (m *IntMap) Reset() { *m = IntMap{} }
|
||||
func (m *IntMap) String() string { return proto.CompactTextString(m) }
|
||||
func (*IntMap) ProtoMessage() {}
|
||||
func (*IntMap) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_e706e4ff19a5dbea, []int{3}
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{3}
|
||||
}
|
||||
func (m *IntMap) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_IntMap.Unmarshal(m, b)
|
||||
@ -354,7 +354,7 @@ func (m *IntMap) GetRtt() map[int32]int32 {
|
||||
}
|
||||
|
||||
type IntMaps struct {
|
||||
Maps []*IntMap `protobuf:"bytes,1,rep,name=maps" json:"maps,omitempty"`
|
||||
Maps []*IntMap `protobuf:"bytes,1,rep,name=maps,proto3" json:"maps,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -364,7 +364,7 @@ func (m *IntMaps) Reset() { *m = IntMaps{} }
|
||||
func (m *IntMaps) String() string { return proto.CompactTextString(m) }
|
||||
func (*IntMaps) ProtoMessage() {}
|
||||
func (*IntMaps) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_e706e4ff19a5dbea, []int{4}
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{4}
|
||||
}
|
||||
func (m *IntMaps) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_IntMaps.Unmarshal(m, b)
|
||||
@ -391,6 +391,146 @@ func (m *IntMaps) GetMaps() []*IntMap {
|
||||
return nil
|
||||
}
|
||||
|
||||
type TestUTF8 struct {
|
||||
Scalar string `protobuf:"bytes,1,opt,name=scalar,proto3" json:"scalar,omitempty"`
|
||||
Vector []string `protobuf:"bytes,2,rep,name=vector,proto3" json:"vector,omitempty"`
|
||||
// Types that are valid to be assigned to Oneof:
|
||||
// *TestUTF8_Field
|
||||
Oneof isTestUTF8_Oneof `protobuf_oneof:"oneof"`
|
||||
MapKey map[string]int64 `protobuf:"bytes,4,rep,name=map_key,json=mapKey,proto3" json:"map_key,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
MapValue map[int64]string `protobuf:"bytes,5,rep,name=map_value,json=mapValue,proto3" json:"map_value,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TestUTF8) Reset() { *m = TestUTF8{} }
|
||||
func (m *TestUTF8) String() string { return proto.CompactTextString(m) }
|
||||
func (*TestUTF8) ProtoMessage() {}
|
||||
func (*TestUTF8) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto3_78ae00cd7e6e5e35, []int{5}
|
||||
}
|
||||
func (m *TestUTF8) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_TestUTF8.Unmarshal(m, b)
|
||||
}
|
||||
func (m *TestUTF8) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TestUTF8.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *TestUTF8) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TestUTF8.Merge(dst, src)
|
||||
}
|
||||
func (m *TestUTF8) XXX_Size() int {
|
||||
return xxx_messageInfo_TestUTF8.Size(m)
|
||||
}
|
||||
func (m *TestUTF8) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TestUTF8.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TestUTF8 proto.InternalMessageInfo
|
||||
|
||||
func (m *TestUTF8) GetScalar() string {
|
||||
if m != nil {
|
||||
return m.Scalar
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TestUTF8) GetVector() []string {
|
||||
if m != nil {
|
||||
return m.Vector
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isTestUTF8_Oneof interface {
|
||||
isTestUTF8_Oneof()
|
||||
}
|
||||
|
||||
type TestUTF8_Field struct {
|
||||
Field string `protobuf:"bytes,3,opt,name=field,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*TestUTF8_Field) isTestUTF8_Oneof() {}
|
||||
|
||||
func (m *TestUTF8) GetOneof() isTestUTF8_Oneof {
|
||||
if m != nil {
|
||||
return m.Oneof
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TestUTF8) GetField() string {
|
||||
if x, ok := m.GetOneof().(*TestUTF8_Field); ok {
|
||||
return x.Field
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *TestUTF8) GetMapKey() map[string]int64 {
|
||||
if m != nil {
|
||||
return m.MapKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TestUTF8) GetMapValue() map[int64]string {
|
||||
if m != nil {
|
||||
return m.MapValue
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*TestUTF8) 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 _TestUTF8_OneofMarshaler, _TestUTF8_OneofUnmarshaler, _TestUTF8_OneofSizer, []interface{}{
|
||||
(*TestUTF8_Field)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _TestUTF8_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*TestUTF8)
|
||||
// oneof
|
||||
switch x := m.Oneof.(type) {
|
||||
case *TestUTF8_Field:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
b.EncodeStringBytes(x.Field)
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("TestUTF8.Oneof has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _TestUTF8_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*TestUTF8)
|
||||
switch tag {
|
||||
case 3: // oneof.field
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
x, err := b.DecodeStringBytes()
|
||||
m.Oneof = &TestUTF8_Field{x}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _TestUTF8_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*TestUTF8)
|
||||
// oneof
|
||||
switch x := m.Oneof.(type) {
|
||||
case *TestUTF8_Field:
|
||||
n += 1 // tag and wire
|
||||
n += proto.SizeVarint(uint64(len(x.Field)))
|
||||
n += len(x.Field)
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Message)(nil), "proto3_proto.Message")
|
||||
proto.RegisterMapType((map[string]*test_proto.SubDefaults)(nil), "proto3_proto.Message.Proto2ValueEntry")
|
||||
@ -402,60 +542,70 @@ func init() {
|
||||
proto.RegisterType((*IntMap)(nil), "proto3_proto.IntMap")
|
||||
proto.RegisterMapType((map[int32]int32)(nil), "proto3_proto.IntMap.RttEntry")
|
||||
proto.RegisterType((*IntMaps)(nil), "proto3_proto.IntMaps")
|
||||
proto.RegisterType((*TestUTF8)(nil), "proto3_proto.TestUTF8")
|
||||
proto.RegisterMapType((map[string]int64)(nil), "proto3_proto.TestUTF8.MapKeyEntry")
|
||||
proto.RegisterMapType((map[int64]string)(nil), "proto3_proto.TestUTF8.MapValueEntry")
|
||||
proto.RegisterEnum("proto3_proto.Message_Humour", Message_Humour_name, Message_Humour_value)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor_proto3_e706e4ff19a5dbea) }
|
||||
func init() { proto.RegisterFile("proto3_proto/proto3.proto", fileDescriptor_proto3_78ae00cd7e6e5e35) }
|
||||
|
||||
var fileDescriptor_proto3_e706e4ff19a5dbea = []byte{
|
||||
// 774 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0x6f, 0x8f, 0xdb, 0x44,
|
||||
0x10, 0xc6, 0x71, 0x9c, 0x3f, 0xce, 0xd8, 0x77, 0x35, 0x4b, 0x2a, 0xb6, 0x01, 0x24, 0x13, 0x10,
|
||||
0xb2, 0x10, 0xf5, 0x41, 0xaa, 0x43, 0x55, 0x55, 0x81, 0xee, 0x8e, 0x56, 0x44, 0x77, 0x17, 0xa2,
|
||||
0xcd, 0x95, 0x13, 0xaf, 0xac, 0x4d, 0x6e, 0x93, 0x58, 0xc4, 0xeb, 0xe0, 0x5d, 0x23, 0xf9, 0x0b,
|
||||
0xf0, 0x41, 0xf8, 0xa4, 0x68, 0x77, 0x9d, 0xd4, 0xa9, 0x5c, 0xfa, 0x2a, 0xbb, 0x8f, 0x7f, 0x33,
|
||||
0xcf, 0x78, 0x66, 0x1c, 0x78, 0xb2, 0xcb, 0x33, 0x99, 0x3d, 0x8b, 0xf5, 0xcf, 0x99, 0xb9, 0x44,
|
||||
0xfa, 0x07, 0x79, 0xf5, 0x47, 0xc3, 0x27, 0xeb, 0x2c, 0x5b, 0x6f, 0x99, 0x41, 0x16, 0xc5, 0xea,
|
||||
0x8c, 0xf2, 0xd2, 0x80, 0xc3, 0xc7, 0x92, 0x09, 0x59, 0x65, 0x50, 0x47, 0x23, 0x8f, 0xfe, 0xe9,
|
||||
0x43, 0xef, 0x96, 0x09, 0x41, 0xd7, 0x0c, 0x21, 0x68, 0x73, 0x9a, 0x32, 0x6c, 0x05, 0x56, 0xd8,
|
||||
0x27, 0xfa, 0x8c, 0x9e, 0x83, 0xb3, 0x49, 0xb6, 0x34, 0x4f, 0x64, 0x89, 0x5b, 0x81, 0x15, 0x9e,
|
||||
0x8e, 0x3f, 0x8f, 0xea, 0x96, 0x51, 0x15, 0x1c, 0xfd, 0x5a, 0xa4, 0x59, 0x91, 0x93, 0x03, 0x8d,
|
||||
0x02, 0xf0, 0x36, 0x2c, 0x59, 0x6f, 0x64, 0x9c, 0xf0, 0x78, 0x99, 0x62, 0x3b, 0xb0, 0xc2, 0x13,
|
||||
0x02, 0x46, 0x9b, 0xf0, 0xab, 0x54, 0xf9, 0x3d, 0x50, 0x49, 0x71, 0x3b, 0xb0, 0x42, 0x8f, 0xe8,
|
||||
0x33, 0xfa, 0x12, 0xbc, 0x9c, 0x89, 0x62, 0x2b, 0xe3, 0x65, 0x56, 0x70, 0x89, 0x7b, 0x81, 0x15,
|
||||
0xda, 0xc4, 0x35, 0xda, 0x95, 0x92, 0xd0, 0x57, 0x70, 0x22, 0xf3, 0x82, 0xc5, 0x62, 0x99, 0x49,
|
||||
0x91, 0x52, 0x8e, 0x9d, 0xc0, 0x0a, 0x1d, 0xe2, 0x29, 0x71, 0x5e, 0x69, 0x68, 0x00, 0x1d, 0xb1,
|
||||
0xcc, 0x72, 0x86, 0xfb, 0x81, 0x15, 0xb6, 0x88, 0xb9, 0x20, 0x1f, 0xec, 0x3f, 0x59, 0x89, 0x3b,
|
||||
0x81, 0x1d, 0xb6, 0x89, 0x3a, 0xa2, 0xcf, 0xa0, 0x2f, 0x36, 0x59, 0x2e, 0x63, 0xa5, 0x7f, 0x12,
|
||||
0xd8, 0x61, 0x87, 0x38, 0x5a, 0xb8, 0x66, 0x25, 0xfa, 0x0e, 0xba, 0x9c, 0x09, 0xc9, 0x1e, 0x70,
|
||||
0x37, 0xb0, 0x42, 0x77, 0x3c, 0x38, 0x7e, 0xf5, 0xa9, 0x7e, 0x46, 0x2a, 0x06, 0x9d, 0x43, 0x2f,
|
||||
0x8f, 0x57, 0x05, 0xe7, 0x25, 0xf6, 0x03, 0xfb, 0x83, 0x9d, 0xea, 0xe6, 0xaf, 0x15, 0x8b, 0x5e,
|
||||
0x42, 0x4f, 0xb2, 0x3c, 0xa7, 0x09, 0xc7, 0x10, 0xd8, 0xa1, 0x3b, 0x1e, 0x35, 0x87, 0xdd, 0x19,
|
||||
0xe8, 0x15, 0x97, 0x79, 0x49, 0xf6, 0x21, 0xe8, 0x05, 0x98, 0x0d, 0x18, 0xc7, 0xab, 0x84, 0x6d,
|
||||
0x1f, 0xb0, 0xab, 0x0b, 0xfd, 0x34, 0x7a, 0x3b, 0xed, 0x68, 0x5e, 0x2c, 0x7e, 0x61, 0x2b, 0x5a,
|
||||
0x6c, 0xa5, 0x20, 0xae, 0x81, 0x5f, 0x2b, 0x16, 0x4d, 0x0e, 0xb1, 0x7f, 0xd3, 0x6d, 0xc1, 0xf0,
|
||||
0x89, 0xb6, 0xff, 0xa6, 0xd9, 0x7e, 0xa6, 0xc9, 0xdf, 0x15, 0x68, 0x4a, 0xa8, 0x52, 0x69, 0x05,
|
||||
0x7d, 0x0f, 0x0e, 0xe5, 0xa5, 0xdc, 0x24, 0x7c, 0x8d, 0x4f, 0xab, 0x5e, 0x99, 0x5d, 0x8c, 0xf6,
|
||||
0xbb, 0x18, 0x5d, 0xf0, 0x92, 0x1c, 0x28, 0x74, 0x0e, 0x6e, 0x4a, 0x79, 0x19, 0xeb, 0x9b, 0xc0,
|
||||
0x8f, 0xb4, 0x77, 0x73, 0x10, 0x28, 0xf0, 0x4e, 0x73, 0xe8, 0x1c, 0x40, 0x14, 0x8b, 0xd4, 0x14,
|
||||
0x85, 0x3f, 0xd6, 0x56, 0x8f, 0x1b, 0x2b, 0x26, 0x35, 0x10, 0xfd, 0x00, 0xce, 0x72, 0x93, 0x6c,
|
||||
0x1f, 0x72, 0xc6, 0x31, 0xd2, 0x56, 0xef, 0x09, 0x3a, 0x60, 0xe8, 0x0a, 0x40, 0xc8, 0x3c, 0xe1,
|
||||
0xeb, 0x38, 0xa5, 0x3b, 0x3c, 0xd0, 0x41, 0x5f, 0x37, 0xf7, 0x66, 0xae, 0xb9, 0x5b, 0xba, 0x33,
|
||||
0x9d, 0xe9, 0x8b, 0xfd, 0x7d, 0x38, 0x03, 0xaf, 0x3e, 0xb7, 0xfd, 0x02, 0x9a, 0x2f, 0x4c, 0x2f,
|
||||
0xe0, 0xb7, 0xd0, 0x31, 0xdd, 0x6f, 0xfd, 0xcf, 0x8a, 0x19, 0xe4, 0x45, 0xeb, 0xb9, 0x35, 0xbc,
|
||||
0x07, 0xff, 0xdd, 0x51, 0x34, 0x64, 0x7d, 0x7a, 0x9c, 0xf5, 0xbd, 0xfb, 0x50, 0x4b, 0xfc, 0x12,
|
||||
0x4e, 0x8f, 0xdf, 0xa3, 0x21, 0xed, 0xa0, 0x9e, 0xb6, 0x5f, 0x8b, 0x1e, 0xfd, 0x0c, 0x5d, 0xb3,
|
||||
0xd7, 0xc8, 0x85, 0xde, 0x9b, 0xe9, 0xf5, 0xf4, 0xb7, 0xfb, 0xa9, 0xff, 0x11, 0x72, 0xa0, 0x3d,
|
||||
0x7b, 0x33, 0x9d, 0xfb, 0x16, 0x3a, 0x81, 0xfe, 0xfc, 0xe6, 0x62, 0x36, 0xbf, 0x9b, 0x5c, 0x5d,
|
||||
0xfb, 0x2d, 0xf4, 0x08, 0xdc, 0xcb, 0xc9, 0xcd, 0x4d, 0x7c, 0x79, 0x31, 0xb9, 0x79, 0xf5, 0x87,
|
||||
0x6f, 0x8f, 0xc6, 0xd0, 0x35, 0x2f, 0xab, 0x4c, 0x16, 0xfa, 0x2b, 0x32, 0xc6, 0xe6, 0xa2, 0xfe,
|
||||
0x2c, 0x96, 0x85, 0x34, 0xce, 0x0e, 0xd1, 0xe7, 0xd1, 0xbf, 0x16, 0x9c, 0x56, 0x33, 0xb8, 0x4f,
|
||||
0xe4, 0xe6, 0x96, 0xee, 0xd0, 0x0c, 0xbc, 0x45, 0x29, 0x99, 0x9a, 0xd9, 0x4e, 0x2d, 0xa3, 0xa5,
|
||||
0xe7, 0xf6, 0xb4, 0x71, 0x6e, 0x55, 0x4c, 0x74, 0x59, 0x4a, 0x76, 0x6b, 0xf8, 0x6a, 0xb5, 0x17,
|
||||
0x6f, 0x95, 0xe1, 0x4f, 0xe0, 0xbf, 0x0b, 0xd4, 0x3b, 0xe3, 0x34, 0x74, 0xc6, 0xab, 0x77, 0xe6,
|
||||
0x2f, 0xe8, 0x4e, 0xb8, 0x54, 0xb5, 0x9d, 0x81, 0x9d, 0x4b, 0x59, 0x95, 0xf4, 0xc5, 0x71, 0x49,
|
||||
0x06, 0x89, 0x88, 0x94, 0xa6, 0x04, 0x45, 0x0e, 0x7f, 0x04, 0x67, 0x2f, 0xd4, 0x2d, 0x3b, 0x0d,
|
||||
0x96, 0x9d, 0xba, 0xe5, 0x33, 0xe8, 0x99, 0x7c, 0x02, 0x85, 0xd0, 0x4e, 0xe9, 0x4e, 0x54, 0xa6,
|
||||
0x83, 0x26, 0x53, 0xa2, 0x89, 0x45, 0xd7, 0x3c, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x99, 0x24,
|
||||
0x6b, 0x12, 0x6d, 0x06, 0x00, 0x00,
|
||||
var fileDescriptor_proto3_78ae00cd7e6e5e35 = []byte{
|
||||
// 896 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x6f, 0x6f, 0xdb, 0xb6,
|
||||
0x13, 0xae, 0x2c, 0xff, 0x91, 0xcf, 0x76, 0xea, 0x1f, 0x7f, 0x6e, 0xc7, 0x7a, 0x1b, 0xa0, 0x79,
|
||||
0xc3, 0x20, 0x0c, 0xab, 0xb2, 0xb9, 0xc8, 0x90, 0xb5, 0xc5, 0x86, 0x24, 0x6b, 0x50, 0x23, 0xb1,
|
||||
0x67, 0xd0, 0xce, 0x82, 0xbd, 0x12, 0x68, 0x87, 0xb6, 0x85, 0x59, 0x94, 0x27, 0x52, 0x05, 0xf4,
|
||||
0x05, 0xf6, 0x41, 0xf6, 0x95, 0xf6, 0x85, 0x06, 0x92, 0x72, 0x2a, 0x17, 0xea, 0xf2, 0x4a, 0xbc,
|
||||
0x47, 0xcf, 0xdd, 0x73, 0xbc, 0x3b, 0x1e, 0x3c, 0xdb, 0x25, 0xb1, 0x8c, 0x5f, 0x04, 0xfa, 0x73,
|
||||
0x6c, 0x0c, 0x5f, 0x7f, 0x50, 0xbb, 0xf8, 0xab, 0xff, 0x6c, 0x1d, 0xc7, 0xeb, 0x2d, 0x33, 0x94,
|
||||
0x45, 0xba, 0x3a, 0xa6, 0x3c, 0x33, 0xc4, 0xfe, 0x13, 0xc9, 0x84, 0xcc, 0x23, 0xa8, 0xa3, 0x81,
|
||||
0x07, 0x7f, 0x35, 0xa1, 0x31, 0x66, 0x42, 0xd0, 0x35, 0x43, 0x08, 0xaa, 0x9c, 0x46, 0x0c, 0x5b,
|
||||
0xae, 0xe5, 0x35, 0x89, 0x3e, 0xa3, 0x53, 0x70, 0x36, 0xe1, 0x96, 0x26, 0xa1, 0xcc, 0x70, 0xc5,
|
||||
0xb5, 0xbc, 0xa3, 0xe1, 0x67, 0x7e, 0x51, 0xd2, 0xcf, 0x9d, 0xfd, 0xb7, 0x69, 0x14, 0xa7, 0x09,
|
||||
0xb9, 0x67, 0x23, 0x17, 0xda, 0x1b, 0x16, 0xae, 0x37, 0x32, 0x08, 0x79, 0xb0, 0x8c, 0xb0, 0xed,
|
||||
0x5a, 0x5e, 0x87, 0x80, 0xc1, 0x46, 0xfc, 0x22, 0x52, 0x7a, 0x77, 0x54, 0x52, 0x5c, 0x75, 0x2d,
|
||||
0xaf, 0x4d, 0xf4, 0x19, 0x7d, 0x01, 0xed, 0x84, 0x89, 0x74, 0x2b, 0x83, 0x65, 0x9c, 0x72, 0x89,
|
||||
0x1b, 0xae, 0xe5, 0xd9, 0xa4, 0x65, 0xb0, 0x0b, 0x05, 0xa1, 0x2f, 0xa1, 0x23, 0x93, 0x94, 0x05,
|
||||
0x62, 0x19, 0x4b, 0x11, 0x51, 0x8e, 0x1d, 0xd7, 0xf2, 0x1c, 0xd2, 0x56, 0xe0, 0x2c, 0xc7, 0x50,
|
||||
0x0f, 0x6a, 0x62, 0x19, 0x27, 0x0c, 0x37, 0x5d, 0xcb, 0xab, 0x10, 0x63, 0xa0, 0x2e, 0xd8, 0x7f,
|
||||
0xb0, 0x0c, 0xd7, 0x5c, 0xdb, 0xab, 0x12, 0x75, 0x44, 0x9f, 0x42, 0x53, 0x6c, 0xe2, 0x44, 0x06,
|
||||
0x0a, 0xff, 0xbf, 0x6b, 0x7b, 0x35, 0xe2, 0x68, 0xe0, 0x8a, 0x65, 0xe8, 0x5b, 0xa8, 0x73, 0x26,
|
||||
0x24, 0xbb, 0xc3, 0x75, 0xd7, 0xf2, 0x5a, 0xc3, 0xde, 0xe1, 0xd5, 0x27, 0xfa, 0x1f, 0xc9, 0x39,
|
||||
0xe8, 0x04, 0x1a, 0x49, 0xb0, 0x4a, 0x39, 0xcf, 0x70, 0xd7, 0xb5, 0x1f, 0xac, 0x54, 0x3d, 0xb9,
|
||||
0x54, 0x5c, 0xf4, 0x1a, 0x1a, 0x92, 0x25, 0x09, 0x0d, 0x39, 0x06, 0xd7, 0xf6, 0x5a, 0xc3, 0x41,
|
||||
0xb9, 0xdb, 0xdc, 0x90, 0xde, 0x70, 0x99, 0x64, 0x64, 0xef, 0x82, 0x5e, 0x82, 0x99, 0x80, 0x61,
|
||||
0xb0, 0x0a, 0xd9, 0xf6, 0x0e, 0xb7, 0x74, 0xa2, 0x9f, 0xf8, 0xef, 0xbb, 0xed, 0xcf, 0xd2, 0xc5,
|
||||
0x2f, 0x6c, 0x45, 0xd3, 0xad, 0x14, 0xa4, 0x65, 0xc8, 0x97, 0x8a, 0x8b, 0x46, 0xf7, 0xbe, 0xef,
|
||||
0xe8, 0x36, 0x65, 0xb8, 0xa3, 0xe5, 0xbf, 0x2e, 0x97, 0x9f, 0x6a, 0xe6, 0x6f, 0x8a, 0x68, 0x52,
|
||||
0xc8, 0x43, 0x69, 0x04, 0x7d, 0x07, 0x0e, 0xe5, 0x99, 0xdc, 0x84, 0x7c, 0x8d, 0x8f, 0xf2, 0x5a,
|
||||
0x99, 0x59, 0xf4, 0xf7, 0xb3, 0xe8, 0x9f, 0xf1, 0x8c, 0xdc, 0xb3, 0xd0, 0x09, 0xb4, 0x22, 0xca,
|
||||
0xb3, 0x40, 0x5b, 0x02, 0x3f, 0xd6, 0xda, 0xe5, 0x4e, 0xa0, 0x88, 0x73, 0xcd, 0x43, 0x27, 0x00,
|
||||
0x22, 0x5d, 0x44, 0x26, 0x29, 0xfc, 0x3f, 0x2d, 0xf5, 0xa4, 0x34, 0x63, 0x52, 0x20, 0xa2, 0xef,
|
||||
0xc1, 0x59, 0x6e, 0xc2, 0xed, 0x5d, 0xc2, 0x38, 0x46, 0x5a, 0xea, 0x23, 0x4e, 0xf7, 0x34, 0x74,
|
||||
0x01, 0x20, 0x64, 0x12, 0xf2, 0x75, 0x10, 0xd1, 0x1d, 0xee, 0x69, 0xa7, 0xaf, 0xca, 0x6b, 0x33,
|
||||
0xd3, 0xbc, 0x31, 0xdd, 0x99, 0xca, 0x34, 0xc5, 0xde, 0xee, 0x4f, 0xa1, 0x5d, 0xec, 0xdb, 0x7e,
|
||||
0x00, 0xcd, 0x0b, 0xd3, 0x03, 0xf8, 0x0d, 0xd4, 0x4c, 0xf5, 0x2b, 0xff, 0x31, 0x62, 0x86, 0xf2,
|
||||
0xb2, 0x72, 0x6a, 0xf5, 0x6f, 0xa1, 0xfb, 0x61, 0x2b, 0x4a, 0xa2, 0x3e, 0x3f, 0x8c, 0xfa, 0xd1,
|
||||
0x79, 0x28, 0x04, 0x7e, 0x0d, 0x47, 0x87, 0xf7, 0x28, 0x09, 0xdb, 0x2b, 0x86, 0x6d, 0x16, 0xbc,
|
||||
0x07, 0x3f, 0x43, 0xdd, 0xcc, 0x35, 0x6a, 0x41, 0xe3, 0x66, 0x72, 0x35, 0xf9, 0xf5, 0x76, 0xd2,
|
||||
0x7d, 0x84, 0x1c, 0xa8, 0x4e, 0x6f, 0x26, 0xb3, 0xae, 0x85, 0x3a, 0xd0, 0x9c, 0x5d, 0x9f, 0x4d,
|
||||
0x67, 0xf3, 0xd1, 0xc5, 0x55, 0xb7, 0x82, 0x1e, 0x43, 0xeb, 0x7c, 0x74, 0x7d, 0x1d, 0x9c, 0x9f,
|
||||
0x8d, 0xae, 0xdf, 0xfc, 0xde, 0xb5, 0x07, 0x43, 0xa8, 0x9b, 0xcb, 0x2a, 0x91, 0x85, 0x7e, 0x45,
|
||||
0x46, 0xd8, 0x18, 0x6a, 0x59, 0x2c, 0x53, 0x69, 0x94, 0x1d, 0xa2, 0xcf, 0x83, 0xbf, 0x2d, 0x38,
|
||||
0xca, 0x7b, 0x70, 0x1b, 0xca, 0xcd, 0x98, 0xee, 0xd0, 0x14, 0xda, 0x8b, 0x4c, 0x32, 0xd5, 0xb3,
|
||||
0x9d, 0x1a, 0x46, 0x4b, 0xf7, 0xed, 0x79, 0x69, 0xdf, 0x72, 0x1f, 0xff, 0x3c, 0x93, 0x6c, 0x6c,
|
||||
0xf8, 0xf9, 0x68, 0x2f, 0xde, 0x23, 0xfd, 0x9f, 0xa0, 0xfb, 0x21, 0xa1, 0x58, 0x19, 0xa7, 0xa4,
|
||||
0x32, 0xed, 0x62, 0x65, 0xfe, 0x84, 0xfa, 0x88, 0x4b, 0x95, 0xdb, 0x31, 0xd8, 0x89, 0x94, 0x79,
|
||||
0x4a, 0x9f, 0x1f, 0xa6, 0x64, 0x28, 0x3e, 0x91, 0xd2, 0xa4, 0xa0, 0x98, 0xfd, 0x1f, 0xc0, 0xd9,
|
||||
0x03, 0x45, 0xc9, 0x5a, 0x89, 0x64, 0xad, 0x28, 0xf9, 0x02, 0x1a, 0x26, 0x9e, 0x40, 0x1e, 0x54,
|
||||
0x23, 0xba, 0x13, 0xb9, 0x68, 0xaf, 0x4c, 0x94, 0x68, 0xc6, 0xe0, 0x9f, 0x0a, 0x38, 0x73, 0x26,
|
||||
0xe4, 0xcd, 0xfc, 0xf2, 0x14, 0x3d, 0x85, 0xba, 0x58, 0xd2, 0x2d, 0x4d, 0xf2, 0x26, 0xe4, 0x96,
|
||||
0xc2, 0xdf, 0xb1, 0xa5, 0x8c, 0x13, 0x5c, 0x71, 0x6d, 0x85, 0x1b, 0x0b, 0x3d, 0x85, 0x9a, 0xd9,
|
||||
0x3f, 0x6a, 0xcb, 0x37, 0xdf, 0x3e, 0x22, 0xc6, 0x44, 0xaf, 0xa0, 0x11, 0xd1, 0x9d, 0x5e, 0xae,
|
||||
0xd5, 0xb2, 0xe5, 0xb6, 0x17, 0xf4, 0xc7, 0x74, 0x77, 0xc5, 0x32, 0x73, 0xf7, 0x7a, 0xa4, 0x0d,
|
||||
0x74, 0x06, 0x4d, 0xe5, 0x6c, 0x2e, 0x59, 0x2b, 0x7b, 0x80, 0x45, 0xf7, 0xc2, 0x6a, 0x72, 0xa2,
|
||||
0xdc, 0xec, 0xff, 0x08, 0xad, 0x42, 0xe4, 0x87, 0x26, 0xda, 0x2e, 0xbe, 0x87, 0x57, 0xd0, 0x39,
|
||||
0x88, 0x5a, 0x74, 0xb6, 0x1f, 0x78, 0x0e, 0xe7, 0x0d, 0xa8, 0xc5, 0x9c, 0xc5, 0xab, 0x45, 0xdd,
|
||||
0xe4, 0xfb, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xeb, 0x74, 0x17, 0x7f, 0xc3, 0x07, 0x00, 0x00,
|
||||
}
|
||||
|
8
vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.proto
generated
vendored
8
vendor/github.com/golang/protobuf/proto/proto3_proto/proto3.proto
generated
vendored
@ -87,3 +87,11 @@ message IntMap {
|
||||
message IntMaps {
|
||||
repeated IntMap maps = 1;
|
||||
}
|
||||
|
||||
message TestUTF8 {
|
||||
string scalar = 1;
|
||||
repeated string vector = 2;
|
||||
oneof oneof { string field = 3; }
|
||||
map<string, int64> map_key = 4;
|
||||
map<int64, string> map_value = 5;
|
||||
}
|
||||
|
190
vendor/github.com/golang/protobuf/proto/table_marshal.go
generated
vendored
190
vendor/github.com/golang/protobuf/proto/table_marshal.go
generated
vendored
@ -231,7 +231,7 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte
|
||||
return b, err
|
||||
}
|
||||
|
||||
var err, errreq error
|
||||
var err, errLater error
|
||||
// The old marshaler encodes extensions at beginning.
|
||||
if u.extensions.IsValid() {
|
||||
e := ptr.offset(u.extensions).toExtensions()
|
||||
@ -252,11 +252,13 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte
|
||||
}
|
||||
}
|
||||
for _, f := range u.fields {
|
||||
if f.required && errreq == nil {
|
||||
if f.required {
|
||||
if ptr.offset(f.field).getPointer().isNil() {
|
||||
// Required field is not set.
|
||||
// We record the error but keep going, to give a complete marshaling.
|
||||
errreq = &RequiredNotSetError{f.name}
|
||||
if errLater == nil {
|
||||
errLater = &RequiredNotSetError{f.name}
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
@ -269,14 +271,21 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte
|
||||
if err1, ok := err.(*RequiredNotSetError); ok {
|
||||
// Required field in submessage is not set.
|
||||
// We record the error but keep going, to give a complete marshaling.
|
||||
if errreq == nil {
|
||||
errreq = &RequiredNotSetError{f.name + "." + err1.field}
|
||||
if errLater == nil {
|
||||
errLater = &RequiredNotSetError{f.name + "." + err1.field}
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err == errRepeatedHasNil {
|
||||
err = errors.New("proto: repeated field " + f.name + " has nil element")
|
||||
}
|
||||
if err == errInvalidUTF8 {
|
||||
if errLater == nil {
|
||||
fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
|
||||
errLater = &invalidUTF8Error{fullName}
|
||||
}
|
||||
continue
|
||||
}
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
@ -284,7 +293,7 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte
|
||||
s := *ptr.offset(u.unrecognized).toBytes()
|
||||
b = append(b, s...)
|
||||
}
|
||||
return b, errreq
|
||||
return b, errLater
|
||||
}
|
||||
|
||||
// computeMarshalInfo initializes the marshal info.
|
||||
@ -530,6 +539,7 @@ func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, ma
|
||||
|
||||
packed := false
|
||||
proto3 := false
|
||||
validateUTF8 := true
|
||||
for i := 2; i < len(tags); i++ {
|
||||
if tags[i] == "packed" {
|
||||
packed = true
|
||||
@ -538,6 +548,7 @@ func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, ma
|
||||
proto3 = true
|
||||
}
|
||||
}
|
||||
validateUTF8 = validateUTF8 && proto3
|
||||
|
||||
switch t.Kind() {
|
||||
case reflect.Bool:
|
||||
@ -735,6 +746,18 @@ func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, ma
|
||||
}
|
||||
return sizeFloat64Value, appendFloat64Value
|
||||
case reflect.String:
|
||||
if validateUTF8 {
|
||||
if pointer {
|
||||
return sizeStringPtr, appendUTF8StringPtr
|
||||
}
|
||||
if slice {
|
||||
return sizeStringSlice, appendUTF8StringSlice
|
||||
}
|
||||
if nozero {
|
||||
return sizeStringValueNoZero, appendUTF8StringValueNoZero
|
||||
}
|
||||
return sizeStringValue, appendUTF8StringValue
|
||||
}
|
||||
if pointer {
|
||||
return sizeStringPtr, appendStringPtr
|
||||
}
|
||||
@ -1984,9 +2007,6 @@ func appendBoolPackedSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byt
|
||||
}
|
||||
func appendStringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
|
||||
v := *ptr.toString()
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
@ -1997,9 +2017,6 @@ func appendStringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]b
|
||||
if v == "" {
|
||||
return b, nil
|
||||
}
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
@ -2011,9 +2028,6 @@ func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, err
|
||||
return b, nil
|
||||
}
|
||||
v := *p
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
@ -2022,12 +2036,74 @@ func appendStringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, err
|
||||
func appendStringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
|
||||
s := *ptr.toStringSlice()
|
||||
for _, v := range s {
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
func appendUTF8StringValue(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
|
||||
var invalidUTF8 bool
|
||||
v := *ptr.toString()
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
invalidUTF8 = true
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
if invalidUTF8 {
|
||||
return b, errInvalidUTF8
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
func appendUTF8StringValueNoZero(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
|
||||
var invalidUTF8 bool
|
||||
v := *ptr.toString()
|
||||
if v == "" {
|
||||
return b, nil
|
||||
}
|
||||
if !utf8.ValidString(v) {
|
||||
invalidUTF8 = true
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
if invalidUTF8 {
|
||||
return b, errInvalidUTF8
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
func appendUTF8StringPtr(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
|
||||
var invalidUTF8 bool
|
||||
p := *ptr.toStringPtr()
|
||||
if p == nil {
|
||||
return b, nil
|
||||
}
|
||||
v := *p
|
||||
if !utf8.ValidString(v) {
|
||||
invalidUTF8 = true
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
if invalidUTF8 {
|
||||
return b, errInvalidUTF8
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
func appendUTF8StringSlice(b []byte, ptr pointer, wiretag uint64, _ bool) ([]byte, error) {
|
||||
var invalidUTF8 bool
|
||||
s := *ptr.toStringSlice()
|
||||
for _, v := range s {
|
||||
if !utf8.ValidString(v) {
|
||||
invalidUTF8 = true
|
||||
}
|
||||
b = appendVarint(b, wiretag)
|
||||
b = appendVarint(b, uint64(len(v)))
|
||||
b = append(b, v...)
|
||||
}
|
||||
if invalidUTF8 {
|
||||
return b, errInvalidUTF8
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
@ -2107,7 +2183,8 @@ func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
|
||||
},
|
||||
func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
|
||||
s := ptr.getPointerSlice()
|
||||
var err, errreq error
|
||||
var err error
|
||||
var nerr nonFatal
|
||||
for _, v := range s {
|
||||
if v.isNil() {
|
||||
return b, errRepeatedHasNil
|
||||
@ -2115,22 +2192,14 @@ func makeGroupSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
|
||||
b = appendVarint(b, wiretag) // start group
|
||||
b, err = u.marshal(b, v, deterministic)
|
||||
b = appendVarint(b, wiretag+(WireEndGroup-WireStartGroup)) // end group
|
||||
if err != nil {
|
||||
if _, ok := err.(*RequiredNotSetError); ok {
|
||||
// Required field in submessage is not set.
|
||||
// We record the error but keep going, to give a complete marshaling.
|
||||
if errreq == nil {
|
||||
errreq = err
|
||||
}
|
||||
continue
|
||||
}
|
||||
if !nerr.Merge(err) {
|
||||
if err == ErrNil {
|
||||
err = errRepeatedHasNil
|
||||
}
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, errreq
|
||||
return b, nerr.E
|
||||
}
|
||||
}
|
||||
|
||||
@ -2174,7 +2243,8 @@ func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
|
||||
},
|
||||
func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) {
|
||||
s := ptr.getPointerSlice()
|
||||
var err, errreq error
|
||||
var err error
|
||||
var nerr nonFatal
|
||||
for _, v := range s {
|
||||
if v.isNil() {
|
||||
return b, errRepeatedHasNil
|
||||
@ -2184,22 +2254,14 @@ func makeMessageSliceMarshaler(u *marshalInfo) (sizer, marshaler) {
|
||||
b = appendVarint(b, uint64(siz))
|
||||
b, err = u.marshal(b, v, deterministic)
|
||||
|
||||
if err != nil {
|
||||
if _, ok := err.(*RequiredNotSetError); ok {
|
||||
// Required field in submessage is not set.
|
||||
// We record the error but keep going, to give a complete marshaling.
|
||||
if errreq == nil {
|
||||
errreq = err
|
||||
}
|
||||
continue
|
||||
}
|
||||
if !nerr.Merge(err) {
|
||||
if err == ErrNil {
|
||||
err = errRepeatedHasNil
|
||||
}
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, errreq
|
||||
return b, nerr.E
|
||||
}
|
||||
}
|
||||
|
||||
@ -2223,6 +2285,25 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
|
||||
// value.
|
||||
// Key cannot be pointer-typed.
|
||||
valIsPtr := valType.Kind() == reflect.Ptr
|
||||
|
||||
// If value is a message with nested maps, calling
|
||||
// valSizer in marshal may be quadratic. We should use
|
||||
// cached version in marshal (but not in size).
|
||||
// If value is not message type, we don't have size cache,
|
||||
// but it cannot be nested either. Just use valSizer.
|
||||
valCachedSizer := valSizer
|
||||
if valIsPtr && valType.Elem().Kind() == reflect.Struct {
|
||||
u := getMarshalInfo(valType.Elem())
|
||||
valCachedSizer = func(ptr pointer, tagsize int) int {
|
||||
// Same as message sizer, but use cache.
|
||||
p := ptr.getPointer()
|
||||
if p.isNil() {
|
||||
return 0
|
||||
}
|
||||
siz := u.cachedsize(p)
|
||||
return siz + SizeVarint(uint64(siz)) + tagsize
|
||||
}
|
||||
}
|
||||
return func(ptr pointer, tagsize int) int {
|
||||
m := ptr.asPointerTo(t).Elem() // the map
|
||||
n := 0
|
||||
@ -2243,24 +2324,26 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) {
|
||||
if len(keys) > 1 && deterministic {
|
||||
sort.Sort(mapKeys(keys))
|
||||
}
|
||||
|
||||
var nerr nonFatal
|
||||
for _, k := range keys {
|
||||
ki := k.Interface()
|
||||
vi := m.MapIndex(k).Interface()
|
||||
kaddr := toAddrPointer(&ki, false) // pointer to key
|
||||
vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value
|
||||
b = appendVarint(b, tag)
|
||||
siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
|
||||
siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1)
|
||||
b = appendVarint(b, uint64(siz))
|
||||
b, err = keyMarshaler(b, kaddr, keyWireTag, deterministic)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return b, err
|
||||
}
|
||||
b, err = valMarshaler(b, vaddr, valWireTag, deterministic)
|
||||
if err != nil && err != ErrNil { // allow nil value in map
|
||||
if err != ErrNil && !nerr.Merge(err) { // allow nil value in map
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
}
|
||||
|
||||
@ -2333,6 +2416,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de
|
||||
defer mu.Unlock()
|
||||
|
||||
var err error
|
||||
var nerr nonFatal
|
||||
|
||||
// Fast-path for common cases: zero or one extensions.
|
||||
// Don't bother sorting the keys.
|
||||
@ -2352,11 +2436,11 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de
|
||||
v := e.value
|
||||
p := toAddrPointer(&v, ei.isptr)
|
||||
b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
|
||||
// Sort the keys to provide a deterministic encoding.
|
||||
@ -2383,11 +2467,11 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de
|
||||
v := e.value
|
||||
p := toAddrPointer(&v, ei.isptr)
|
||||
b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
|
||||
// message set format is:
|
||||
@ -2444,6 +2528,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de
|
||||
defer mu.Unlock()
|
||||
|
||||
var err error
|
||||
var nerr nonFatal
|
||||
|
||||
// Fast-path for common cases: zero or one extensions.
|
||||
// Don't bother sorting the keys.
|
||||
@ -2470,12 +2555,12 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de
|
||||
v := e.value
|
||||
p := toAddrPointer(&v, ei.isptr)
|
||||
b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return b, err
|
||||
}
|
||||
b = append(b, 1<<3|WireEndGroup)
|
||||
}
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
|
||||
// Sort the keys to provide a deterministic encoding.
|
||||
@ -2509,11 +2594,11 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de
|
||||
p := toAddrPointer(&v, ei.isptr)
|
||||
b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic)
|
||||
b = append(b, 1<<3|WireEndGroup)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
|
||||
// sizeV1Extensions computes the size of encoded data for a V1-API extension field.
|
||||
@ -2556,6 +2641,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ
|
||||
sort.Ints(keys)
|
||||
|
||||
var err error
|
||||
var nerr nonFatal
|
||||
for _, k := range keys {
|
||||
e := m[int32(k)]
|
||||
if e.value == nil || e.desc == nil {
|
||||
@ -2572,11 +2658,11 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ
|
||||
v := e.value
|
||||
p := toAddrPointer(&v, ei.isptr)
|
||||
b, err = ei.marshaler(b, p, ei.wiretag, deterministic)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return b, err
|
||||
}
|
||||
}
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
|
||||
// newMarshaler is the interface representing objects that can marshal themselves.
|
||||
|
144
vendor/github.com/golang/protobuf/proto/table_unmarshal.go
generated
vendored
144
vendor/github.com/golang/protobuf/proto/table_unmarshal.go
generated
vendored
@ -97,6 +97,8 @@ type unmarshalFieldInfo struct {
|
||||
|
||||
// if a required field, contains a single set bit at this field's index in the required field list.
|
||||
reqMask uint64
|
||||
|
||||
name string // name of the field, for error reporting
|
||||
}
|
||||
|
||||
var (
|
||||
@ -137,7 +139,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
|
||||
return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions())
|
||||
}
|
||||
var reqMask uint64 // bitmask of required fields we've seen.
|
||||
var rnse *RequiredNotSetError // an instance of a RequiredNotSetError returned by a submessage.
|
||||
var errLater error
|
||||
for len(b) > 0 {
|
||||
// Read tag and wire type.
|
||||
// Special case 1 and 2 byte varints.
|
||||
@ -176,11 +178,20 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
|
||||
if r, ok := err.(*RequiredNotSetError); ok {
|
||||
// Remember this error, but keep parsing. We need to produce
|
||||
// a full parse even if a required field is missing.
|
||||
rnse = r
|
||||
if errLater == nil {
|
||||
errLater = r
|
||||
}
|
||||
reqMask |= f.reqMask
|
||||
continue
|
||||
}
|
||||
if err != errInternalBadWireType {
|
||||
if err == errInvalidUTF8 {
|
||||
if errLater == nil {
|
||||
fullName := revProtoTypes[reflect.PtrTo(u.typ)] + "." + f.name
|
||||
errLater = &invalidUTF8Error{fullName}
|
||||
}
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
// Fragments with bad wire type are treated as unknown fields.
|
||||
@ -239,20 +250,16 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
|
||||
emap[int32(tag)] = e
|
||||
}
|
||||
}
|
||||
if rnse != nil {
|
||||
// A required field of a submessage/group is missing. Return that error.
|
||||
return rnse
|
||||
}
|
||||
if reqMask != u.reqMask {
|
||||
if reqMask != u.reqMask && errLater == nil {
|
||||
// A required field of this message is missing.
|
||||
for _, n := range u.reqFields {
|
||||
if reqMask&1 == 0 {
|
||||
return &RequiredNotSetError{n}
|
||||
errLater = &RequiredNotSetError{n}
|
||||
}
|
||||
reqMask >>= 1
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return errLater
|
||||
}
|
||||
|
||||
// computeUnmarshalInfo fills in u with information for use
|
||||
@ -351,7 +358,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
||||
}
|
||||
|
||||
// Store the info in the correct slot in the message.
|
||||
u.setTag(tag, toField(&f), unmarshal, reqMask)
|
||||
u.setTag(tag, toField(&f), unmarshal, reqMask, name)
|
||||
}
|
||||
|
||||
// Find any types associated with oneof fields.
|
||||
@ -366,10 +373,17 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
||||
|
||||
f := typ.Field(0) // oneof implementers have one field
|
||||
baseUnmarshal := fieldUnmarshaler(&f)
|
||||
tagstr := strings.Split(f.Tag.Get("protobuf"), ",")[1]
|
||||
tag, err := strconv.Atoi(tagstr)
|
||||
tags := strings.Split(f.Tag.Get("protobuf"), ",")
|
||||
fieldNum, err := strconv.Atoi(tags[1])
|
||||
if err != nil {
|
||||
panic("protobuf tag field not an integer: " + tagstr)
|
||||
panic("protobuf tag field not an integer: " + tags[1])
|
||||
}
|
||||
var name string
|
||||
for _, tag := range tags {
|
||||
if strings.HasPrefix(tag, "name=") {
|
||||
name = strings.TrimPrefix(tag, "name=")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Find the oneof field that this struct implements.
|
||||
@ -380,7 +394,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
||||
// That lets us know where this struct should be stored
|
||||
// when we encounter it during unmarshaling.
|
||||
unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal)
|
||||
u.setTag(tag, of.field, unmarshal, 0)
|
||||
u.setTag(fieldNum, of.field, unmarshal, 0, name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -401,7 +415,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
||||
// [0 0] is [tag=0/wiretype=varint varint-encoded-0].
|
||||
u.setTag(0, zeroField, func(b []byte, f pointer, w int) ([]byte, error) {
|
||||
return nil, fmt.Errorf("proto: %s: illegal tag 0 (wire type %d)", t, w)
|
||||
}, 0)
|
||||
}, 0, "")
|
||||
|
||||
// Set mask for required field check.
|
||||
u.reqMask = uint64(1)<<uint(len(u.reqFields)) - 1
|
||||
@ -413,8 +427,9 @@ func (u *unmarshalInfo) computeUnmarshalInfo() {
|
||||
// tag = tag # for field
|
||||
// field/unmarshal = unmarshal info for that field.
|
||||
// reqMask = if required, bitmask for field position in required field list. 0 otherwise.
|
||||
func (u *unmarshalInfo) setTag(tag int, field field, unmarshal unmarshaler, reqMask uint64) {
|
||||
i := unmarshalFieldInfo{field: field, unmarshal: unmarshal, reqMask: reqMask}
|
||||
// name = short name of the field.
|
||||
func (u *unmarshalInfo) setTag(tag int, field field, unmarshal unmarshaler, reqMask uint64, name string) {
|
||||
i := unmarshalFieldInfo{field: field, unmarshal: unmarshal, reqMask: reqMask, name: name}
|
||||
n := u.typ.NumField()
|
||||
if tag >= 0 && (tag < 16 || tag < 2*n) { // TODO: what are the right numbers here?
|
||||
for len(u.dense) <= tag {
|
||||
@ -442,11 +457,17 @@ func typeUnmarshaler(t reflect.Type, tags string) unmarshaler {
|
||||
tagArray := strings.Split(tags, ",")
|
||||
encoding := tagArray[0]
|
||||
name := "unknown"
|
||||
proto3 := false
|
||||
validateUTF8 := true
|
||||
for _, tag := range tagArray[3:] {
|
||||
if strings.HasPrefix(tag, "name=") {
|
||||
name = tag[5:]
|
||||
}
|
||||
if tag == "proto3" {
|
||||
proto3 = true
|
||||
}
|
||||
}
|
||||
validateUTF8 = validateUTF8 && proto3
|
||||
|
||||
// Figure out packaging (pointer, slice, or both)
|
||||
slice := false
|
||||
@ -594,6 +615,15 @@ func typeUnmarshaler(t reflect.Type, tags string) unmarshaler {
|
||||
}
|
||||
return unmarshalBytesValue
|
||||
case reflect.String:
|
||||
if validateUTF8 {
|
||||
if pointer {
|
||||
return unmarshalUTF8StringPtr
|
||||
}
|
||||
if slice {
|
||||
return unmarshalUTF8StringSlice
|
||||
}
|
||||
return unmarshalUTF8StringValue
|
||||
}
|
||||
if pointer {
|
||||
return unmarshalStringPtr
|
||||
}
|
||||
@ -1448,9 +1478,6 @@ func unmarshalStringValue(b []byte, f pointer, w int) ([]byte, error) {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
v := string(b[:x])
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
}
|
||||
*f.toString() = v
|
||||
return b[x:], nil
|
||||
}
|
||||
@ -1468,9 +1495,6 @@ func unmarshalStringPtr(b []byte, f pointer, w int) ([]byte, error) {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
v := string(b[:x])
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
}
|
||||
*f.toStringPtr() = &v
|
||||
return b[x:], nil
|
||||
}
|
||||
@ -1488,14 +1512,72 @@ func unmarshalStringSlice(b []byte, f pointer, w int) ([]byte, error) {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
v := string(b[:x])
|
||||
if !utf8.ValidString(v) {
|
||||
return nil, errInvalidUTF8
|
||||
}
|
||||
s := f.toStringSlice()
|
||||
*s = append(*s, v)
|
||||
return b[x:], nil
|
||||
}
|
||||
|
||||
func unmarshalUTF8StringValue(b []byte, f pointer, w int) ([]byte, error) {
|
||||
if w != WireBytes {
|
||||
return b, errInternalBadWireType
|
||||
}
|
||||
x, n := decodeVarint(b)
|
||||
if n == 0 {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
b = b[n:]
|
||||
if x > uint64(len(b)) {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
v := string(b[:x])
|
||||
*f.toString() = v
|
||||
if !utf8.ValidString(v) {
|
||||
return b[x:], errInvalidUTF8
|
||||
}
|
||||
return b[x:], nil
|
||||
}
|
||||
|
||||
func unmarshalUTF8StringPtr(b []byte, f pointer, w int) ([]byte, error) {
|
||||
if w != WireBytes {
|
||||
return b, errInternalBadWireType
|
||||
}
|
||||
x, n := decodeVarint(b)
|
||||
if n == 0 {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
b = b[n:]
|
||||
if x > uint64(len(b)) {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
v := string(b[:x])
|
||||
*f.toStringPtr() = &v
|
||||
if !utf8.ValidString(v) {
|
||||
return b[x:], errInvalidUTF8
|
||||
}
|
||||
return b[x:], nil
|
||||
}
|
||||
|
||||
func unmarshalUTF8StringSlice(b []byte, f pointer, w int) ([]byte, error) {
|
||||
if w != WireBytes {
|
||||
return b, errInternalBadWireType
|
||||
}
|
||||
x, n := decodeVarint(b)
|
||||
if n == 0 {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
b = b[n:]
|
||||
if x > uint64(len(b)) {
|
||||
return nil, io.ErrUnexpectedEOF
|
||||
}
|
||||
v := string(b[:x])
|
||||
s := f.toStringSlice()
|
||||
*s = append(*s, v)
|
||||
if !utf8.ValidString(v) {
|
||||
return b[x:], errInvalidUTF8
|
||||
}
|
||||
return b[x:], nil
|
||||
}
|
||||
|
||||
var emptyBuf [0]byte
|
||||
|
||||
func unmarshalBytesValue(b []byte, f pointer, w int) ([]byte, error) {
|
||||
@ -1674,6 +1756,7 @@ func makeUnmarshalMap(f *reflect.StructField) unmarshaler {
|
||||
// Maps will be somewhat slow. Oh well.
|
||||
|
||||
// Read key and value from data.
|
||||
var nerr nonFatal
|
||||
k := reflect.New(kt)
|
||||
v := reflect.New(vt)
|
||||
for len(b) > 0 {
|
||||
@ -1694,7 +1777,7 @@ func makeUnmarshalMap(f *reflect.StructField) unmarshaler {
|
||||
err = errInternalBadWireType // skip unknown tag
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
if nerr.Merge(err) {
|
||||
continue
|
||||
}
|
||||
if err != errInternalBadWireType {
|
||||
@ -1717,7 +1800,7 @@ func makeUnmarshalMap(f *reflect.StructField) unmarshaler {
|
||||
// Insert into map.
|
||||
m.SetMapIndex(k.Elem(), v.Elem())
|
||||
|
||||
return r, nil
|
||||
return r, nerr.E
|
||||
}
|
||||
}
|
||||
|
||||
@ -1743,15 +1826,16 @@ func makeUnmarshalOneof(typ, ityp reflect.Type, unmarshal unmarshaler) unmarshal
|
||||
// Unmarshal data into holder.
|
||||
// We unmarshal into the first field of the holder object.
|
||||
var err error
|
||||
var nerr nonFatal
|
||||
b, err = unmarshal(b, valToPointer(v).offset(field0), w)
|
||||
if err != nil {
|
||||
if !nerr.Merge(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Write pointer to holder into target field.
|
||||
f.asPointerTo(ityp).Elem().Set(v)
|
||||
|
||||
return b, nil
|
||||
return b, nerr.E
|
||||
}
|
||||
}
|
||||
|
||||
|
924
vendor/github.com/golang/protobuf/proto/test_proto/test.pb.go
generated
vendored
924
vendor/github.com/golang/protobuf/proto/test_proto/test.pb.go
generated
vendored
File diff suppressed because it is too large
Load Diff
8
vendor/github.com/golang/protobuf/proto/test_proto/test.proto
generated
vendored
8
vendor/github.com/golang/protobuf/proto/test_proto/test.proto
generated
vendored
@ -560,3 +560,11 @@ message Communique {
|
||||
Strings msg = 10;
|
||||
}
|
||||
}
|
||||
|
||||
message TestUTF8 {
|
||||
optional string scalar = 1;
|
||||
repeated string vector = 2;
|
||||
oneof oneof { string field = 3; }
|
||||
map<string, int64> map_key = 4;
|
||||
map<int64, string> map_value = 5;
|
||||
}
|
||||
|
4
vendor/github.com/golang/protobuf/proto/text.go
generated
vendored
4
vendor/github.com/golang/protobuf/proto/text.go
generated
vendored
@ -353,7 +353,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := tm.writeAny(w, key, props.mkeyprop); err != nil {
|
||||
if err := tm.writeAny(w, key, props.MapKeyProp); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := w.WriteByte('\n'); err != nil {
|
||||
@ -370,7 +370,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := tm.writeAny(w, val, props.mvalprop); err != nil {
|
||||
if err := tm.writeAny(w, val, props.MapValProp); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := w.WriteByte('\n'); err != nil {
|
||||
|
6
vendor/github.com/golang/protobuf/proto/text_parser.go
generated
vendored
6
vendor/github.com/golang/protobuf/proto/text_parser.go
generated
vendored
@ -630,17 +630,17 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error {
|
||||
if err := p.consumeToken(":"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.readAny(key, props.mkeyprop); err != nil {
|
||||
if err := p.readAny(key, props.MapKeyProp); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeOptionalSeparator(); err != nil {
|
||||
return err
|
||||
}
|
||||
case "value":
|
||||
if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil {
|
||||
if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.readAny(val, props.mvalprop); err != nil {
|
||||
if err := p.readAny(val, props.MapValProp); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.consumeOptionalSeparator(); err != nil {
|
||||
|
1554
vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go
generated
vendored
1554
vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go
generated
vendored
File diff suppressed because it is too large
Load Diff
17
vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go
generated
vendored
17
vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go
generated
vendored
@ -160,11 +160,13 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
|
||||
deprecated := service.GetOptions().GetDeprecated()
|
||||
|
||||
g.P()
|
||||
g.P("// Client API for ", servName, " service")
|
||||
g.P()
|
||||
g.P(fmt.Sprintf(`// %sClient is the client API for %s service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.`, servName, servName))
|
||||
|
||||
// Client interface.
|
||||
if deprecated {
|
||||
g.P("//")
|
||||
g.P(deprecationComment)
|
||||
}
|
||||
g.P("type ", servName, "Client interface {")
|
||||
@ -207,14 +209,13 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
|
||||
g.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr)
|
||||
}
|
||||
|
||||
g.P("// Server API for ", servName, " service")
|
||||
g.P()
|
||||
|
||||
// Server interface.
|
||||
serverType := servName + "Server"
|
||||
g.P("// ", serverType, " is the server API for ", servName, " service.")
|
||||
if deprecated {
|
||||
g.P("//")
|
||||
g.P(deprecationComment)
|
||||
}
|
||||
serverType := servName + "Server"
|
||||
g.P("type ", serverType, " interface {")
|
||||
for i, method := range service.Method {
|
||||
g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service.
|
||||
@ -307,7 +308,7 @@ func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar strin
|
||||
if !method.GetServerStreaming() && !method.GetClientStreaming() {
|
||||
g.P("out := new(", outType, ")")
|
||||
// TODO: Pass descExpr to Invoke.
|
||||
g.P("err := ", grpcPkg, `.Invoke(ctx, "`, sname, `", in, out, c.cc, opts...)`)
|
||||
g.P(`err := c.cc.Invoke(ctx, "`, sname, `", in, out, opts...)`)
|
||||
g.P("if err != nil { return nil, err }")
|
||||
g.P("return out, nil")
|
||||
g.P("}")
|
||||
@ -315,7 +316,7 @@ func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar strin
|
||||
return
|
||||
}
|
||||
streamType := unexport(servName) + methName + "Client"
|
||||
g.P("stream, err := ", grpcPkg, ".NewClientStream(ctx, ", descExpr, `, c.cc, "`, sname, `", opts...)`)
|
||||
g.P("stream, err := c.cc.NewStream(ctx, ", descExpr, `, "`, sname, `", opts...)`)
|
||||
g.P("if err != nil { return nil, err }")
|
||||
g.P("x := &", streamType, "{stream}")
|
||||
if !method.GetClientStreaming() {
|
||||
|
14
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.pb.go
generated
vendored
14
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/deprecated/deprecated.pb.go
generated
vendored
@ -84,7 +84,7 @@ var xxx_messageInfo_DeprecatedRequest proto.InternalMessageInfo
|
||||
// Deprecated: Do not use.
|
||||
type DeprecatedResponse struct {
|
||||
// DeprecatedField contains a DeprecatedEnum.
|
||||
DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use.
|
||||
DeprecatedField DeprecatedEnum `protobuf:"varint,1,opt,name=deprecated_field,json=deprecatedField,proto3,enum=deprecated.DeprecatedEnum" json:"deprecated_field,omitempty"` // Deprecated: Do not use.
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -136,8 +136,10 @@ var _ grpc.ClientConn
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for DeprecatedService service
|
||||
|
||||
// DeprecatedServiceClient is the client API for DeprecatedService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
//
|
||||
// Deprecated: Do not use.
|
||||
type DeprecatedServiceClient interface {
|
||||
// DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
|
||||
@ -156,15 +158,15 @@ func NewDeprecatedServiceClient(cc *grpc.ClientConn) DeprecatedServiceClient {
|
||||
// Deprecated: Do not use.
|
||||
func (c *deprecatedServiceClient) DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error) {
|
||||
out := new(DeprecatedResponse)
|
||||
err := grpc.Invoke(ctx, "/deprecated.DeprecatedService/DeprecatedCall", in, out, c.cc, opts...)
|
||||
err := c.cc.Invoke(ctx, "/deprecated.DeprecatedService/DeprecatedCall", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for DeprecatedService service
|
||||
|
||||
// DeprecatedServiceServer is the server API for DeprecatedService service.
|
||||
//
|
||||
// Deprecated: Do not use.
|
||||
type DeprecatedServiceServer interface {
|
||||
// DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
|
||||
|
16
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.pb.go
generated
vendored
16
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/grpc/grpc.pb.go
generated
vendored
@ -158,8 +158,9 @@ var _ grpc.ClientConn
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for Test service
|
||||
|
||||
// TestClient is the client API for Test service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type TestClient interface {
|
||||
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
|
||||
// This RPC streams from the server only.
|
||||
@ -180,7 +181,7 @@ func NewTestClient(cc *grpc.ClientConn) TestClient {
|
||||
|
||||
func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
||||
out := new(SimpleResponse)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, c.cc, opts...)
|
||||
err := c.cc.Invoke(ctx, "/grpc.testing.Test/UnaryCall", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -188,7 +189,7 @@ func (c *testClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...g
|
||||
}
|
||||
|
||||
func (c *testClient) Downstream(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (Test_DownstreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[0], c.cc, "/grpc.testing.Test/Downstream", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[0], "/grpc.testing.Test/Downstream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -220,7 +221,7 @@ func (x *testDownstreamClient) Recv() (*StreamMsg, error) {
|
||||
}
|
||||
|
||||
func (c *testClient) Upstream(ctx context.Context, opts ...grpc.CallOption) (Test_UpstreamClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[1], c.cc, "/grpc.testing.Test/Upstream", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[1], "/grpc.testing.Test/Upstream", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -254,7 +255,7 @@ func (x *testUpstreamClient) CloseAndRecv() (*SimpleResponse, error) {
|
||||
}
|
||||
|
||||
func (c *testClient) Bidi(ctx context.Context, opts ...grpc.CallOption) (Test_BidiClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_Test_serviceDesc.Streams[2], c.cc, "/grpc.testing.Test/Bidi", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_Test_serviceDesc.Streams[2], "/grpc.testing.Test/Bidi", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -284,8 +285,7 @@ func (x *testBidiClient) Recv() (*StreamMsg2, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for Test service
|
||||
|
||||
// TestServer is the server API for Test service.
|
||||
type TestServer interface {
|
||||
UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
|
||||
// This RPC streams from the server only.
|
||||
|
6
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.pb.go
generated
vendored
6
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/a.pb.go
generated
vendored
@ -33,9 +33,9 @@ const E_ZERO = E(sub.E_ZERO)
|
||||
// Ignoring public import of Local from import_public/b.proto
|
||||
|
||||
type Public struct {
|
||||
M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"`
|
||||
E sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"`
|
||||
Local *Local `protobuf:"bytes,3,opt,name=local" json:"local,omitempty"`
|
||||
M *sub.M `protobuf:"bytes,1,opt,name=m,proto3" json:"m,omitempty"`
|
||||
E sub.E `protobuf:"varint,2,opt,name=e,proto3,enum=goproto.test.import_public.sub.E" json:"e,omitempty"`
|
||||
Local *Local `protobuf:"bytes,3,opt,name=local,proto3" json:"local,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
4
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.pb.go
generated
vendored
4
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/b.pb.go
generated
vendored
@ -20,8 +20,8 @@ var _ = math.Inf
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Local struct {
|
||||
M *sub.M `protobuf:"bytes,1,opt,name=m" json:"m,omitempty"`
|
||||
E sub.E `protobuf:"varint,2,opt,name=e,enum=goproto.test.import_public.sub.E" json:"e,omitempty"`
|
||||
M *sub.M `protobuf:"bytes,1,opt,name=m,proto3" json:"m,omitempty"`
|
||||
E sub.E `protobuf:"varint,2,opt,name=e,proto3,enum=goproto.test.import_public.sub.E" json:"e,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
2
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.pb.go
generated
vendored
2
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/import_public/sub/a.pb.go
generated
vendored
@ -40,7 +40,7 @@ func (E) EnumDescriptor() ([]byte, []int) {
|
||||
|
||||
type M struct {
|
||||
// Field using a type in the same Go package, but a different source file.
|
||||
M2 *M2 `protobuf:"bytes,1,opt,name=m2" json:"m2,omitempty"`
|
||||
M2 *M2 `protobuf:"bytes,1,opt,name=m2,proto3" json:"m2,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
2
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
generated
vendored
2
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_a_1/m1.pb.go
generated
vendored
@ -69,7 +69,7 @@ func (m *M1) XXX_DiscardUnknown() {
|
||||
var xxx_messageInfo_M1 proto.InternalMessageInfo
|
||||
|
||||
type M1_1 struct {
|
||||
M1 *M1 `protobuf:"bytes,1,opt,name=m1" json:"m1,omitempty"`
|
||||
M1 *M1 `protobuf:"bytes,1,opt,name=m1,proto3" json:"m1,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
@ -20,7 +20,7 @@ var _ = math.Inf
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type A1M1 struct {
|
||||
F *test_a_1.M1 `protobuf:"bytes,1,opt,name=f" json:"f,omitempty"`
|
||||
F *test_a_1.M1 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
@ -20,7 +20,7 @@ var _ = math.Inf
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type A1M2 struct {
|
||||
F *test_a_1.M2 `protobuf:"bytes,1,opt,name=f" json:"f,omitempty"`
|
||||
F *test_a_1.M2 `protobuf:"bytes,1,opt,name=f,proto3" json:"f,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
14
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.pb.go
generated
vendored
14
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/imports/test_import_all.pb.go
generated
vendored
@ -23,13 +23,13 @@ var _ = math.Inf
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type All struct {
|
||||
Am1 *test_a_1.M1 `protobuf:"bytes,1,opt,name=am1" json:"am1,omitempty"`
|
||||
Am2 *test_a_1.M2 `protobuf:"bytes,2,opt,name=am2" json:"am2,omitempty"`
|
||||
Am3 *test_a_2.M3 `protobuf:"bytes,3,opt,name=am3" json:"am3,omitempty"`
|
||||
Am4 *test_a_2.M4 `protobuf:"bytes,4,opt,name=am4" json:"am4,omitempty"`
|
||||
Bm1 *test_b_1.M1 `protobuf:"bytes,5,opt,name=bm1" json:"bm1,omitempty"`
|
||||
Bm2 *test_b_1.M2 `protobuf:"bytes,6,opt,name=bm2" json:"bm2,omitempty"`
|
||||
Fmt *fmt1.M `protobuf:"bytes,7,opt,name=fmt" json:"fmt,omitempty"`
|
||||
Am1 *test_a_1.M1 `protobuf:"bytes,1,opt,name=am1,proto3" json:"am1,omitempty"`
|
||||
Am2 *test_a_1.M2 `protobuf:"bytes,2,opt,name=am2,proto3" json:"am2,omitempty"`
|
||||
Am3 *test_a_2.M3 `protobuf:"bytes,3,opt,name=am3,proto3" json:"am3,omitempty"`
|
||||
Am4 *test_a_2.M4 `protobuf:"bytes,4,opt,name=am4,proto3" json:"am4,omitempty"`
|
||||
Bm1 *test_b_1.M1 `protobuf:"bytes,5,opt,name=bm1,proto3" json:"bm1,omitempty"`
|
||||
Bm2 *test_b_1.M2 `protobuf:"bytes,6,opt,name=bm2,proto3" json:"bm2,omitempty"`
|
||||
Fmt *fmt1.M `protobuf:"bytes,7,opt,name=fmt,proto3" json:"fmt,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
32
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
generated
vendored
32
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/my_test/test.pb.go
generated
vendored
@ -669,6 +669,13 @@ func (m *Communique) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_Communique proto.InternalMessageInfo
|
||||
|
||||
func (m *Communique) GetMakeMeCry() bool {
|
||||
if m != nil && m.MakeMeCry != nil {
|
||||
return *m.MakeMeCry
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type isCommunique_Union interface {
|
||||
isCommunique_Union()
|
||||
}
|
||||
@ -676,43 +683,61 @@ type isCommunique_Union interface {
|
||||
type Communique_Number struct {
|
||||
Number int32 `protobuf:"varint,5,opt,name=number,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Name struct {
|
||||
Name string `protobuf:"bytes,6,opt,name=name,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Data struct {
|
||||
Data []byte `protobuf:"bytes,7,opt,name=data,oneof"`
|
||||
}
|
||||
|
||||
type Communique_TempC struct {
|
||||
TempC float64 `protobuf:"fixed64,8,opt,name=temp_c,json=tempC,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Height struct {
|
||||
Height float32 `protobuf:"fixed32,9,opt,name=height,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Today struct {
|
||||
Today Days `protobuf:"varint,10,opt,name=today,enum=my.test.Days,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Maybe struct {
|
||||
Maybe bool `protobuf:"varint,11,opt,name=maybe,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Delta_ struct {
|
||||
Delta int32 `protobuf:"zigzag32,12,opt,name=delta,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Msg struct {
|
||||
Msg *Reply `protobuf:"bytes,16,opt,name=msg,oneof"`
|
||||
}
|
||||
|
||||
type Communique_Somegroup struct {
|
||||
Somegroup *Communique_SomeGroup `protobuf:"group,14,opt,name=SomeGroup,json=somegroup,oneof"`
|
||||
}
|
||||
|
||||
func (*Communique_Number) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Name) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Data) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_TempC) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Height) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Today) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Maybe) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Delta_) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Msg) isCommunique_Union() {}
|
||||
|
||||
func (*Communique_Somegroup) isCommunique_Union() {}
|
||||
|
||||
func (m *Communique) GetUnion() isCommunique_Union {
|
||||
@ -722,13 +747,6 @@ func (m *Communique) GetUnion() isCommunique_Union {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Communique) GetMakeMeCry() bool {
|
||||
if m != nil && m.MakeMeCry != nil {
|
||||
return *m.MakeMeCry
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Communique) GetNumber() int32 {
|
||||
if x, ok := m.GetUnion().(*Communique_Number); ok {
|
||||
return x.Number
|
||||
|
12
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.pb.go
generated
vendored
12
vendor/github.com/golang/protobuf/protoc-gen-go/testdata/proto3/proto3.pb.go
generated
vendored
@ -48,11 +48,11 @@ func (Request_Flavour) EnumDescriptor() ([]byte, []int) {
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
Key []int64 `protobuf:"varint,2,rep,packed,name=key" json:"key,omitempty"`
|
||||
Taste Request_Flavour `protobuf:"varint,3,opt,name=taste,enum=proto3.Request_Flavour" json:"taste,omitempty"`
|
||||
Book *Book `protobuf:"bytes,4,opt,name=book" json:"book,omitempty"`
|
||||
Unpacked []int64 `protobuf:"varint,5,rep,name=unpacked" json:"unpacked,omitempty"`
|
||||
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Key []int64 `protobuf:"varint,2,rep,packed,name=key,proto3" json:"key,omitempty"`
|
||||
Taste Request_Flavour `protobuf:"varint,3,opt,name=taste,proto3,enum=proto3.Request_Flavour" json:"taste,omitempty"`
|
||||
Book *Book `protobuf:"bytes,4,opt,name=book,proto3" json:"book,omitempty"`
|
||||
Unpacked []int64 `protobuf:"varint,5,rep,name=unpacked,proto3" json:"unpacked,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -118,7 +118,7 @@ func (m *Request) GetUnpacked() []int64 {
|
||||
}
|
||||
|
||||
type Book struct {
|
||||
Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"`
|
||||
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
|
||||
RawData []byte `protobuf:"bytes,2,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
|
10
vendor/github.com/golang/protobuf/ptypes/any.go
generated
vendored
10
vendor/github.com/golang/protobuf/ptypes/any.go
generated
vendored
@ -130,10 +130,12 @@ func UnmarshalAny(any *any.Any, pb proto.Message) error {
|
||||
|
||||
// Is returns true if any value contains a given message type.
|
||||
func Is(any *any.Any, pb proto.Message) bool {
|
||||
aname, err := AnyMessageName(any)
|
||||
if err != nil {
|
||||
// The following is equivalent to AnyMessageName(any) == proto.MessageName(pb),
|
||||
// but it avoids scanning TypeUrl for the slash.
|
||||
if any == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return aname == proto.MessageName(pb)
|
||||
name := proto.MessageName(pb)
|
||||
prefix := len(any.TypeUrl) - len(name)
|
||||
return prefix >= 1 && any.TypeUrl[prefix-1] == '/' && any.TypeUrl[prefix:] == name
|
||||
}
|
||||
|
2
vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
generated
vendored
2
vendor/github.com/golang/protobuf/ptypes/any/any.pb.go
generated
vendored
@ -121,7 +121,7 @@ type Any struct {
|
||||
// Schemes other than `http`, `https` (or the empty scheme) might be
|
||||
// used with implementation specific semantics.
|
||||
//
|
||||
TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl" json:"type_url,omitempty"`
|
||||
TypeUrl string `protobuf:"bytes,1,opt,name=type_url,json=typeUrl,proto3" json:"type_url,omitempty"`
|
||||
// Must be a valid serialized protocol buffer of the above specified type.
|
||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
|
41
vendor/github.com/golang/protobuf/ptypes/any_test.go
generated
vendored
41
vendor/github.com/golang/protobuf/ptypes/any_test.go
generated
vendored
@ -60,8 +60,13 @@ func TestIs(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if Is(a, &pb.DescriptorProto{}) {
|
||||
// No spurious match for message names of different length.
|
||||
t.Error("FileDescriptorProto is not a DescriptorProto, but Is says it is")
|
||||
}
|
||||
if Is(a, &pb.EnumDescriptorProto{}) {
|
||||
// No spurious match for message names of equal length.
|
||||
t.Error("FileDescriptorProto is not an EnumDescriptorProto, but Is says it is")
|
||||
}
|
||||
if !Is(a, &pb.FileDescriptorProto{}) {
|
||||
t.Error("FileDescriptorProto is indeed a FileDescriptorProto, but Is says it is not")
|
||||
}
|
||||
@ -75,6 +80,21 @@ func TestIsDifferentUrlPrefixes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsCornerCases(t *testing.T) {
|
||||
m := &pb.FileDescriptorProto{}
|
||||
if Is(nil, m) {
|
||||
t.Errorf("message with nil type url incorrectly claimed to be %q", proto.MessageName(m))
|
||||
}
|
||||
noPrefix := &any.Any{TypeUrl: proto.MessageName(m)}
|
||||
if Is(noPrefix, m) {
|
||||
t.Errorf("message with type url %q incorrectly claimed to be %q", noPrefix.TypeUrl, proto.MessageName(m))
|
||||
}
|
||||
shortPrefix := &any.Any{TypeUrl: "/" + proto.MessageName(m)}
|
||||
if !Is(shortPrefix, m) {
|
||||
t.Errorf("message with type url %q didn't satisfy Is for type %q", shortPrefix.TypeUrl, proto.MessageName(m))
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalDynamic(t *testing.T) {
|
||||
want := &pb.FileDescriptorProto{Name: proto.String("foo")}
|
||||
a, err := MarshalAny(want)
|
||||
@ -111,3 +131,24 @@ func TestEmpty(t *testing.T) {
|
||||
t.Errorf("got no error for an attempt to create a message of type %q, which shouldn't be linked in", a.TypeUrl)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmptyCornerCases(t *testing.T) {
|
||||
_, err := Empty(nil)
|
||||
if err == nil {
|
||||
t.Error("expected Empty for nil to fail")
|
||||
}
|
||||
want := &pb.FileDescriptorProto{}
|
||||
noPrefix := &any.Any{TypeUrl: proto.MessageName(want)}
|
||||
_, err = Empty(noPrefix)
|
||||
if err == nil {
|
||||
t.Errorf("expected Empty for any type %q to fail", noPrefix.TypeUrl)
|
||||
}
|
||||
shortPrefix := &any.Any{TypeUrl: "/" + proto.MessageName(want)}
|
||||
got, err := Empty(shortPrefix)
|
||||
if err != nil {
|
||||
t.Errorf("Empty for any type %q failed: %s", shortPrefix.TypeUrl, err)
|
||||
}
|
||||
if !proto.Equal(got, want) {
|
||||
t.Errorf("Empty for any type %q differs, got %q, want %q", shortPrefix.TypeUrl, got, want)
|
||||
}
|
||||
}
|
||||
|
4
vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
generated
vendored
4
vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go
generated
vendored
@ -82,14 +82,14 @@ type Duration struct {
|
||||
// Signed seconds of the span of time. Must be from -315,576,000,000
|
||||
// to +315,576,000,000 inclusive. Note: these bounds are computed from:
|
||||
// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"`
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" 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"`
|
||||
Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
26
vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go
generated
vendored
26
vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go
generated
vendored
@ -54,7 +54,7 @@ func (NullValue) XXX_WellKnownType() string { return "NullValue" }
|
||||
// The JSON representation for `Struct` is JSON object.
|
||||
type Struct struct {
|
||||
// Unordered 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"`
|
||||
Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -144,29 +144,39 @@ type isValue_Kind interface {
|
||||
}
|
||||
|
||||
type Value_NullValue struct {
|
||||
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,enum=google.protobuf.NullValue,oneof"`
|
||||
NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"`
|
||||
}
|
||||
|
||||
type Value_NumberValue struct {
|
||||
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,oneof"`
|
||||
NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_StringValue struct {
|
||||
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,oneof"`
|
||||
StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_BoolValue struct {
|
||||
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,oneof"`
|
||||
BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_StructValue struct {
|
||||
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,oneof"`
|
||||
StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"`
|
||||
}
|
||||
|
||||
type Value_ListValue struct {
|
||||
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,oneof"`
|
||||
ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,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 {
|
||||
@ -358,7 +368,7 @@ func _Value_OneofSizer(msg proto.Message) (n int) {
|
||||
// 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"`
|
||||
Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
4
vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
generated
vendored
4
vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go
generated
vendored
@ -100,12 +100,12 @@ type Timestamp struct {
|
||||
// Represents seconds of UTC time since Unix epoch
|
||||
// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
|
||||
// 9999-12-31T23:59:59Z inclusive.
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"`
|
||||
Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" 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"`
|
||||
Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
16
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go
generated
vendored
16
vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go
generated
vendored
@ -23,7 +23,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
// 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"`
|
||||
Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -66,7 +66,7 @@ func (m *DoubleValue) GetValue() float64 {
|
||||
// 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"`
|
||||
Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -109,7 +109,7 @@ func (m *FloatValue) GetValue() float32 {
|
||||
// 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"`
|
||||
Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -152,7 +152,7 @@ func (m *Int64Value) GetValue() int64 {
|
||||
// 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"`
|
||||
Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -195,7 +195,7 @@ func (m *UInt64Value) GetValue() uint64 {
|
||||
// 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"`
|
||||
Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -238,7 +238,7 @@ func (m *Int32Value) GetValue() int32 {
|
||||
// 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"`
|
||||
Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -281,7 +281,7 @@ func (m *UInt32Value) GetValue() uint32 {
|
||||
// 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"`
|
||||
Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -324,7 +324,7 @@ func (m *BoolValue) GetValue() bool {
|
||||
// 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"`
|
||||
Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
|
9
vendor/github.com/google/uuid/.travis.yml
generated
vendored
Normal file
9
vendor/github.com/google/uuid/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.4.3
|
||||
- 1.5.3
|
||||
- tip
|
||||
|
||||
script:
|
||||
- go test -v ./...
|
10
vendor/github.com/google/uuid/CONTRIBUTING.md
generated
vendored
Normal file
10
vendor/github.com/google/uuid/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# How to contribute
|
||||
|
||||
We definitely welcome patches and contribution to this project!
|
||||
|
||||
### Legal requirements
|
||||
|
||||
In order to protect both you and ourselves, you will need to sign the
|
||||
[Contributor License Agreement](https://cla.developers.google.com/clas).
|
||||
|
||||
You may have already signed it for other Google projects.
|
9
vendor/github.com/google/uuid/CONTRIBUTORS
generated
vendored
Normal file
9
vendor/github.com/google/uuid/CONTRIBUTORS
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
Paul Borman <borman@google.com>
|
||||
bmatsuo
|
||||
shawnps
|
||||
theory
|
||||
jboverfelt
|
||||
dsymonds
|
||||
cd1
|
||||
wallclockbuilder
|
||||
dansouza
|
27
vendor/github.com/google/uuid/LICENSE
generated
vendored
Normal file
27
vendor/github.com/google/uuid/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2009,2014 Google Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
19
vendor/github.com/google/uuid/README.md
generated
vendored
Normal file
19
vendor/github.com/google/uuid/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# uuid ![build status](https://travis-ci.org/google/uuid.svg?branch=master)
|
||||
The uuid package generates and inspects UUIDs based on
|
||||
[RFC 4122](http://tools.ietf.org/html/rfc4122)
|
||||
and DCE 1.1: Authentication and Security Services.
|
||||
|
||||
This package is based on the github.com/pborman/uuid package (previously named
|
||||
code.google.com/p/go-uuid). It differs from these earlier packages in that
|
||||
a UUID is a 16 byte array rather than a byte slice. One loss due to this
|
||||
change is the ability to represent an invalid UUID (vs a NIL UUID).
|
||||
|
||||
###### Install
|
||||
`go get github.com/google/uuid`
|
||||
|
||||
###### Documentation
|
||||
[![GoDoc](https://godoc.org/github.com/google/uuid?status.svg)](http://godoc.org/github.com/google/uuid)
|
||||
|
||||
Full `go doc` style documentation for the package can be viewed online without
|
||||
installing this package by using the GoDoc site here:
|
||||
http://godoc.org/github.com/google/uuid
|
80
vendor/github.com/google/uuid/dce.go
generated
vendored
Normal file
80
vendor/github.com/google/uuid/dce.go
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
// A Domain represents a Version 2 domain
|
||||
type Domain byte
|
||||
|
||||
// Domain constants for DCE Security (Version 2) UUIDs.
|
||||
const (
|
||||
Person = Domain(0)
|
||||
Group = Domain(1)
|
||||
Org = Domain(2)
|
||||
)
|
||||
|
||||
// NewDCESecurity returns a DCE Security (Version 2) UUID.
|
||||
//
|
||||
// The domain should be one of Person, Group or Org.
|
||||
// On a POSIX system the id should be the users UID for the Person
|
||||
// domain and the users GID for the Group. The meaning of id for
|
||||
// the domain Org or on non-POSIX systems is site defined.
|
||||
//
|
||||
// For a given domain/id pair the same token may be returned for up to
|
||||
// 7 minutes and 10 seconds.
|
||||
func NewDCESecurity(domain Domain, id uint32) (UUID, error) {
|
||||
uuid, err := NewUUID()
|
||||
if err == nil {
|
||||
uuid[6] = (uuid[6] & 0x0f) | 0x20 // Version 2
|
||||
uuid[9] = byte(domain)
|
||||
binary.BigEndian.PutUint32(uuid[0:], id)
|
||||
}
|
||||
return uuid, err
|
||||
}
|
||||
|
||||
// NewDCEPerson returns a DCE Security (Version 2) UUID in the person
|
||||
// domain with the id returned by os.Getuid.
|
||||
//
|
||||
// NewDCESecurity(Person, uint32(os.Getuid()))
|
||||
func NewDCEPerson() (UUID, error) {
|
||||
return NewDCESecurity(Person, uint32(os.Getuid()))
|
||||
}
|
||||
|
||||
// NewDCEGroup returns a DCE Security (Version 2) UUID in the group
|
||||
// domain with the id returned by os.Getgid.
|
||||
//
|
||||
// NewDCESecurity(Group, uint32(os.Getgid()))
|
||||
func NewDCEGroup() (UUID, error) {
|
||||
return NewDCESecurity(Group, uint32(os.Getgid()))
|
||||
}
|
||||
|
||||
// Domain returns the domain for a Version 2 UUID. Domains are only defined
|
||||
// for Version 2 UUIDs.
|
||||
func (uuid UUID) Domain() Domain {
|
||||
return Domain(uuid[9])
|
||||
}
|
||||
|
||||
// ID returns the id for a Version 2 UUID. IDs are only defined for Version 2
|
||||
// UUIDs.
|
||||
func (uuid UUID) ID() uint32 {
|
||||
return binary.BigEndian.Uint32(uuid[0:4])
|
||||
}
|
||||
|
||||
func (d Domain) String() string {
|
||||
switch d {
|
||||
case Person:
|
||||
return "Person"
|
||||
case Group:
|
||||
return "Group"
|
||||
case Org:
|
||||
return "Org"
|
||||
}
|
||||
return fmt.Sprintf("Domain%d", int(d))
|
||||
}
|
12
vendor/github.com/google/uuid/doc.go
generated
vendored
Normal file
12
vendor/github.com/google/uuid/doc.go
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package uuid generates and inspects UUIDs.
|
||||
//
|
||||
// UUIDs are based on RFC 4122 and DCE 1.1: Authentication and Security
|
||||
// Services.
|
||||
//
|
||||
// A UUID is a 16 byte (128 bit) array. UUIDs may be used as keys to
|
||||
// maps or compared directly.
|
||||
package uuid
|
1
vendor/github.com/google/uuid/go.mod
generated
vendored
Normal file
1
vendor/github.com/google/uuid/go.mod
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
module github.com/google/uuid
|
53
vendor/github.com/google/uuid/hash.go
generated
vendored
Normal file
53
vendor/github.com/google/uuid/hash.go
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"crypto/sha1"
|
||||
"hash"
|
||||
)
|
||||
|
||||
// Well known namespace IDs and UUIDs
|
||||
var (
|
||||
NameSpaceDNS = Must(Parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
|
||||
NameSpaceURL = Must(Parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8"))
|
||||
NameSpaceOID = Must(Parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
|
||||
NameSpaceX500 = Must(Parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
|
||||
Nil UUID // empty UUID, all zeros
|
||||
)
|
||||
|
||||
// NewHash returns a new UUID derived from the hash of space concatenated with
|
||||
// data generated by h. The hash should be at least 16 byte in length. The
|
||||
// first 16 bytes of the hash are used to form the UUID. The version of the
|
||||
// UUID will be the lower 4 bits of version. NewHash is used to implement
|
||||
// NewMD5 and NewSHA1.
|
||||
func NewHash(h hash.Hash, space UUID, data []byte, version int) UUID {
|
||||
h.Reset()
|
||||
h.Write(space[:])
|
||||
h.Write(data)
|
||||
s := h.Sum(nil)
|
||||
var uuid UUID
|
||||
copy(uuid[:], s)
|
||||
uuid[6] = (uuid[6] & 0x0f) | uint8((version&0xf)<<4)
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80 // RFC 4122 variant
|
||||
return uuid
|
||||
}
|
||||
|
||||
// NewMD5 returns a new MD5 (Version 3) UUID based on the
|
||||
// supplied name space and data. It is the same as calling:
|
||||
//
|
||||
// NewHash(md5.New(), space, data, 3)
|
||||
func NewMD5(space UUID, data []byte) UUID {
|
||||
return NewHash(md5.New(), space, data, 3)
|
||||
}
|
||||
|
||||
// NewSHA1 returns a new SHA1 (Version 5) UUID based on the
|
||||
// supplied name space and data. It is the same as calling:
|
||||
//
|
||||
// NewHash(sha1.New(), space, data, 5)
|
||||
func NewSHA1(space UUID, data []byte) UUID {
|
||||
return NewHash(sha1.New(), space, data, 5)
|
||||
}
|
62
vendor/github.com/google/uuid/json_test.go
generated
vendored
Normal file
62
vendor/github.com/google/uuid/json_test.go
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var testUUID = Must(Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479"))
|
||||
|
||||
func TestJSON(t *testing.T) {
|
||||
type S struct {
|
||||
ID1 UUID
|
||||
ID2 UUID
|
||||
}
|
||||
s1 := S{ID1: testUUID}
|
||||
data, err := json.Marshal(&s1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var s2 S
|
||||
if err := json.Unmarshal(data, &s2); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(&s1, &s2) {
|
||||
t.Errorf("got %#v, want %#v", s2, s1)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_MarshalJSON(b *testing.B) {
|
||||
x := &struct {
|
||||
UUID UUID `json:"uuid"`
|
||||
}{}
|
||||
var err error
|
||||
x.UUID, err = Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
js, err := json.Marshal(x)
|
||||
if err != nil {
|
||||
b.Fatalf("marshal json: %#v (%v)", js, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_UnmarshalJSON(b *testing.B) {
|
||||
js := []byte(`{"uuid":"f47ac10b-58cc-0372-8567-0e02b2c3d479"}`)
|
||||
var x *struct {
|
||||
UUID UUID `json:"uuid"`
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
err := json.Unmarshal(js, &x)
|
||||
if err != nil {
|
||||
b.Fatalf("marshal json: %#v (%v)", js, err)
|
||||
}
|
||||
}
|
||||
}
|
37
vendor/github.com/google/uuid/marshal.go
generated
vendored
Normal file
37
vendor/github.com/google/uuid/marshal.go
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import "fmt"
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (uuid UUID) MarshalText() ([]byte, error) {
|
||||
var js [36]byte
|
||||
encodeHex(js[:], uuid)
|
||||
return js[:], nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (uuid *UUID) UnmarshalText(data []byte) error {
|
||||
id, err := ParseBytes(data)
|
||||
if err == nil {
|
||||
*uuid = id
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// MarshalBinary implements encoding.BinaryMarshaler.
|
||||
func (uuid UUID) MarshalBinary() ([]byte, error) {
|
||||
return uuid[:], nil
|
||||
}
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler.
|
||||
func (uuid *UUID) UnmarshalBinary(data []byte) error {
|
||||
if len(data) != 16 {
|
||||
return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
|
||||
}
|
||||
copy(uuid[:], data)
|
||||
return nil
|
||||
}
|
89
vendor/github.com/google/uuid/node.go
generated
vendored
Normal file
89
vendor/github.com/google/uuid/node.go
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
nodeMu sync.Mutex
|
||||
ifname string // name of interface being used
|
||||
nodeID [6]byte // hardware for version 1 UUIDs
|
||||
zeroID [6]byte // nodeID with only 0's
|
||||
)
|
||||
|
||||
// NodeInterface returns the name of the interface from which the NodeID was
|
||||
// derived. The interface "user" is returned if the NodeID was set by
|
||||
// SetNodeID.
|
||||
func NodeInterface() string {
|
||||
defer nodeMu.Unlock()
|
||||
nodeMu.Lock()
|
||||
return ifname
|
||||
}
|
||||
|
||||
// SetNodeInterface selects the hardware address to be used for Version 1 UUIDs.
|
||||
// If name is "" then the first usable interface found will be used or a random
|
||||
// Node ID will be generated. If a named interface cannot be found then false
|
||||
// is returned.
|
||||
//
|
||||
// SetNodeInterface never fails when name is "".
|
||||
func SetNodeInterface(name string) bool {
|
||||
defer nodeMu.Unlock()
|
||||
nodeMu.Lock()
|
||||
return setNodeInterface(name)
|
||||
}
|
||||
|
||||
func setNodeInterface(name string) bool {
|
||||
iname, addr := getHardwareInterface(name) // null implementation for js
|
||||
if iname != "" && addr != nil {
|
||||
ifname = iname
|
||||
copy(nodeID[:], addr)
|
||||
return true
|
||||
}
|
||||
|
||||
// We found no interfaces with a valid hardware address. If name
|
||||
// does not specify a specific interface generate a random Node ID
|
||||
// (section 4.1.6)
|
||||
if name == "" {
|
||||
randomBits(nodeID[:])
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// NodeID returns a slice of a copy of the current Node ID, setting the Node ID
|
||||
// if not already set.
|
||||
func NodeID() []byte {
|
||||
defer nodeMu.Unlock()
|
||||
nodeMu.Lock()
|
||||
if nodeID == zeroID {
|
||||
setNodeInterface("")
|
||||
}
|
||||
nid := nodeID
|
||||
return nid[:]
|
||||
}
|
||||
|
||||
// SetNodeID sets the Node ID to be used for Version 1 UUIDs. The first 6 bytes
|
||||
// of id are used. If id is less than 6 bytes then false is returned and the
|
||||
// Node ID is not set.
|
||||
func SetNodeID(id []byte) bool {
|
||||
if len(id) < 6 {
|
||||
return false
|
||||
}
|
||||
defer nodeMu.Unlock()
|
||||
nodeMu.Lock()
|
||||
copy(nodeID[:], id)
|
||||
ifname = "user"
|
||||
return true
|
||||
}
|
||||
|
||||
// NodeID returns the 6 byte node id encoded in uuid. It returns nil if uuid is
|
||||
// not valid. The NodeID is only well defined for version 1 and 2 UUIDs.
|
||||
func (uuid UUID) NodeID() []byte {
|
||||
var node [6]byte
|
||||
copy(node[:], uuid[10:])
|
||||
return node[:]
|
||||
}
|
12
vendor/github.com/google/uuid/node_js.go
generated
vendored
Normal file
12
vendor/github.com/google/uuid/node_js.go
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build js
|
||||
|
||||
package uuid
|
||||
|
||||
// getHardwareInterface returns nil values for the JS version of the code.
|
||||
// This remvoves the "net" dependency, because it is not used in the browser.
|
||||
// Using the "net" library inflates the size of the transpiled JS code by 673k bytes.
|
||||
func getHardwareInterface(name string) (string, []byte) { return "", nil }
|
33
vendor/github.com/google/uuid/node_net.go
generated
vendored
Normal file
33
vendor/github.com/google/uuid/node_net.go
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !js
|
||||
|
||||
package uuid
|
||||
|
||||
import "net"
|
||||
|
||||
var interfaces []net.Interface // cached list of interfaces
|
||||
|
||||
// getHardwareInterface returns the name and hardware address of interface name.
|
||||
// If name is "" then the name and hardware address of one of the system's
|
||||
// interfaces is returned. If no interfaces are found (name does not exist or
|
||||
// there are no interfaces) then "", nil is returned.
|
||||
//
|
||||
// Only addresses of at least 6 bytes are returned.
|
||||
func getHardwareInterface(name string) (string, []byte) {
|
||||
if interfaces == nil {
|
||||
var err error
|
||||
interfaces, err = net.Interfaces()
|
||||
if err != nil {
|
||||
return "", nil
|
||||
}
|
||||
}
|
||||
for _, ifs := range interfaces {
|
||||
if len(ifs.HardwareAddr) >= 6 && (name == "" || name == ifs.Name) {
|
||||
return ifs.Name, ifs.HardwareAddr
|
||||
}
|
||||
}
|
||||
return "", nil
|
||||
}
|
66
vendor/github.com/google/uuid/seq_test.go
generated
vendored
Normal file
66
vendor/github.com/google/uuid/seq_test.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// This test is only run when --regressions is passed on the go test line.
|
||||
var regressions = flag.Bool("regressions", false, "run uuid regression tests")
|
||||
|
||||
// TestClockSeqRace tests for a particular race condition of returning two
|
||||
// identical Version1 UUIDs. The duration of 1 minute was chosen as the race
|
||||
// condition, before being fixed, nearly always occurred in under 30 seconds.
|
||||
func TestClockSeqRace(t *testing.T) {
|
||||
if !*regressions {
|
||||
t.Skip("skipping regression tests")
|
||||
}
|
||||
duration := time.Minute
|
||||
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
|
||||
ch := make(chan UUID, 10000)
|
||||
ncpu := runtime.NumCPU()
|
||||
switch ncpu {
|
||||
case 0, 1:
|
||||
// We can't run the test effectively.
|
||||
t.Skip("skipping race test, only one CPU detected")
|
||||
return
|
||||
default:
|
||||
runtime.GOMAXPROCS(ncpu)
|
||||
}
|
||||
for i := 0; i < ncpu; i++ {
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-done:
|
||||
return
|
||||
case ch <- Must(NewUUID()):
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
uuids := make(map[string]bool)
|
||||
cnt := 0
|
||||
start := time.Now()
|
||||
for u := range ch {
|
||||
s := u.String()
|
||||
if uuids[s] {
|
||||
t.Errorf("duplicate uuid after %d in %v: %s", cnt, time.Since(start), s)
|
||||
return
|
||||
}
|
||||
uuids[s] = true
|
||||
if time.Since(start) > duration {
|
||||
return
|
||||
}
|
||||
cnt++
|
||||
}
|
||||
}
|
59
vendor/github.com/google/uuid/sql.go
generated
vendored
Normal file
59
vendor/github.com/google/uuid/sql.go
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Scan implements sql.Scanner so UUIDs can be read from databases transparently
|
||||
// Currently, database types that map to string and []byte are supported. Please
|
||||
// consult database-specific driver documentation for matching types.
|
||||
func (uuid *UUID) Scan(src interface{}) error {
|
||||
switch src := src.(type) {
|
||||
case nil:
|
||||
return nil
|
||||
|
||||
case string:
|
||||
// if an empty UUID comes from a table, we return a null UUID
|
||||
if src == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// see Parse for required string format
|
||||
u, err := Parse(src)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Scan: %v", err)
|
||||
}
|
||||
|
||||
*uuid = u
|
||||
|
||||
case []byte:
|
||||
// if an empty UUID comes from a table, we return a null UUID
|
||||
if len(src) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// assumes a simple slice of bytes if 16 bytes
|
||||
// otherwise attempts to parse
|
||||
if len(src) != 16 {
|
||||
return uuid.Scan(string(src))
|
||||
}
|
||||
copy((*uuid)[:], src)
|
||||
|
||||
default:
|
||||
return fmt.Errorf("Scan: unable to scan type %T into UUID", src)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value implements sql.Valuer so that UUIDs can be written to databases
|
||||
// transparently. Currently, UUIDs map to strings. Please consult
|
||||
// database-specific driver documentation for matching types.
|
||||
func (uuid UUID) Value() (driver.Value, error) {
|
||||
return uuid.String(), nil
|
||||
}
|
113
vendor/github.com/google/uuid/sql_test.go
generated
vendored
Normal file
113
vendor/github.com/google/uuid/sql_test.go
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestScan(t *testing.T) {
|
||||
stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
||||
badTypeTest := 6
|
||||
invalidTest := "f47ac10b-58cc-0372-8567-0e02b2c3d4"
|
||||
|
||||
byteTest := make([]byte, 16)
|
||||
byteTestUUID := Must(Parse(stringTest))
|
||||
copy(byteTest, byteTestUUID[:])
|
||||
|
||||
// sunny day tests
|
||||
|
||||
var uuid UUID
|
||||
err := (&uuid).Scan(stringTest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = (&uuid).Scan([]byte(stringTest))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = (&uuid).Scan(byteTest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// bad type tests
|
||||
|
||||
err = (&uuid).Scan(badTypeTest)
|
||||
if err == nil {
|
||||
t.Error("int correctly parsed and shouldn't have")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "unable to scan type") {
|
||||
t.Error("attempting to parse an int returned an incorrect error message")
|
||||
}
|
||||
|
||||
// invalid/incomplete uuids
|
||||
|
||||
err = (&uuid).Scan(invalidTest)
|
||||
if err == nil {
|
||||
t.Error("invalid uuid was parsed without error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "invalid UUID") {
|
||||
t.Error("attempting to parse an invalid UUID returned an incorrect error message")
|
||||
}
|
||||
|
||||
err = (&uuid).Scan(byteTest[:len(byteTest)-2])
|
||||
if err == nil {
|
||||
t.Error("invalid byte uuid was parsed without error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "invalid UUID") {
|
||||
t.Error("attempting to parse an invalid byte UUID returned an incorrect error message")
|
||||
}
|
||||
|
||||
// empty tests
|
||||
|
||||
uuid = UUID{}
|
||||
var emptySlice []byte
|
||||
err = (&uuid).Scan(emptySlice)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
for _, v := range uuid {
|
||||
if v != 0 {
|
||||
t.Error("UUID was not nil after scanning empty byte slice")
|
||||
}
|
||||
}
|
||||
|
||||
uuid = UUID{}
|
||||
var emptyString string
|
||||
err = (&uuid).Scan(emptyString)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range uuid {
|
||||
if v != 0 {
|
||||
t.Error("UUID was not nil after scanning empty byte slice")
|
||||
}
|
||||
}
|
||||
|
||||
uuid = UUID{}
|
||||
err = (&uuid).Scan(nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, v := range uuid {
|
||||
if v != 0 {
|
||||
t.Error("UUID was not nil after scanning nil")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValue(t *testing.T) {
|
||||
stringTest := "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
||||
uuid := Must(Parse(stringTest))
|
||||
val, _ := uuid.Value()
|
||||
if val != stringTest {
|
||||
t.Error("Value() did not return expected string")
|
||||
}
|
||||
}
|
123
vendor/github.com/google/uuid/time.go
generated
vendored
Normal file
123
vendor/github.com/google/uuid/time.go
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A Time represents a time as the number of 100's of nanoseconds since 15 Oct
|
||||
// 1582.
|
||||
type Time int64
|
||||
|
||||
const (
|
||||
lillian = 2299160 // Julian day of 15 Oct 1582
|
||||
unix = 2440587 // Julian day of 1 Jan 1970
|
||||
epoch = unix - lillian // Days between epochs
|
||||
g1582 = epoch * 86400 // seconds between epochs
|
||||
g1582ns100 = g1582 * 10000000 // 100s of a nanoseconds between epochs
|
||||
)
|
||||
|
||||
var (
|
||||
timeMu sync.Mutex
|
||||
lasttime uint64 // last time we returned
|
||||
clockSeq uint16 // clock sequence for this run
|
||||
|
||||
timeNow = time.Now // for testing
|
||||
)
|
||||
|
||||
// UnixTime converts t the number of seconds and nanoseconds using the Unix
|
||||
// epoch of 1 Jan 1970.
|
||||
func (t Time) UnixTime() (sec, nsec int64) {
|
||||
sec = int64(t - g1582ns100)
|
||||
nsec = (sec % 10000000) * 100
|
||||
sec /= 10000000
|
||||
return sec, nsec
|
||||
}
|
||||
|
||||
// GetTime returns the current Time (100s of nanoseconds since 15 Oct 1582) and
|
||||
// clock sequence as well as adjusting the clock sequence as needed. An error
|
||||
// is returned if the current time cannot be determined.
|
||||
func GetTime() (Time, uint16, error) {
|
||||
defer timeMu.Unlock()
|
||||
timeMu.Lock()
|
||||
return getTime()
|
||||
}
|
||||
|
||||
func getTime() (Time, uint16, error) {
|
||||
t := timeNow()
|
||||
|
||||
// If we don't have a clock sequence already, set one.
|
||||
if clockSeq == 0 {
|
||||
setClockSequence(-1)
|
||||
}
|
||||
now := uint64(t.UnixNano()/100) + g1582ns100
|
||||
|
||||
// If time has gone backwards with this clock sequence then we
|
||||
// increment the clock sequence
|
||||
if now <= lasttime {
|
||||
clockSeq = ((clockSeq + 1) & 0x3fff) | 0x8000
|
||||
}
|
||||
lasttime = now
|
||||
return Time(now), clockSeq, nil
|
||||
}
|
||||
|
||||
// ClockSequence returns the current clock sequence, generating one if not
|
||||
// already set. The clock sequence is only used for Version 1 UUIDs.
|
||||
//
|
||||
// The uuid package does not use global static storage for the clock sequence or
|
||||
// the last time a UUID was generated. Unless SetClockSequence is used, a new
|
||||
// random clock sequence is generated the first time a clock sequence is
|
||||
// requested by ClockSequence, GetTime, or NewUUID. (section 4.2.1.1)
|
||||
func ClockSequence() int {
|
||||
defer timeMu.Unlock()
|
||||
timeMu.Lock()
|
||||
return clockSequence()
|
||||
}
|
||||
|
||||
func clockSequence() int {
|
||||
if clockSeq == 0 {
|
||||
setClockSequence(-1)
|
||||
}
|
||||
return int(clockSeq & 0x3fff)
|
||||
}
|
||||
|
||||
// SetClockSequence sets the clock sequence to the lower 14 bits of seq. Setting to
|
||||
// -1 causes a new sequence to be generated.
|
||||
func SetClockSequence(seq int) {
|
||||
defer timeMu.Unlock()
|
||||
timeMu.Lock()
|
||||
setClockSequence(seq)
|
||||
}
|
||||
|
||||
func setClockSequence(seq int) {
|
||||
if seq == -1 {
|
||||
var b [2]byte
|
||||
randomBits(b[:]) // clock sequence
|
||||
seq = int(b[0])<<8 | int(b[1])
|
||||
}
|
||||
oldSeq := clockSeq
|
||||
clockSeq = uint16(seq&0x3fff) | 0x8000 // Set our variant
|
||||
if oldSeq != clockSeq {
|
||||
lasttime = 0
|
||||
}
|
||||
}
|
||||
|
||||
// Time returns the time in 100s of nanoseconds since 15 Oct 1582 encoded in
|
||||
// uuid. The time is only defined for version 1 and 2 UUIDs.
|
||||
func (uuid UUID) Time() Time {
|
||||
time := int64(binary.BigEndian.Uint32(uuid[0:4]))
|
||||
time |= int64(binary.BigEndian.Uint16(uuid[4:6])) << 32
|
||||
time |= int64(binary.BigEndian.Uint16(uuid[6:8])&0xfff) << 48
|
||||
return Time(time)
|
||||
}
|
||||
|
||||
// ClockSequence returns the clock sequence encoded in uuid.
|
||||
// The clock sequence is only well defined for version 1 and 2 UUIDs.
|
||||
func (uuid UUID) ClockSequence() int {
|
||||
return int(binary.BigEndian.Uint16(uuid[8:10])) & 0x3fff
|
||||
}
|
43
vendor/github.com/google/uuid/util.go
generated
vendored
Normal file
43
vendor/github.com/google/uuid/util.go
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// randomBits completely fills slice b with random data.
|
||||
func randomBits(b []byte) {
|
||||
if _, err := io.ReadFull(rander, b); err != nil {
|
||||
panic(err.Error()) // rand should never fail
|
||||
}
|
||||
}
|
||||
|
||||
// xvalues returns the value of a byte as a hexadecimal digit or 255.
|
||||
var xvalues = [256]byte{
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255,
|
||||
255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
}
|
||||
|
||||
// xtob converts hex characters x1 and x2 into a byte.
|
||||
func xtob(x1, x2 byte) (byte, bool) {
|
||||
b1 := xvalues[x1]
|
||||
b2 := xvalues[x2]
|
||||
return (b1 << 4) | b2, b1 != 255 && b2 != 255
|
||||
}
|
245
vendor/github.com/google/uuid/uuid.go
generated
vendored
Normal file
245
vendor/github.com/google/uuid/uuid.go
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
// Copyright 2018 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// A UUID is a 128 bit (16 byte) Universal Unique IDentifier as defined in RFC
|
||||
// 4122.
|
||||
type UUID [16]byte
|
||||
|
||||
// A Version represents a UUID's version.
|
||||
type Version byte
|
||||
|
||||
// A Variant represents a UUID's variant.
|
||||
type Variant byte
|
||||
|
||||
// Constants returned by Variant.
|
||||
const (
|
||||
Invalid = Variant(iota) // Invalid UUID
|
||||
RFC4122 // The variant specified in RFC4122
|
||||
Reserved // Reserved, NCS backward compatibility.
|
||||
Microsoft // Reserved, Microsoft Corporation backward compatibility.
|
||||
Future // Reserved for future definition.
|
||||
)
|
||||
|
||||
var rander = rand.Reader // random function
|
||||
|
||||
// Parse decodes s into a UUID or returns an error. Both the standard UUID
|
||||
// forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and
|
||||
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the
|
||||
// Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex
|
||||
// encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
|
||||
func Parse(s string) (UUID, error) {
|
||||
var uuid UUID
|
||||
switch len(s) {
|
||||
// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
case 36:
|
||||
|
||||
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
case 36 + 9:
|
||||
if strings.ToLower(s[:9]) != "urn:uuid:" {
|
||||
return uuid, fmt.Errorf("invalid urn prefix: %q", s[:9])
|
||||
}
|
||||
s = s[9:]
|
||||
|
||||
// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
||||
case 36 + 2:
|
||||
s = s[1:]
|
||||
|
||||
// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
case 32:
|
||||
var ok bool
|
||||
for i := range uuid {
|
||||
uuid[i], ok = xtob(s[i*2], s[i*2+1])
|
||||
if !ok {
|
||||
return uuid, errors.New("invalid UUID format")
|
||||
}
|
||||
}
|
||||
return uuid, nil
|
||||
default:
|
||||
return uuid, fmt.Errorf("invalid UUID length: %d", len(s))
|
||||
}
|
||||
// s is now at least 36 bytes long
|
||||
// it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' {
|
||||
return uuid, errors.New("invalid UUID format")
|
||||
}
|
||||
for i, x := range [16]int{
|
||||
0, 2, 4, 6,
|
||||
9, 11,
|
||||
14, 16,
|
||||
19, 21,
|
||||
24, 26, 28, 30, 32, 34} {
|
||||
v, ok := xtob(s[x], s[x+1])
|
||||
if !ok {
|
||||
return uuid, errors.New("invalid UUID format")
|
||||
}
|
||||
uuid[i] = v
|
||||
}
|
||||
return uuid, nil
|
||||
}
|
||||
|
||||
// ParseBytes is like Parse, except it parses a byte slice instead of a string.
|
||||
func ParseBytes(b []byte) (UUID, error) {
|
||||
var uuid UUID
|
||||
switch len(b) {
|
||||
case 36: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
case 36 + 9: // urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
if !bytes.Equal(bytes.ToLower(b[:9]), []byte("urn:uuid:")) {
|
||||
return uuid, fmt.Errorf("invalid urn prefix: %q", b[:9])
|
||||
}
|
||||
b = b[9:]
|
||||
case 36 + 2: // {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
||||
b = b[1:]
|
||||
case 32: // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
var ok bool
|
||||
for i := 0; i < 32; i += 2 {
|
||||
uuid[i/2], ok = xtob(b[i], b[i+1])
|
||||
if !ok {
|
||||
return uuid, errors.New("invalid UUID format")
|
||||
}
|
||||
}
|
||||
return uuid, nil
|
||||
default:
|
||||
return uuid, fmt.Errorf("invalid UUID length: %d", len(b))
|
||||
}
|
||||
// s is now at least 36 bytes long
|
||||
// it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' {
|
||||
return uuid, errors.New("invalid UUID format")
|
||||
}
|
||||
for i, x := range [16]int{
|
||||
0, 2, 4, 6,
|
||||
9, 11,
|
||||
14, 16,
|
||||
19, 21,
|
||||
24, 26, 28, 30, 32, 34} {
|
||||
v, ok := xtob(b[x], b[x+1])
|
||||
if !ok {
|
||||
return uuid, errors.New("invalid UUID format")
|
||||
}
|
||||
uuid[i] = v
|
||||
}
|
||||
return uuid, nil
|
||||
}
|
||||
|
||||
// MustParse is like Parse but panics if the string cannot be parsed.
|
||||
// It simplifies safe initialization of global variables holding compiled UUIDs.
|
||||
func MustParse(s string) UUID {
|
||||
uuid, err := Parse(s)
|
||||
if err != nil {
|
||||
panic(`uuid: Parse(` + s + `): ` + err.Error())
|
||||
}
|
||||
return uuid
|
||||
}
|
||||
|
||||
// FromBytes creates a new UUID from a byte slice. Returns an error if the slice
|
||||
// does not have a length of 16. The bytes are copied from the slice.
|
||||
func FromBytes(b []byte) (uuid UUID, err error) {
|
||||
err = uuid.UnmarshalBinary(b)
|
||||
return uuid, err
|
||||
}
|
||||
|
||||
// Must returns uuid if err is nil and panics otherwise.
|
||||
func Must(uuid UUID, err error) UUID {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return uuid
|
||||
}
|
||||
|
||||
// String returns the string form of uuid, xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
// , or "" if uuid is invalid.
|
||||
func (uuid UUID) String() string {
|
||||
var buf [36]byte
|
||||
encodeHex(buf[:], uuid)
|
||||
return string(buf[:])
|
||||
}
|
||||
|
||||
// URN returns the RFC 2141 URN form of uuid,
|
||||
// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, or "" if uuid is invalid.
|
||||
func (uuid UUID) URN() string {
|
||||
var buf [36 + 9]byte
|
||||
copy(buf[:], "urn:uuid:")
|
||||
encodeHex(buf[9:], uuid)
|
||||
return string(buf[:])
|
||||
}
|
||||
|
||||
func encodeHex(dst []byte, uuid UUID) {
|
||||
hex.Encode(dst, uuid[:4])
|
||||
dst[8] = '-'
|
||||
hex.Encode(dst[9:13], uuid[4:6])
|
||||
dst[13] = '-'
|
||||
hex.Encode(dst[14:18], uuid[6:8])
|
||||
dst[18] = '-'
|
||||
hex.Encode(dst[19:23], uuid[8:10])
|
||||
dst[23] = '-'
|
||||
hex.Encode(dst[24:], uuid[10:])
|
||||
}
|
||||
|
||||
// Variant returns the variant encoded in uuid.
|
||||
func (uuid UUID) Variant() Variant {
|
||||
switch {
|
||||
case (uuid[8] & 0xc0) == 0x80:
|
||||
return RFC4122
|
||||
case (uuid[8] & 0xe0) == 0xc0:
|
||||
return Microsoft
|
||||
case (uuid[8] & 0xe0) == 0xe0:
|
||||
return Future
|
||||
default:
|
||||
return Reserved
|
||||
}
|
||||
}
|
||||
|
||||
// Version returns the version of uuid.
|
||||
func (uuid UUID) Version() Version {
|
||||
return Version(uuid[6] >> 4)
|
||||
}
|
||||
|
||||
func (v Version) String() string {
|
||||
if v > 15 {
|
||||
return fmt.Sprintf("BAD_VERSION_%d", v)
|
||||
}
|
||||
return fmt.Sprintf("VERSION_%d", v)
|
||||
}
|
||||
|
||||
func (v Variant) String() string {
|
||||
switch v {
|
||||
case RFC4122:
|
||||
return "RFC4122"
|
||||
case Reserved:
|
||||
return "Reserved"
|
||||
case Microsoft:
|
||||
return "Microsoft"
|
||||
case Future:
|
||||
return "Future"
|
||||
case Invalid:
|
||||
return "Invalid"
|
||||
}
|
||||
return fmt.Sprintf("BadVariant%d", int(v))
|
||||
}
|
||||
|
||||
// SetRand sets the random number generator to r, which implements io.Reader.
|
||||
// If r.Read returns an error when the package requests random data then
|
||||
// a panic will be issued.
|
||||
//
|
||||
// Calling SetRand with nil sets the random number generator to the default
|
||||
// generator.
|
||||
func SetRand(r io.Reader) {
|
||||
if r == nil {
|
||||
rander = rand.Reader
|
||||
return
|
||||
}
|
||||
rander = r
|
||||
}
|
559
vendor/github.com/google/uuid/uuid_test.go
generated
vendored
Normal file
559
vendor/github.com/google/uuid/uuid_test.go
generated
vendored
Normal file
@ -0,0 +1,559 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type test struct {
|
||||
in string
|
||||
version Version
|
||||
variant Variant
|
||||
isuuid bool
|
||||
}
|
||||
|
||||
var tests = []test{
|
||||
{"f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, RFC4122, true},
|
||||
{"f47ac10b-58cc-1372-8567-0e02b2c3d479", 1, RFC4122, true},
|
||||
{"f47ac10b-58cc-2372-8567-0e02b2c3d479", 2, RFC4122, true},
|
||||
{"f47ac10b-58cc-3372-8567-0e02b2c3d479", 3, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-5372-8567-0e02b2c3d479", 5, RFC4122, true},
|
||||
{"f47ac10b-58cc-6372-8567-0e02b2c3d479", 6, RFC4122, true},
|
||||
{"f47ac10b-58cc-7372-8567-0e02b2c3d479", 7, RFC4122, true},
|
||||
{"f47ac10b-58cc-8372-8567-0e02b2c3d479", 8, RFC4122, true},
|
||||
{"f47ac10b-58cc-9372-8567-0e02b2c3d479", 9, RFC4122, true},
|
||||
{"f47ac10b-58cc-a372-8567-0e02b2c3d479", 10, RFC4122, true},
|
||||
{"f47ac10b-58cc-b372-8567-0e02b2c3d479", 11, RFC4122, true},
|
||||
{"f47ac10b-58cc-c372-8567-0e02b2c3d479", 12, RFC4122, true},
|
||||
{"f47ac10b-58cc-d372-8567-0e02b2c3d479", 13, RFC4122, true},
|
||||
{"f47ac10b-58cc-e372-8567-0e02b2c3d479", 14, RFC4122, true},
|
||||
{"f47ac10b-58cc-f372-8567-0e02b2c3d479", 15, RFC4122, true},
|
||||
|
||||
{"urn:uuid:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"URN:UUID:f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-0567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-1567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-2567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-3567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-4567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-5567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-6567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-7567-0e02b2c3d479", 4, Reserved, true},
|
||||
{"f47ac10b-58cc-4372-8567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-9567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-a567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-b567-0e02b2c3d479", 4, RFC4122, true},
|
||||
{"f47ac10b-58cc-4372-c567-0e02b2c3d479", 4, Microsoft, true},
|
||||
{"f47ac10b-58cc-4372-d567-0e02b2c3d479", 4, Microsoft, true},
|
||||
{"f47ac10b-58cc-4372-e567-0e02b2c3d479", 4, Future, true},
|
||||
{"f47ac10b-58cc-4372-f567-0e02b2c3d479", 4, Future, true},
|
||||
|
||||
|
||||
{"f47ac10b158cc-5372-a567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc25372-a567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-53723a567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-5372-a56740e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-5372-a567-0e02-2c3d479", 0, Invalid, false},
|
||||
{"g47ac10b-58cc-4372-a567-0e02b2c3d479", 0, Invalid, false},
|
||||
|
||||
|
||||
{"{f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, RFC4122, true},
|
||||
{"{f47ac10b-58cc-0372-8567-0e02b2c3d479", 0, Invalid, false},
|
||||
{"f47ac10b-58cc-0372-8567-0e02b2c3d479}", 0, Invalid, false},
|
||||
|
||||
{"f47ac10b58cc037285670e02b2c3d479", 0, RFC4122, true},
|
||||
{"f47ac10b58cc037285670e02b2c3d4790", 0, Invalid, false},
|
||||
{"f47ac10b58cc037285670e02b2c3d47", 0, Invalid, false},
|
||||
}
|
||||
|
||||
var constants = []struct {
|
||||
c interface{}
|
||||
name string
|
||||
}{
|
||||
{Person, "Person"},
|
||||
{Group, "Group"},
|
||||
{Org, "Org"},
|
||||
{Invalid, "Invalid"},
|
||||
{RFC4122, "RFC4122"},
|
||||
{Reserved, "Reserved"},
|
||||
{Microsoft, "Microsoft"},
|
||||
{Future, "Future"},
|
||||
{Domain(17), "Domain17"},
|
||||
{Variant(42), "BadVariant42"},
|
||||
}
|
||||
|
||||
func testTest(t *testing.T, in string, tt test) {
|
||||
uuid, err := Parse(in)
|
||||
if ok := (err == nil); ok != tt.isuuid {
|
||||
t.Errorf("Parse(%s) got %v expected %v\b", in, ok, tt.isuuid)
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if v := uuid.Variant(); v != tt.variant {
|
||||
t.Errorf("Variant(%s) got %d expected %d\b", in, v, tt.variant)
|
||||
}
|
||||
if v := uuid.Version(); v != tt.version {
|
||||
t.Errorf("Version(%s) got %d expected %d\b", in, v, tt.version)
|
||||
}
|
||||
}
|
||||
|
||||
func testBytes(t *testing.T, in []byte, tt test) {
|
||||
uuid, err := ParseBytes(in)
|
||||
if ok := (err == nil); ok != tt.isuuid {
|
||||
t.Errorf("ParseBytes(%s) got %v expected %v\b", in, ok, tt.isuuid)
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
suuid, _ := Parse(string(in))
|
||||
if uuid != suuid {
|
||||
t.Errorf("ParseBytes(%s) got %v expected %v\b", in, uuid, suuid)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUUID(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
testTest(t, tt.in, tt)
|
||||
testTest(t, strings.ToUpper(tt.in), tt)
|
||||
testBytes(t, []byte(tt.in), tt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFromBytes(t *testing.T) {
|
||||
b := []byte{
|
||||
0x7d, 0x44, 0x48, 0x40,
|
||||
0x9d, 0xc0,
|
||||
0x11, 0xd1,
|
||||
0xb2, 0x45,
|
||||
0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2,
|
||||
}
|
||||
uuid, err := FromBytes(b)
|
||||
if err != nil {
|
||||
t.Fatalf("%s", err)
|
||||
}
|
||||
for i := 0; i < len(uuid); i++ {
|
||||
if b[i] != uuid[i] {
|
||||
t.Fatalf("FromBytes() got %v expected %v\b", uuid[:], b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestConstants(t *testing.T) {
|
||||
for x, tt := range constants {
|
||||
v, ok := tt.c.(fmt.Stringer)
|
||||
if !ok {
|
||||
t.Errorf("%x: %v: not a stringer", x, v)
|
||||
} else if s := v.String(); s != tt.name {
|
||||
v, _ := tt.c.(int)
|
||||
t.Errorf("%x: Constant %T:%d gives %q, expected %q", x, tt.c, v, s, tt.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRandomUUID(t *testing.T) {
|
||||
m := make(map[string]bool)
|
||||
for x := 1; x < 32; x++ {
|
||||
uuid := New()
|
||||
s := uuid.String()
|
||||
if m[s] {
|
||||
t.Errorf("NewRandom returned duplicated UUID %s", s)
|
||||
}
|
||||
m[s] = true
|
||||
if v := uuid.Version(); v != 4 {
|
||||
t.Errorf("Random UUID of version %s", v)
|
||||
}
|
||||
if uuid.Variant() != RFC4122 {
|
||||
t.Errorf("Random UUID is variant %d", uuid.Variant())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
m := make(map[UUID]bool)
|
||||
for x := 1; x < 32; x++ {
|
||||
s := New()
|
||||
if m[s] {
|
||||
t.Errorf("New returned duplicated UUID %s", s)
|
||||
}
|
||||
m[s] = true
|
||||
uuid, err := Parse(s.String())
|
||||
if err != nil {
|
||||
t.Errorf("New.String() returned %q which does not decode", s)
|
||||
continue
|
||||
}
|
||||
if v := uuid.Version(); v != 4 {
|
||||
t.Errorf("Random UUID of version %s", v)
|
||||
}
|
||||
if uuid.Variant() != RFC4122 {
|
||||
t.Errorf("Random UUID is variant %d", uuid.Variant())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestClockSeq(t *testing.T) {
|
||||
// Fake time.Now for this test to return a monotonically advancing time; restore it at end.
|
||||
defer func(orig func() time.Time) { timeNow = orig }(timeNow)
|
||||
monTime := time.Now()
|
||||
timeNow = func() time.Time {
|
||||
monTime = monTime.Add(1 * time.Second)
|
||||
return monTime
|
||||
}
|
||||
|
||||
SetClockSequence(-1)
|
||||
uuid1, err := NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
uuid2, err := NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
|
||||
if s1, s2 := uuid1.ClockSequence(), uuid2.ClockSequence(); s1 != s2 {
|
||||
t.Errorf("clock sequence %d != %d", s1, s2)
|
||||
}
|
||||
|
||||
SetClockSequence(-1)
|
||||
uuid2, err = NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
|
||||
// Just on the very off chance we generated the same sequence
|
||||
// two times we try again.
|
||||
if uuid1.ClockSequence() == uuid2.ClockSequence() {
|
||||
SetClockSequence(-1)
|
||||
uuid2, err = NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
}
|
||||
if s1, s2 := uuid1.ClockSequence(), uuid2.ClockSequence(); s1 == s2 {
|
||||
t.Errorf("Duplicate clock sequence %d", s1)
|
||||
}
|
||||
|
||||
SetClockSequence(0x1234)
|
||||
uuid1, err = NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
if seq := uuid1.ClockSequence(); seq != 0x1234 {
|
||||
t.Errorf("%s: expected seq 0x1234 got 0x%04x", uuid1, seq)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoding(t *testing.T) {
|
||||
text := "7d444840-9dc0-11d1-b245-5ffdce74fad2"
|
||||
urn := "urn:uuid:7d444840-9dc0-11d1-b245-5ffdce74fad2"
|
||||
data := UUID{
|
||||
0x7d, 0x44, 0x48, 0x40,
|
||||
0x9d, 0xc0,
|
||||
0x11, 0xd1,
|
||||
0xb2, 0x45,
|
||||
0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2,
|
||||
}
|
||||
if v := data.String(); v != text {
|
||||
t.Errorf("%x: encoded to %s, expected %s", data, v, text)
|
||||
}
|
||||
if v := data.URN(); v != urn {
|
||||
t.Errorf("%x: urn is %s, expected %s", data, v, urn)
|
||||
}
|
||||
|
||||
uuid, err := Parse(text)
|
||||
if err != nil {
|
||||
t.Errorf("Parse returned unexpected error %v", err)
|
||||
}
|
||||
if data != uuid {
|
||||
t.Errorf("%s: decoded to %s, expected %s", text, uuid, data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVersion1(t *testing.T) {
|
||||
uuid1, err := NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
uuid2, err := NewUUID()
|
||||
if err != nil {
|
||||
t.Fatalf("could not create UUID: %v", err)
|
||||
}
|
||||
|
||||
if uuid1 == uuid2 {
|
||||
t.Errorf("%s:duplicate uuid", uuid1)
|
||||
}
|
||||
if v := uuid1.Version(); v != 1 {
|
||||
t.Errorf("%s: version %s expected 1", uuid1, v)
|
||||
}
|
||||
if v := uuid2.Version(); v != 1 {
|
||||
t.Errorf("%s: version %s expected 1", uuid2, v)
|
||||
}
|
||||
n1 := uuid1.NodeID()
|
||||
n2 := uuid2.NodeID()
|
||||
if !bytes.Equal(n1, n2) {
|
||||
t.Errorf("Different nodes %x != %x", n1, n2)
|
||||
}
|
||||
t1 := uuid1.Time()
|
||||
t2 := uuid2.Time()
|
||||
q1 := uuid1.ClockSequence()
|
||||
q2 := uuid2.ClockSequence()
|
||||
|
||||
switch {
|
||||
case t1 == t2 && q1 == q2:
|
||||
t.Error("time stopped")
|
||||
case t1 > t2 && q1 == q2:
|
||||
t.Error("time reversed")
|
||||
case t1 < t2 && q1 != q2:
|
||||
t.Error("clock sequence changed unexpectedly")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNode(t *testing.T) {
|
||||
// This test is mostly to make sure we don't leave nodeMu locked.
|
||||
ifname = ""
|
||||
if ni := NodeInterface(); ni != "" {
|
||||
t.Errorf("NodeInterface got %q, want %q", ni, "")
|
||||
}
|
||||
if SetNodeInterface("xyzzy") {
|
||||
t.Error("SetNodeInterface succeeded on a bad interface name")
|
||||
}
|
||||
if !SetNodeInterface("") {
|
||||
t.Error("SetNodeInterface failed")
|
||||
}
|
||||
if runtime.GOARCH != "js" {
|
||||
if ni := NodeInterface(); ni == "" {
|
||||
t.Error("NodeInterface returned an empty string")
|
||||
}
|
||||
}
|
||||
|
||||
ni := NodeID()
|
||||
if len(ni) != 6 {
|
||||
t.Errorf("ni got %d bytes, want 6", len(ni))
|
||||
}
|
||||
hasData := false
|
||||
for _, b := range ni {
|
||||
if b != 0 {
|
||||
hasData = true
|
||||
}
|
||||
}
|
||||
if !hasData {
|
||||
t.Error("nodeid is all zeros")
|
||||
}
|
||||
|
||||
id := []byte{1, 2, 3, 4, 5, 6, 7, 8}
|
||||
SetNodeID(id)
|
||||
ni = NodeID()
|
||||
if !bytes.Equal(ni, id[:6]) {
|
||||
t.Errorf("got nodeid %v, want %v", ni, id[:6])
|
||||
}
|
||||
|
||||
if ni := NodeInterface(); ni != "user" {
|
||||
t.Errorf("got interface %q, want %q", ni, "user")
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeAndTime(t *testing.T) {
|
||||
// Time is February 5, 1998 12:30:23.136364800 AM GMT
|
||||
|
||||
uuid, err := Parse("7d444840-9dc0-11d1-b245-5ffdce74fad2")
|
||||
if err != nil {
|
||||
t.Fatalf("Parser returned unexpected error %v", err)
|
||||
}
|
||||
node := []byte{0x5f, 0xfd, 0xce, 0x74, 0xfa, 0xd2}
|
||||
|
||||
ts := uuid.Time()
|
||||
c := time.Unix(ts.UnixTime())
|
||||
want := time.Date(1998, 2, 5, 0, 30, 23, 136364800, time.UTC)
|
||||
if !c.Equal(want) {
|
||||
t.Errorf("Got time %v, want %v", c, want)
|
||||
}
|
||||
if !bytes.Equal(node, uuid.NodeID()) {
|
||||
t.Errorf("Expected node %v got %v", node, uuid.NodeID())
|
||||
}
|
||||
}
|
||||
|
||||
func TestMD5(t *testing.T) {
|
||||
uuid := NewMD5(NameSpaceDNS, []byte("python.org")).String()
|
||||
want := "6fa459ea-ee8a-3ca4-894e-db77e160355e"
|
||||
if uuid != want {
|
||||
t.Errorf("MD5: got %q expected %q", uuid, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSHA1(t *testing.T) {
|
||||
uuid := NewSHA1(NameSpaceDNS, []byte("python.org")).String()
|
||||
want := "886313e1-3b8a-5372-9b90-0c9aee199e5d"
|
||||
if uuid != want {
|
||||
t.Errorf("SHA1: got %q expected %q", uuid, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeID(t *testing.T) {
|
||||
nid := []byte{1, 2, 3, 4, 5, 6}
|
||||
SetNodeInterface("")
|
||||
s := NodeInterface()
|
||||
if runtime.GOARCH != "js" {
|
||||
if s == "" || s == "user" {
|
||||
t.Errorf("NodeInterface %q after SetInterface", s)
|
||||
}
|
||||
}
|
||||
node1 := NodeID()
|
||||
if node1 == nil {
|
||||
t.Error("NodeID nil after SetNodeInterface", s)
|
||||
}
|
||||
SetNodeID(nid)
|
||||
s = NodeInterface()
|
||||
if s != "user" {
|
||||
t.Errorf("Expected NodeInterface %q got %q", "user", s)
|
||||
}
|
||||
node2 := NodeID()
|
||||
if node2 == nil {
|
||||
t.Error("NodeID nil after SetNodeID", s)
|
||||
}
|
||||
if bytes.Equal(node1, node2) {
|
||||
t.Error("NodeID not changed after SetNodeID", s)
|
||||
} else if !bytes.Equal(nid, node2) {
|
||||
t.Errorf("NodeID is %x, expected %x", node2, nid)
|
||||
}
|
||||
}
|
||||
|
||||
func testDCE(t *testing.T, name string, uuid UUID, err error, domain Domain, id uint32) {
|
||||
if err != nil {
|
||||
t.Errorf("%s failed: %v", name, err)
|
||||
return
|
||||
}
|
||||
if v := uuid.Version(); v != 2 {
|
||||
t.Errorf("%s: %s: expected version 2, got %s", name, uuid, v)
|
||||
return
|
||||
}
|
||||
if v := uuid.Domain(); v != domain {
|
||||
t.Errorf("%s: %s: expected domain %d, got %d", name, uuid, domain, v)
|
||||
}
|
||||
if v := uuid.ID(); v != id {
|
||||
t.Errorf("%s: %s: expected id %d, got %d", name, uuid, id, v)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDCE(t *testing.T) {
|
||||
uuid, err := NewDCESecurity(42, 12345678)
|
||||
testDCE(t, "NewDCESecurity", uuid, err, 42, 12345678)
|
||||
uuid, err = NewDCEPerson()
|
||||
testDCE(t, "NewDCEPerson", uuid, err, Person, uint32(os.Getuid()))
|
||||
uuid, err = NewDCEGroup()
|
||||
testDCE(t, "NewDCEGroup", uuid, err, Group, uint32(os.Getgid()))
|
||||
}
|
||||
|
||||
type badRand struct{}
|
||||
|
||||
func (r badRand) Read(buf []byte) (int, error) {
|
||||
for i := range buf {
|
||||
buf[i] = byte(i)
|
||||
}
|
||||
return len(buf), nil
|
||||
}
|
||||
|
||||
func TestBadRand(t *testing.T) {
|
||||
SetRand(badRand{})
|
||||
uuid1 := New()
|
||||
uuid2 := New()
|
||||
if uuid1 != uuid2 {
|
||||
t.Errorf("expected duplicates, got %q and %q", uuid1, uuid2)
|
||||
}
|
||||
SetRand(nil)
|
||||
uuid1 = New()
|
||||
uuid2 = New()
|
||||
if uuid1 == uuid2 {
|
||||
t.Errorf("unexpected duplicates, got %q", uuid1)
|
||||
}
|
||||
}
|
||||
|
||||
var asString = "f47ac10b-58cc-0372-8567-0e02b2c3d479"
|
||||
var asBytes = []byte(asString)
|
||||
|
||||
func BenchmarkParse(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := Parse(asString)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParseBytes(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := ParseBytes(asBytes)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// parseBytesUnsafe is to benchmark using unsafe.
|
||||
func parseBytesUnsafe(b []byte) (UUID, error) {
|
||||
return Parse(*(*string)(unsafe.Pointer(&b)))
|
||||
}
|
||||
|
||||
func BenchmarkParseBytesUnsafe(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := parseBytesUnsafe(asBytes)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// parseBytesCopy is to benchmark not using unsafe.
|
||||
func parseBytesCopy(b []byte) (UUID, error) {
|
||||
return Parse(string(b))
|
||||
}
|
||||
|
||||
func BenchmarkParseBytesCopy(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := parseBytesCopy(asBytes)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkNew(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
New()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_String(b *testing.B) {
|
||||
uuid, err := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
if uuid.String() == "" {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkUUID_URN(b *testing.B) {
|
||||
uuid, err := Parse("f47ac10b-58cc-0372-8567-0e02b2c3d479")
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
for i := 0; i < b.N; i++ {
|
||||
if uuid.URN() == "" {
|
||||
b.Fatal("invalid uuid")
|
||||
}
|
||||
}
|
||||
}
|
44
vendor/github.com/google/uuid/version1.go
generated
vendored
Normal file
44
vendor/github.com/google/uuid/version1.go
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
)
|
||||
|
||||
// NewUUID returns a Version 1 UUID based on the current NodeID and clock
|
||||
// sequence, and the current time. If the NodeID has not been set by SetNodeID
|
||||
// or SetNodeInterface then it will be set automatically. If the NodeID cannot
|
||||
// be set NewUUID returns nil. If clock sequence has not been set by
|
||||
// SetClockSequence then it will be set automatically. If GetTime fails to
|
||||
// return the current NewUUID returns nil and an error.
|
||||
//
|
||||
// In most cases, New should be used.
|
||||
func NewUUID() (UUID, error) {
|
||||
nodeMu.Lock()
|
||||
if nodeID == zeroID {
|
||||
setNodeInterface("")
|
||||
}
|
||||
nodeMu.Unlock()
|
||||
|
||||
var uuid UUID
|
||||
now, seq, err := GetTime()
|
||||
if err != nil {
|
||||
return uuid, err
|
||||
}
|
||||
|
||||
timeLow := uint32(now & 0xffffffff)
|
||||
timeMid := uint16((now >> 32) & 0xffff)
|
||||
timeHi := uint16((now >> 48) & 0x0fff)
|
||||
timeHi |= 0x1000 // Version 1
|
||||
|
||||
binary.BigEndian.PutUint32(uuid[0:], timeLow)
|
||||
binary.BigEndian.PutUint16(uuid[4:], timeMid)
|
||||
binary.BigEndian.PutUint16(uuid[6:], timeHi)
|
||||
binary.BigEndian.PutUint16(uuid[8:], seq)
|
||||
copy(uuid[10:], nodeID[:])
|
||||
|
||||
return uuid, nil
|
||||
}
|
38
vendor/github.com/google/uuid/version4.go
generated
vendored
Normal file
38
vendor/github.com/google/uuid/version4.go
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright 2016 Google Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package uuid
|
||||
|
||||
import "io"
|
||||
|
||||
// New creates a new random UUID or panics. New is equivalent to
|
||||
// the expression
|
||||
//
|
||||
// uuid.Must(uuid.NewRandom())
|
||||
func New() UUID {
|
||||
return Must(NewRandom())
|
||||
}
|
||||
|
||||
// NewRandom returns a Random (Version 4) UUID.
|
||||
//
|
||||
// The strength of the UUIDs is based on the strength of the crypto/rand
|
||||
// package.
|
||||
//
|
||||
// A note about uniqueness derived from the UUID Wikipedia entry:
|
||||
//
|
||||
// Randomly generated UUIDs have 122 random bits. One's annual risk of being
|
||||
// hit by a meteorite is estimated to be one chance in 17 billion, that
|
||||
// means the probability is about 0.00000000006 (6 × 10−11),
|
||||
// equivalent to the odds of creating a few tens of trillions of UUIDs in a
|
||||
// year and having one duplicate.
|
||||
func NewRandom() (UUID, error) {
|
||||
var uuid UUID
|
||||
_, err := io.ReadFull(rander, uuid[:])
|
||||
if err != nil {
|
||||
return Nil, err
|
||||
}
|
||||
uuid[6] = (uuid[6] & 0x0f) | 0x40 // Version 4
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80 // Variant is 10
|
||||
return uuid, nil
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user